mirror of
https://github.com/cc65/cc65.git
synced 2026-01-22 17:16:21 +00:00
Allow "sp" as an alias for "c_sp" for backwards compatibility. Using it will
work but generates a linker warning. Added a test to check for this warning.
This commit is contained in:
@@ -13,6 +13,12 @@
|
||||
.globalzp tmp1, tmp2, tmp3, tmp4
|
||||
.globalzp regbank
|
||||
|
||||
; The following symbol is supplied for compatibility reasons only, it
|
||||
; will get removed in future versions. Using it will cause a linker
|
||||
; warning.
|
||||
.globalzp sp
|
||||
|
||||
|
||||
; The size of the register bank
|
||||
regbanksize = 6
|
||||
|
||||
|
||||
11
libsrc/runtime/sp-compat.s
Normal file
11
libsrc/runtime/sp-compat.s
Normal file
@@ -0,0 +1,11 @@
|
||||
;
|
||||
; Kugelfuhr, 2025-06-26
|
||||
;
|
||||
; Add "sp" as an alias for "c_sp" so we don't break old code but emit a
|
||||
; linker warning if it is used. Added after renaming "sp" to "c_sp".
|
||||
;
|
||||
|
||||
.include "zeropage.inc"
|
||||
.export sp := c_sp
|
||||
.assert 0, ldwarning, "Symbol 'sp' is deprecated - please use 'c_sp' instead"
|
||||
|
||||
1
test/asm/listing/ref/sp-compat.ld65err2-ref
Normal file
1
test/asm/listing/ref/sp-compat.ld65err2-ref
Normal file
@@ -0,0 +1 @@
|
||||
ld65: Warning: runtime/sp-compat.s:10: Symbol 'sp' is deprecated - please use 'c_sp' instead
|
||||
7
test/asm/listing/sp-compat.s
Normal file
7
test/asm/listing/sp-compat.s
Normal file
@@ -0,0 +1,7 @@
|
||||
.include "zeropage.inc"
|
||||
|
||||
.proc _func
|
||||
ldy #0
|
||||
lda (sp),y
|
||||
rts
|
||||
.endproc
|
||||
Reference in New Issue
Block a user