Add SplitLint, and let it be told when something is deliberate
SplitLint reports valid assembly that has a shorter direct expression: zero loads that could be RSTA or RSTB, Q moved through the stack where MVQA would do, self-cancelling push and pop pairs, assignments overwritten before use, unreachable fallthrough, one-byte pointer moves that could be INCD or DECD, a branch to the label directly below it, a SETD reloading an address the pointer already holds, and branches whose carry is known. Its model is deliberately local and conservative: every label and every directive forgets all known state, so a claim only ever lives inside a straight-line region. It knows the calling convention - CALL forgets DP3 and keeps the rest, RCAL and SWI forget everything - and it shares assembly.o with the assembler, so an added opcode cannot leave it holding a private copy of the instruction table. 260 warnings across the corpus, of which three were wrong in the way that matters: branchTest.asm and interruptFlagTest.asm exist to check that a branch whose carry is known behaves correctly, so a diagnostic saying the outcome is known is exactly right and exactly unwanted. A line whose comment says "splitlint: <reason>" is now not reported on. THE REASON IS REQUIRED and a bare marker is refused, because a suppression nobody explained outlives whatever made it necessary. Suppressed warnings are not counted, so --fatal-warnings does not fail on one, and the number of them is printed at the end so the claim is visible rather than silent. Tests/lint.sh checked a TOTAL: twenty three warnings expected, twenty three found. That number stays right while the thing behind it goes wrong - a rule that stopped firing while another fired twice would pass, and so would a rule reporting at the wrong line. It now checks which warning came out and at which line, that nothing else came out, and that the four lines meant to stay quiet did. Confirmed by breaking one rule's message and watching it name that rule: the old assertion passed the same sabotage, because the warning still fired and the count never moved. Written with the user while I was away; my part is the suppression mechanism, the harness rewrite, and the three marks in the test programs.
This commit is contained in:
@@ -46,7 +46,7 @@ bTaken:
|
||||
OUTA 0x00
|
||||
|
||||
CCF
|
||||
BNC cTaken
|
||||
BNC cTaken ; splitlint: this test exists to check a branch whose carry is known
|
||||
BRI wrong
|
||||
cTaken:
|
||||
CALL blankSpace
|
||||
@@ -78,7 +78,7 @@ cTaken:
|
||||
INIB 0x01
|
||||
CCF
|
||||
ADD
|
||||
BNC wrong
|
||||
BNC wrong ; splitlint: the point is that a set carry does NOT take this
|
||||
CALL blankSpace
|
||||
INIA 0d99 ; 'c'
|
||||
OUTA 0x00
|
||||
|
||||
Reference in New Issue
Block a user