[nasm:master] preproc: when parsing an smacro template, don't mistake , for )
nasm-bot for H. Peter Anvin (Intel)
hpa at zytor.com
Fri Sep 4 14:39:04 PDT 2020
Commit-ID: dab902cbdc194d55d08a2df14d2f05dd8aa97f32
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=dab902cbdc194d55d08a2df14d2f05dd8aa97f32
Author: H. Peter Anvin (Intel) <hpa at zytor.com>
AuthorDate: Fri, 4 Sep 2020 14:35:49 -0700
Committer: H. Peter Anvin (Intel) <hpa at zytor.com>
CommitDate: Fri, 4 Sep 2020 14:35:49 -0700
preproc: when parsing an smacro template, don't mistake , for )
The operation of the ',' and ')' tokens are very similar, except for:
',' issues a error if the processed parameter is greedy;
')' sets the "done" variable.
The code would incorrectly set "done" for a ',' token. This fixes
travis test br3392711.
Signed-off-by: H. Peter Anvin (Intel) <hpa at zytor.com>
---
asm/preproc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/asm/preproc.c b/asm/preproc.c
index b8fb6d23..bd385157 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -2963,8 +2963,11 @@ static int parse_smacro_template(Token ***tpp, SMacro *tmpl)
case ',':
if (greedy)
nasm_nonfatal("greedy parameter must be last");
- /* fall through */
+ goto end_param;
case ')':
+ done = true;
+ goto end_param;
+ end_param:
if (params) {
if (name)
steal_Token(¶ms[nparam].name, name);
@@ -2973,7 +2976,6 @@ static int parse_smacro_template(Token ***tpp, SMacro *tmpl)
nparam++;
name = NULL;
flags = 0;
- done = true;
break;
case TOKEN_WHITESPACE:
break;
More information about the Nasm-commits
mailing list