mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
* Implement -Wtruncation=level -Wtruncation=0 is the same as the current -Wno-truncation. -Wtruncation=2 is the same as the current -Wtruncation. -Wtruncation=1 is the new default; it's less strict, allowing N-bit values to be between -2**N and 2**N (exclusive). * Implement generic "parametrized warning" system * Test more `Wtruncation` variants Co-authored-by: ISSOtm <eldredhabert0@gmail.com>
39 lines
510 B
NASM
39 lines
510 B
NASM
FOO_F EQU 5
|
|
BAR_F EQU 7
|
|
|
|
|
|
SECTION "RAM", WRAMX[$d500]
|
|
|
|
wLabel::
|
|
|
|
|
|
SECTION "ROM", ROM0
|
|
|
|
MACRO try
|
|
OPT \1
|
|
; no warning
|
|
db 1 << FOO_F
|
|
db $ff ^ (1 << FOO_F)
|
|
db ~(1 << FOO_F)
|
|
db 1 << BAR_F
|
|
db $ff ^ (1 << BAR_F)
|
|
dw wLabel
|
|
dw $10000 - wLabel
|
|
; warn at level 1
|
|
db 1 << 8
|
|
db ~(1 << 8)
|
|
dw $1d200
|
|
dw -$1d200
|
|
; warn at level 2
|
|
db ~(1 << BAR_F)
|
|
dw -wLabel
|
|
ENDM
|
|
|
|
try Wno-truncation
|
|
try Wtruncation
|
|
try Wtruncation=0
|
|
try Wtruncation=1
|
|
try Wtruncation=2
|
|
try Werror=truncation=1
|
|
try Werror=truncation=2
|