Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/cc65/preproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2640,6 +2640,18 @@ static void DoDefine (void)
goto Error_Handler;
}
NextChar ();

} else {

/* Object like macro. Check ISO/IEC 9899:1999 (E) 6.10.3p3:
** "There shall be white-space between the identifier and the
** replacement list in the definition of an object-like macro."
** Note: C89 doesn't have this constraint.
*/
if (Std == STD_C99 && !IsSpace (CurC)) {
PPWarning ("ISO C99 requires whitespace after the macro name");
}

}

/* Remove whitespace and comments from the line, store the preprocessed
Expand Down Expand Up @@ -2913,7 +2925,7 @@ static unsigned GetLineDirectiveNum (void)

/* Ensure the buffer is terminated with a '\0' */
SB_Terminate (&Buf);
if (SkipWhitespace (0) != 0 || CurC == '\0') {
if (SB_GetLen (&Buf) > 0) {
const char* Str = SB_GetConstBuf (&Buf);
if (Str[0] == '\0') {
PPWarning ("#line directive interprets number as decimal, not octal");
Expand All @@ -2929,9 +2941,10 @@ static unsigned GetLineDirectiveNum (void)
}
}
} else {
PPError ("#line directive requires a simple decimal digit sequence");
PPError ("#line directive requires a decimal digit sequence");
ClearLine ();
}
SkipWhitespace (0);

/* Done with the buffer */
SB_Done (&Buf);
Expand Down