ref: 8a1e920e23f78e7e96307a45d80b463d34a30cd0
parent: 373762dedcbd0f6a4b59c43fbc22884337c7380c
author: ISSOtm <[email protected]>
date: Thu Dec 12 18:46:10 EST 2019
Fix incorrect line counting when running REPT blocks. Fixes #461
--- a/src/asm/fstack.c
+++ b/src/asm/fstack.c
@@ -163,7 +163,8 @@
}
yy_delete_buffer(CurrentFlexHandle);
- nLineNo = pLastFile->nLine;
+ nLineNo = nCurrentStatus == STAT_isREPTBlock ? nCurrentREPTBodyLastLine
+ : pLastFile->nLine;
if (nCurrentStatus == STAT_isInclude)
fclose(pCurrentFile);
@@ -190,8 +191,6 @@
nCurrentREPTBlockSize = pLastFile->nREPTBlockSize;
nCurrentREPTBlockCount = pLastFile->nREPTBlockCount;
nCurrentREPTBodyFirstLine = pLastFile->nREPTBodyFirstLine;
- /* + 1 to account for the `ENDR` line */
- nLineNo = pLastFile->nREPTBodyLastLine + 1;
break;
default:
fatalerror("%s: Internal error.", __func__);
--- /dev/null
+++ b/test/asm/rept-line-no.asm
@@ -1,0 +1,8 @@
+
+ WARN "Line 2"
+REPT 3
+
+ WARN "Line 5"
+
+ENDR
+ WARN "Line 8"
--- /dev/null
+++ b/test/asm/rept-line-no.out
@@ -1,0 +1,10 @@
+warning: rept-line-no.asm(2): [-Wuser]
+ Line 2
+warning: rept-line-no.asm(3) -> rept-line-no.asm::REPT~1(5): [-Wuser]
+ Line 5
+warning: rept-line-no.asm(3) -> rept-line-no.asm::REPT~2(5): [-Wuser]
+ Line 5
+warning: rept-line-no.asm(3) -> rept-line-no.asm::REPT~3(5): [-Wuser]
+ Line 5
+warning: rept-line-no.asm(8): [-Wuser]
+ Line 8