[nasm:nasm-2.15.xx] preproc: commas inside parens don't break macro arguments
nasm-bot for H. Peter Anvin
hpa at zytor.com
Thu Jun 4 21:09:03 PDT 2020
Commit-ID: bd00f25a7096614ff87ffbd65d44c3a515788981
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=bd00f25a7096614ff87ffbd65d44c3a515788981
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Thu, 4 Jun 2020 21:05:01 -0700
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Thu, 4 Jun 2020 21:05:01 -0700
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 at zytor.com>
---
asm/preproc.c | 4 ++--
1 file 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];
More information about the Nasm-commits
mailing list