From bd00f25a7096614ff87ffbd65d44c3a515788981 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 4 Jun 2020 21:05:01 -0700 Subject: preproc: commas inside parens don't break macro arguments Legacy NASM behavior is (quite frankly the sane one) that a comma inside a set of parentheses do not split smacro arguments, unless explicitly using braces to enforce this behavior. Revert to legacy behavior, which again, is arguably the more correct. Signed-off-by: H. Peter Anvin --- asm/preproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'asm') diff --git a/asm/preproc.c b/asm/preproc.c index 414a9724..793df558 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -5093,7 +5093,7 @@ static SMacro *expand_one_smacro(Token ***tpp) switch (t->text.a[0]) { case ',': - if (!brackets) + if (!brackets && paren == 1) nparam++; break; @@ -5208,7 +5208,7 @@ static SMacro *expand_one_smacro(Token ***tpp) switch (ch) { case ',': - if (!brackets && !(flags & SPARM_GREEDY)) { + if (!brackets && paren == 1 && !(flags & SPARM_GREEDY)) { i++; nasm_assert(i < nparam); phead = pep = ¶ms[i]; -- cgit v1.2.1