nasm/test/evalmacro.asm
H. Peter Anvin (Intel) d6e817751e listing: add -L option for additional listing info
Add an -L option for additional listing information. Currently
supported is -Le, which emits each line after processing through the
preprocessor, and -Lm, which displays each single-line macro defined
or undefined.

NASM doesn't preserve the names of unused arguments, nor does it have
any technical reason to do so. Instead of adding complexity to save
them, make unnamed parameters official by specifying an empty string
in the argument list.

This has the additional advantage that () is now simply considered a
single empty argument, which means that NASM should now properly
handle things like:

%define myreg() eax
	mov edx,myreg()

... similar to how the C preprocessor allows an empty macro argument
list which is distinct from a macro with no arguments whatsoever.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-09 08:39:02 -07:00

13 lines
240 B
NASM

%define tonum(=x) x
dd tonum(1+3)
dd tonum(5*7)
%define mixed(a,=b,c) (a + b)
%define mixed2(a,=b,) (a + b)
%define ALPHA (1 + 2)
%define BETA (3 + 4)
%define GAMMA (5 + 6)
dd mixed(ALPHA, BETA, GAMMA)
dd mixed2(ALPHA, BETA, GAMMA)