PP: Fix #1694: Handle badly formed argument substitution.

Also added a warning for no space after a macro name.
This commit is contained in:
John Kessenich 2019-02-11 03:05:00 -07:00
parent d83344fc4e
commit 9840f11f85
7 changed files with 35 additions and 7 deletions

View file

@ -147,6 +147,10 @@ int TPpContext::CPPdefine(TPpToken* ppToken)
}
token = scanToken(ppToken);
} else if (token != '\n' && token != EndOfInput && !ppToken->space) {
parseContext.ppWarn(ppToken->loc, "missing space after macro name", "#define", "");
return token;
}
// record the definition of the macro

View file

@ -1056,7 +1056,7 @@ int TPpContext::tokenize(TPpToken& ppToken)
// Handle token-pasting logic
token = tokenPaste(token, ppToken);
if (token == EndOfInput) {
if (token == EndOfInput || token == tMarkerInput::marker) {
missingEndifCheck();
return EndOfInput;
}