mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Disable EQUS expansion for raw symbols (by parsing them as strings) (#1648)
This commit is contained in:
29
test/asm/raw-string-symbol-errors.asm
Normal file
29
test/asm/raw-string-symbol-errors.asm
Normal file
@@ -0,0 +1,29 @@
|
||||
def n equ 42
|
||||
def s equs "hello"
|
||||
macro m
|
||||
endm
|
||||
|
||||
assert (#n) == 42
|
||||
assert (#s) == $656c6c6f
|
||||
assert (#m) == 0
|
||||
assert (#u) == 0
|
||||
|
||||
assert strlen(#n) == 0
|
||||
assert strlen(#s) == 5
|
||||
assert strlen(#m) == 0
|
||||
assert strlen(#u) == 0
|
||||
|
||||
def d_n = (#n)
|
||||
def d_s = (#s)
|
||||
def d_m = (#m)
|
||||
def d_u = (#u)
|
||||
|
||||
def s_n equs #n
|
||||
def s_s equs #s
|
||||
def s_m equs #m
|
||||
def s_u equs #u
|
||||
|
||||
purge #s
|
||||
purge #s
|
||||
assert (#s) == 0
|
||||
assert strlen(#s) == 0
|
||||
27
test/asm/raw-string-symbol-errors.err
Normal file
27
test/asm/raw-string-symbol-errors.err
Normal file
@@ -0,0 +1,27 @@
|
||||
warning: raw-string-symbol-errors.asm(7): [-Wobsolete]
|
||||
Treating multi-unit strings as numbers is deprecated
|
||||
error: raw-string-symbol-errors.asm(8):
|
||||
'm' is not a numeric symbol
|
||||
error: raw-string-symbol-errors.asm(11):
|
||||
'n' is not a string symbol
|
||||
error: raw-string-symbol-errors.asm(13):
|
||||
'm' is not a string symbol
|
||||
error: raw-string-symbol-errors.asm(14):
|
||||
'u' is not a string symbol
|
||||
warning: raw-string-symbol-errors.asm(17): [-Wobsolete]
|
||||
Treating multi-unit strings as numbers is deprecated
|
||||
error: raw-string-symbol-errors.asm(18):
|
||||
'm' is not a numeric symbol
|
||||
error: raw-string-symbol-errors.asm(19):
|
||||
Expected constant expression: 'u' is not constant at assembly time
|
||||
error: raw-string-symbol-errors.asm(21):
|
||||
'n' is not a string symbol
|
||||
error: raw-string-symbol-errors.asm(23):
|
||||
'm' is not a string symbol
|
||||
error: raw-string-symbol-errors.asm(24):
|
||||
'u' is not a string symbol
|
||||
error: raw-string-symbol-errors.asm(27):
|
||||
's' was already purged
|
||||
error: raw-string-symbol-errors.asm(29):
|
||||
's' is not a string symbol
|
||||
error: Assembly aborted (11 errors)!
|
||||
34
test/asm/raw-string-symbols.asm
Normal file
34
test/asm/raw-string-symbols.asm
Normal file
@@ -0,0 +1,34 @@
|
||||
opt Wno-unmapped-char
|
||||
|
||||
def hello equs "world"
|
||||
def name equs "hello"
|
||||
println "{name}"
|
||||
println #name
|
||||
assert !strcmp(strsub(#name, 1, 4), "hell")
|
||||
assert strlen(#hello) == charlen(#hello)
|
||||
assert strlen("{hello}") == 5
|
||||
|
||||
def multi equs """the quick
|
||||
brown fox"""
|
||||
println #multi
|
||||
|
||||
def char equs "A"
|
||||
def n = #char
|
||||
println n
|
||||
def n = (#char)
|
||||
println n
|
||||
def n = 1 + #char
|
||||
println n
|
||||
assert #char == $41
|
||||
|
||||
def fmt equs "%s %s %d"
|
||||
println strfmt(#fmt, #name, #hello, (#char))
|
||||
|
||||
purge #name
|
||||
assert !def(name) && !def(#name) && def(hello)
|
||||
|
||||
section "test", rom0
|
||||
#label:
|
||||
db #hello
|
||||
dw #hello
|
||||
dw BANK(#label), #label
|
||||
8
test/asm/raw-string-symbols.out
Normal file
8
test/asm/raw-string-symbols.out
Normal file
@@ -0,0 +1,8 @@
|
||||
hello
|
||||
hello
|
||||
the quick
|
||||
brown fox
|
||||
$41
|
||||
$41
|
||||
$42
|
||||
hello world 65
|
||||
BIN
test/asm/raw-string-symbols.out.bin
Normal file
BIN
test/asm/raw-string-symbols.out.bin
Normal file
Binary file not shown.
Reference in New Issue
Block a user