NASM 2.10rc15
[nasm/avx512.git] / test / macro-defaults.asm
blob047f20536eea8be815fad854234a3a877aad6450
1 ;Testname=warning; Arguments=-fbin -omacdef.bin -w+macro-defaults; Files=stdout stderr macdef.bin
2 ;Testname=nonwarning; Arguments=-fbin -omacdef.bin -w-macro-defaults; Files=stdout stderr macdef.bin
4 %MACRO mmac_fix 1 a
5 ; While defined to take one parameter, any invocation will
6 ; see two, due to the default parameter.
7 %warning %0 %1 %2 %3 %4 %5
8 %ENDMACRO
9 mmac_fix one
11 %MACRO mmac_var 1-2 a,b
12 ; While defined to take one or two parameters, invocations
13 ; will see three, due to the default parameters.
14 %warning %0 %1 %2 %3 %4 %5
15 %ENDMACRO
16 mmac_var one
17 mmac_var one,two
19 %MACRO mmac_plus 1-2+ a,b
20 ; This does not warn. Although this looks like two default
21 ; parameters, it ends up being only one: the "+" limits it
22 ; to two parameters; if invoked without a second parameter
23 ; the second parameter will be "a,b".
24 %warning %0 %1 %2 %3 %4 %5
25 ;Check rotating behaviour
26 %ENDMACRO
27 mmac_plus one
28 mmac_plus one,two
29 mmac_plus one,two,three
31 %MACRO mmac_star 1-* a,b
32 ; This does not warn. Because the "*" extends the range of
33 ; parameters to infinity, the "a,b" default parameters can
34 ; not exceed that range.
35 %warning %0 %1 %2 %3 %4 %5
36 %ENDMACRO
37 mmac_star one
38 mmac_star one,two
39 mmac_star one,two,three
41 %MACRO mmac_rotate 0-* a,b
42 %warning %0 %1 %2 %3 %4 %5
43 ;%rotate should rotate all parameters
44 %rotate 1
45 %warning %0 %1 %2 %3 %4 %5
46 %ENDMACRO
47 mmac_rotate
48 mmac_rotate one
49 mmac_rotate one,two
50 mmac_rotate one,two,three
52 ;Scope / evaluation time test
53 %define I 0
54 %assign J 0
55 %xdefine K 0
57 %MACRO mmac_scope 0 I J K
58 %warning %1 %2 %3
59 %ENDMACRO
61 %define I 1
62 %assign J 1
63 %xdefine K 1
64 mmac_scope