fix(lint): exempt shift counts, SETcc and ABIInternal from false positives
Assisted-by: GLM 5.3 Flash
This commit is contained in:
@@ -82,6 +82,23 @@ func TestABIArgSizeSkipsRegisterABI(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestABI0ArgsSkipsABIInternal verifies the frame-read check does not fire for
|
||||
// a TEXT declared <ABIInternal>: runtime·memmove<ABIInternal> and friends read
|
||||
// their arguments from the register file by declaration, which is the correct
|
||||
// spelling there, not the register-args port bug the rule hunts.
|
||||
func TestABI0ArgsSkipsABIInternal(t *testing.T) {
|
||||
diags := lintSrc(t, "#include \"textflag.h\"\n"+
|
||||
"// func memmove(to, from unsafe.Pointer, n uintptr)\n"+
|
||||
"TEXT ·memmove<ABIInternal>(SB), NOSPLIT, $0-24\n"+
|
||||
"\tMOVQ AX, DI\n"+
|
||||
"\tMOVQ BX, SI\n"+
|
||||
"\tMOVQ CX, BX\n"+
|
||||
"\tRET\n")
|
||||
if codes(diags)[CodeABI0RegisterArgs] != 0 {
|
||||
t.Fatalf("ABIInternal TEXT must not be checked against the FP frame: %+v", diags)
|
||||
}
|
||||
}
|
||||
|
||||
// TestUnreachableCode exercises the dead-code detection and its guard rails.
|
||||
func TestUnreachableCode(t *testing.T) {
|
||||
// Code after a RET is unreachable.
|
||||
|
||||
Reference in New Issue
Block a user