aboutsummaryrefslogtreecommitdiffstats
path: root/asm
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2020-09-04 14:35:49 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2020-09-04 14:35:49 -0700
commitdab902cbdc194d55d08a2df14d2f05dd8aa97f32 (patch)
tree8c38e564019779971e718356cb7bfd3181d6c0e9 /asm
parent6bd975476f3d931a1f0f7a392a53604bf9a4d3cf (diff)
downloadnasm-dab902cbdc194d55d08a2df14d2f05dd8aa97f32.tar.gz
nasm-dab902cbdc194d55d08a2df14d2f05dd8aa97f32.tar.xz
nasm-dab902cbdc194d55d08a2df14d2f05dd8aa97f32.zip
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@zytor.com>
Diffstat (limited to 'asm')
-rw-r--r--asm/preproc.c6
1 files 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(&params[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;