shithub: rgbds

Download patch

ref: 12d82eb768e4336ad413d68fb049ecde20acda4c
parent: 05becf3f4b01db29fb043eead4656867aa167dc6
author: Eldred Habert <[email protected]>
date: Thu Aug 29 22:14:21 EDT 2019

Remove extra entry in error stack on macro not defined (#394)

While working on #392, I noticed that the macro-@ test (as well
as the line-continuation test, but for that one see #393)
printed an additional '@(-1)' entry which doesn't make sense.

--- a/src/asm/fstack.c
+++ b/src/asm/fstack.c
@@ -318,7 +318,7 @@
 {
 	struct sSymbol *sym = sym_FindMacro(s);
 
-	if (sym == NULL)
+	if (sym == NULL || sym->pMacro == NULL)
 		return 0;
 
 	pushcontext();
@@ -327,9 +327,6 @@
 	sym_UseNewMacroArgs();
 	nCurrentStatus = STAT_isMacro;
 	strcpy(tzCurrentFileName, s);
-
-	if (sym->pMacro == NULL)
-		return 0;
 
 	pCurrentMacro = sym;
 	CurrentFlexHandle = yy_scan_bytes(pCurrentMacro->pMacro,
--- a/test/asm/[email protected]
+++ b/test/asm/[email protected]
@@ -1,2 +1,2 @@
-ERROR: [email protected](1) -> @(-1):
+ERROR: [email protected](1):
     Macro '@' not defined
--- a/test/asm/[email protected]
+++ b/test/asm/[email protected]
@@ -1,2 +1,2 @@
-ERROR: -(1) -> @(-1):
+ERROR: -(1):
     Macro '@' not defined