-Wmacro-shift warns about shifting macro arguments too far (#741)

Fixes #735
This commit is contained in:
Rangi
2021-02-16 13:31:01 -08:00
committed by GitHub
parent 122ba6eba5
commit cb61da8842
9 changed files with 40 additions and 10 deletions

View File

@@ -0,0 +1,2 @@
warning: narg-decreases-after-shift.asm(14) -> narg-decreases-after-shift.asm::testing(9): [-Wmacro-shift]
Cannot shift macro arguments past their end

View File

@@ -8,9 +8,7 @@ m: macro
; Shifting a little more to check that over-shifting doesn't crash
SHIFT
SHIFT
REPT 256
SHIFT
ENDR
SHIFT 256
PRINTLN "\1"
endm

View File

@@ -1,2 +1,6 @@
FATAL: rept-shift.asm(17) -> rept-shift.asm::m(14):
warning: rept-shift.asm(15) -> rept-shift.asm::m(10): [-Wmacro-shift]
Cannot shift macro arguments past their end
warning: rept-shift.asm(15) -> rept-shift.asm::m(11): [-Wmacro-shift]
Cannot shift macro arguments past their end
FATAL: rept-shift.asm(15) -> rept-shift.asm::m(12):
Macro argument '\1' not defined

View File

@@ -12,5 +12,9 @@ ENDM
m: MACRO
shift 2
shift -3
shift 1
shift 1
shift -1
shift -1
ENDM
m
m one

View File

@@ -0,0 +1,8 @@
warning: shift-negative.asm(20) -> shift-negative.asm::m(13): [-Wmacro-shift]
Cannot shift macro arguments past their end
warning: shift-negative.asm(20) -> shift-negative.asm::m(14): [-Wmacro-shift]
Cannot shift macro arguments past their beginning
warning: shift-negative.asm(20) -> shift-negative.asm::m(16): [-Wmacro-shift]
Cannot shift macro arguments past their end
warning: shift-negative.asm(20) -> shift-negative.asm::m(18): [-Wmacro-shift]
Cannot shift macro arguments past their beginning