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>
This commit is contained in:
H. Peter Anvin (Intel) 2020-09-04 14:35:49 -07:00
parent 6bd975476f
commit dab902cbdc

View File

@ -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;