diff options
author | H. Peter Anvin <hpa@zytor.com> | 2020-06-04 21:05:01 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2020-06-04 21:05:01 -0700 |
commit | bd00f25a7096614ff87ffbd65d44c3a515788981 (patch) | |
tree | f70f7fc390f426e80c6d248f1dac3e225b57184e /asm | |
parent | 152cbd37e208b683f424de5d56e35d840b4be31e (diff) | |
download | nasm-bd00f25a7096614ff87ffbd65d44c3a515788981.tar.gz |
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 <hpa@zytor.com>
Diffstat (limited to 'asm')
-rw-r--r-- | asm/preproc.c | 4 |
1 files changed, 2 insertions, 2 deletions
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]; |