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