mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-27 08:10:07 +08:00
preproc: make %exitrep do what it is supposed to
%exitrep should should stop emitting code immediately, not just terminate the loop when we hit %endrep. There is a bunch of hacky code that special-cases that using istk->in_progress == 0. The handling of the tail of %exitrep, %include and non-emitting conditionals using entirely different mechanisms is just dumb. They need to be unified. Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392612 Reported-by: Jason Hood <jadoxa@yahoo.com.au> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
58bd8e6644
commit
d983b62233
@ -3986,7 +3986,7 @@ issue_error:
|
||||
break;
|
||||
|
||||
if (l)
|
||||
l->finishes->in_progress = 1;
|
||||
l->finishes->in_progress = 0;
|
||||
else
|
||||
nasm_nonfatal("`%%exitrep' not within `%%rep' block");
|
||||
break;
|
||||
|
16
test/exitrep.asm
Normal file
16
test/exitrep.asm
Normal file
@ -0,0 +1,16 @@
|
||||
%macro testrep 0.nolist
|
||||
%assign i 1
|
||||
%rep 4
|
||||
mov eax,i
|
||||
%if i==3
|
||||
%exitrep
|
||||
%endif
|
||||
mov ebx,i
|
||||
%ifn i < 3
|
||||
%error iteration i should not be seen
|
||||
%endif
|
||||
%assign i i+1
|
||||
%endrep
|
||||
%endmacro
|
||||
|
||||
testrep
|
Loading…
Reference in New Issue
Block a user