From e71a73d0875c416507a3207bdec6fee145a79f68 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 6 Oct 2026 17:33:16 +0200 Subject: Don't error out on conditional .include MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The hard requirement that an .include statement cannot be inside of another block was, in the end, a bit short-sighted. Imagine the following block: .ifdef DEBUG .include "debug.s" .endif This is perfectly sound-looking code, and it should not be punished as the developer is doing something that is not bending the assembler in weird ways. Hence, just nuke this check. Signed-off-by: Miquel Sabaté Solà --- tests/code_to_include.s | 5 +++++ tests/conditionally_include.s | 16 ++++++++++++++++ tests/expected/conditionally_include.nes | Bin 0 -> 17 bytes tests/expected/conditionally_include.txt | 0 tests/expected/conditionally_include_debug.nes | Bin 0 -> 20 bytes tests/expected/conditionally_include_debug.txt | 0 6 files changed, 21 insertions(+) create mode 100644 tests/code_to_include.s create mode 100644 tests/conditionally_include.s create mode 100644 tests/expected/conditionally_include.nes create mode 100644 tests/expected/conditionally_include.txt create mode 100644 tests/expected/conditionally_include_debug.nes create mode 100644 tests/expected/conditionally_include_debug.txt (limited to 'tests') diff --git a/tests/code_to_include.s b/tests/code_to_include.s new file mode 100644 index 0000000..4f315dc --- /dev/null +++ b/tests/code_to_include.s @@ -0,0 +1,5 @@ +.segment "CODE" + +.proc foo + rts +.endproc diff --git a/tests/conditionally_include.s b/tests/conditionally_include.s new file mode 100644 index 0000000..67ef7d2 --- /dev/null +++ b/tests/conditionally_include.s @@ -0,0 +1,16 @@ +.segment "HEADER" + .byte 'N', 'E', 'S', $1A + .byte $02, $01 + .byte $00 + .byte $00 + +.segment "CODE" + +;;; asan:stack full + +.ifdef DEBUG + .include "code_to_include.s" + jsr foo +.else + nop +.endif diff --git a/tests/expected/conditionally_include.nes b/tests/expected/conditionally_include.nes new file mode 100644 index 0000000..a76a79b Binary files /dev/null and b/tests/expected/conditionally_include.nes differ diff --git a/tests/expected/conditionally_include.txt b/tests/expected/conditionally_include.txt new file mode 100644 index 0000000..e69de29 diff --git a/tests/expected/conditionally_include_debug.nes b/tests/expected/conditionally_include_debug.nes new file mode 100644 index 0000000..d7b8ac5 Binary files /dev/null and b/tests/expected/conditionally_include_debug.nes differ diff --git a/tests/expected/conditionally_include_debug.txt b/tests/expected/conditionally_include_debug.txt new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3