From 4f1a9c660108e5fb94d5b19ee649427b8aafd96b Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 2 Feb 2026 22:38:16 +0100 Subject: Add the .fallthrough control statement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is exclusive to 'nasm' and it allows the developer to explicitly tell the assembler than a "fall through" condition is actually desired: it's not a mistake. This comes in two flavors. The first, without arguments, just makes this explicit without much enforcement. The second allows you to pass an argument which is the name of the function or label you are expecting to fall through. The assembler will error out if the fall through address is not the expected one, hence telling the programmer whenever the fall through condition they thought in the past is no longer true (e.g. the function has moved somewhere else in the code). Signed-off-by: Miquel Sabaté Solà --- scripts/test-e2e.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'scripts') diff --git a/scripts/test-e2e.sh b/scripts/test-e2e.sh index 2f7ff5f..18dbeff 100755 --- a/scripts/test-e2e.sh +++ b/scripts/test-e2e.sh @@ -76,6 +76,18 @@ echo "test: custom => bad_jal.nes" diff tests/out/bad_jal.txt tests/expected/bad_jal.txt exit_code=$((exit_code + $?)) +echo "test: custom => bad_fallthrough.nes" +./target/debug/nasm -c empty --asan tests/bad_fallthrough.s -o /dev/null 2>tests/out/bad_fallthrough.txt +diff tests/out/bad_fallthrough.txt tests/expected/bad_fallthrough.txt +exit_code=$((exit_code + $?)) + +echo "test: custom => fallthrough.nes" +./target/debug/nasm -c empty --asan tests/fallthrough.s -o tests/out/fallthrough.nes 2>tests/out/fallthrough.txt +diff tests/out/fallthrough.txt tests/expected/fallthrough.txt +exit_code=$((exit_code + $?)) +diff tests/out/fallthrough.nes tests/expected/fallthrough.nes +exit_code=$((exit_code + $?)) + ## # code.nes -- cgit v1.2.3