diff options
author | H. Peter Anvin (Intel) <hpa@zytor.com> | 2019-08-20 16:19:37 -0700 |
---|---|---|
committer | H. Peter Anvin (Intel) <hpa@zytor.com> | 2019-08-20 16:19:37 -0700 |
commit | d4607846a4e0774aa134b15e8ffe8e3a0a18efa0 (patch) | |
tree | f8078bf4ae1870a10a450b4083c41fe17c0e30c7 | |
parent | ffe89ddaed9c53a4c43946cce1c8e43470f8a284 (diff) | |
download | nasm-d4607846a4e0774aa134b15e8ffe8e3a0a18efa0.tar.gz |
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>
-rw-r--r-- | asm/preproc.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/asm/preproc.c b/asm/preproc.c index 125fa100..a3f8b7de 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -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; |