preproc: smacro argument lists can't be preceded by space

The smacro argument list cannot be preceded by whitespace, or we
wouldn't be able to define no-argument smacros the expansion of which
starts with (.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin (Intel) 2019-08-20 16:19:37 -07:00
parent ffe89ddaed
commit d4607846a4

View File

@ -2320,10 +2320,14 @@ static int parse_smacro_template(Token ***tpp, SMacro *tmpl)
Token *t = *tn;
Token *name;
while (t && t->type == TOK_WHITESPACE) {
tn = &t->next;
t = *tn;
}
/*
* DO NOT skip whitespace here, or we won't be able to distinguish:
*
* %define foo (a,b) ; no arguments, (a,b) is the expansion
* %define bar(a,b) ; two arguments, empty expansion
*
* This ambiguity was inherited from C.
*/
if (!tok_is_(t, "("))
goto finish;