1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 19:29:37 +00:00

A space character will be inserted in front of a leading '#' pp-token as the result of macro expansion.

This commit is contained in:
acqn 2022-09-01 12:58:52 +08:00
parent 770e529b20
commit 92f94e4e5b

View File

@ -2216,6 +2216,13 @@ static unsigned ReplaceMacros (StrBuf* Source, StrBuf* Target, MacroExp* E, unsi
InitLine (TmpTarget);
PushRescanLine (CurRescanStack, TmpTarget, LastTokLen);
/* Add a space before a '#' at the beginning of the line */
if (CurC == '#' &&
NextC != '#' &&
(SB_IsEmpty (Target) || SB_LookAtLast (Target) == '\n')) {
SB_AppendChar (Target, ' ');
}
/* Switch the buffers */
TmpTarget = NewStrBuf ();
} else if (PendingNewLines > 0 && MultiLine) {