From 85a68dbdcd0200a711bacda9c7170129350813c8 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Fri, 5 Jun 2026 23:32:39 +0200 Subject: Refer to the original file for unused objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When warning users on unused objects (e.g. variables, proc's), we have to pick up the source of origin for this warning. In places where the original PNode is not available, then we go with the last source we have at hand, as that's the usual way to go (i.e. the error occurred at the current source/context). That being said, for unused objects that's not desirable, because we might otherwise claim the error to happen on the file we first targetted, but it's way more useful to understand where the object was defined. Hence, when defining a variable, address or proc, let's actually store the PNode associated with it as well. This way the checker can hopefully get the source from this PNode and be more clear to the user. Signed-off-by: Miquel Sabaté Solà --- scripts/test-e2e.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scripts') diff --git a/scripts/test-e2e.sh b/scripts/test-e2e.sh index ae06e72..524c75e 100755 --- a/scripts/test-e2e.sh +++ b/scripts/test-e2e.sh @@ -114,6 +114,11 @@ exit_code=$((exit_code + $?)) diff tests/out/delayed_macro_arguments.nes tests/expected/delayed_macro_arguments.nes exit_code=$((exit_code + $?)) +echo "test: custom => unused_definition.nes" +./target/debug/nasm -c empty -Werror --asan tests/unused_definition.s -o /dev/null 2>tests/out/unused_definition.txt +diff tests/out/unused_definition.txt tests/expected/unused_definition.txt +exit_code=$((exit_code + $?)) + ## # code.nes -- cgit v1.2.3