shithub: rgbds

Download patch

ref: 17b9838c8fdf8f74edf741ac05a45affe0332089
parent: 2e6f5ac679b6fec430023a1527fb4d4f9a8bfc82
parent: 889dd83798f108d1d26bba84b6412b36a03e87b8
author: Eldred Habert <[email protected]>
date: Mon Sep 9 15:37:44 EDT 2019

Merge pull request #418 from dbrotz/fix-symbol-macro-arg-0

Print useful error message when '\0' is used in a symbol name

--- a/src/asm/globlex.c
+++ b/src/asm/globlex.c
@@ -198,10 +198,10 @@
 
 	if (whichArg == '@')
 		marg = sym_FindMacroArg(-1);
-	else if (whichArg >= '0' && whichArg <= '9')
+	else if (whichArg >= '1' && whichArg <= '9')
 		marg = sym_FindMacroArg(whichArg - '0');
 	else
-		fatalerror("Malformed ID");
+		fatalerror("Invalid macro argument '\\%c' in symbol", whichArg);
 
 	if (!marg)
 		fatalerror("Macro argument '\\%c' not defined", whichArg);
--- /dev/null
+++ b/test/asm/symbol-invalid-macro-arg.asm
@@ -1,0 +1,1 @@
+x\0
--- /dev/null
+++ b/test/asm/symbol-invalid-macro-arg.out
@@ -1,0 +1,2 @@
+ERROR: symbol-invalid-macro-arg.asm(1):
+    Invalid macro argument '\0' in symbol