1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-15 02:29:32 +00:00

Fixed parentheses handling when a function-like macro name itself is used as an macro argument.

This commit is contained in:
acqn 2022-08-07 12:45:48 +08:00
parent 0a051a4dee
commit 7971eec3cc

View File

@ -1142,17 +1142,27 @@ static void MacroReplacement (StrBuf* Source, StrBuf* Target, int MultiLine)
if (Whitespace > 0) {
SB_AppendChar (Target, ' ');
}
if (CurC == '#') {
if (OLine == 0) {
OLine = Target;
ParseDirectives (0);
OLine = 0;
} else {
ParseDirectives (0);
/* Directives can only be found in an argument list
** that spans multiple lines.
*/
if (MultiLine) {
if (CurC == '#') {
/* If we were going to support #pragma in
** macro argument list, it would be output
** to OLine.
*/
if (OLine == 0) {
OLine = Target;
ParseDirectives (0);
OLine = 0;
} else {
ParseDirectives (0);
}
}
/* Add the source info to preprocessor output if needed */
AddPreLine (Target);
}
/* Add the source info to preprocessor output if needed */
AddPreLine (Target);
} else {
/* Function-like macro */
if (OLine == 0) {