Fix #1079: don't give error when macro() name used without open (.

This commit is contained in:
John Kessenich 2017-11-02 06:48:32 -06:00
parent e8d21388ed
commit 88e22a6090
6 changed files with 83 additions and 8 deletions

View file

@ -1157,7 +1157,6 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka
}
MacroSymbol* macro = macroAtom == 0 ? nullptr : lookupMacroDef(macroAtom);
int token;
int depth = 0;
// no recursive expansions
@ -1179,13 +1178,12 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka
TSourceLoc loc = ppToken->loc; // in case we go to the next line before discovering the error
in->mac = macro;
if (macro->args.size() > 0 || macro->emptyArgs) {
token = scanToken(ppToken);
int token = scanToken(ppToken);
if (newLineOkay) {
while (token == '\n')
token = scanToken(ppToken);
}
if (token != '(') {
parseContext.ppError(loc, "expected '(' following", "macro expansion", atomStrings.getString(macroAtom));
UngetToken(token, ppToken);
delete in;
return 0;