0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-10-10 00:25:06 -04:00
Files
nasm/test/exitrep.asm
H. Peter Anvin d9958f428a test/exitrep: test for proper %if and %rep evaluation suppression
If a line is suppressed, the %if or %rep condition must never be
evaluated. Test for it, and add the exitrep test to travis.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-06 09:38:55 -07:00

47 lines
693 B
NASM

%macro testrep 0-1
%assign i 1
%rep %1 4
mov eax,i
%if i==3
%exitrep
%if bull!shit ; Syntax error if evaluated
nop
%endif
%rep other::bullshit ; Same
nop
%endrep
%endif
mov ebx,i
%note in %?%1 iteration i
%if i >= 3
%error iteration i should not be seen
%endif
%assign i i+1
%endrep
ret
%endmacro
%macro testrep_nl 0-1.nolist
%assign i 1
%rep %1 4
mov eax,i
%if i==3
%exitrep
%endif
%note in %?%1 iteration i
mov ebx,i
%if i >= 3
%error iteration i should not be seen
%endif
%assign i i+1
%endrep
ret
%endmacro
testrep
testrep .nolist
testrep_nl
testrep_nl .nolist