mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Prohibit nested macros
After discussion (starting there: https://github.com/gbdev/rgbds/pull/594#issuecomment-706437458 ), it was decided that plain nested macros should not be allowed. Since #590 is fixed, EQUS can be used as a workaround; multiline strings (#589) will make that easier on the user when implemented. Fixes #588, supersedes and closes #594. Additionally, closes #388.
This commit is contained in:
27
test/asm/nested-macrodef.asm
Normal file
27
test/asm/nested-macrodef.asm
Normal file
@@ -0,0 +1,27 @@
|
||||
outer_ok: MACRO
|
||||
definition equs "inner_ok: MACRO\nPRINTT \"Hello!\\n\"\nENDM"
|
||||
definition
|
||||
PURGE definition
|
||||
ENDM
|
||||
|
||||
outer_ok
|
||||
inner_ok
|
||||
|
||||
|
||||
outer_arg: MACRO
|
||||
definition equs "inner_arg: MACRO\nPRINTT \"outer: \1\\ninner: \\1\\n\"\nENDM"
|
||||
definition
|
||||
PURGE definition
|
||||
ENDM
|
||||
|
||||
outer_arg outside
|
||||
inner_arg inside
|
||||
|
||||
|
||||
outer: MACRO
|
||||
WARN "Nested macros shouldn't work, whose argument would be \\1?"
|
||||
inner: MACRO
|
||||
ENDM
|
||||
|
||||
outer
|
||||
inner
|
||||
5
test/asm/nested-macrodef.err
Normal file
5
test/asm/nested-macrodef.err
Normal file
@@ -0,0 +1,5 @@
|
||||
warning: nested-macrodef.asm(26) -> nested-macrodef.asm::outer(22): [-Wuser]
|
||||
Nested macros shouldn't work, whose argument would be \1?
|
||||
ERROR: nested-macrodef.asm(26) -> nested-macrodef.asm::outer(25):
|
||||
Unterminated macro definition
|
||||
error: Assembly aborted (1 errors)!
|
||||
3
test/asm/nested-macrodef.out
Normal file
3
test/asm/nested-macrodef.out
Normal file
@@ -0,0 +1,3 @@
|
||||
Hello!
|
||||
outer: outside
|
||||
inner: inside
|
||||
Reference in New Issue
Block a user