aboutsummaryrefslogtreecommitdiffstats
path: root/test/gsmacro.asm
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2019-08-20 01:32:28 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2019-08-20 01:32:28 -0700
commita1a844697daabe0e8c493c6abada8049431b7fd2 (patch)
treecea9617f7dfbf63ec5cfdfe4e0d272be5d18a736 /test/gsmacro.asm
parent62cf4aaef6a6216fd0921f1ced4671dee6053d9f (diff)
downloadnasm-a1a844697daabe0e8c493c6abada8049431b7fd2.tar.gz
nasm-a1a844697daabe0e8c493c6abada8049431b7fd2.tar.xz
nasm-a1a844697daabe0e8c493c6abada8049431b7fd2.zip
preproc: fix varadic macros, add conditional comma operator
Fix the (severely broken handling of) varadic macros. Add a conditional comma operator "%,". This expands to a comma unless followed by a null expansion of some sort, which allows suppressing the comma before an empty argument (usually varadic, but not necessarily.) Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'test/gsmacro.asm')
-rw-r--r--test/gsmacro.asm6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/gsmacro.asm b/test/gsmacro.asm
new file mode 100644
index 00000000..11e13b43
--- /dev/null
+++ b/test/gsmacro.asm
@@ -0,0 +1,6 @@
+%define greedy(a,b,c+) a + 66 %, b * 3 %, c
+
+ db greedy(1,2)
+ db greedy(1,2,3)
+ db greedy(1,2,3,4)
+ db greedy(1,2,3,4,5)