From 12d82eb768e4336ad413d68fb049ecde20acda4c Mon Sep 17 00:00:00 2001 From: Eldred Habert Date: Fri, 30 Aug 2019 02:14:21 +0200 Subject: [PATCH] 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. --- src/asm/fstack.c | 5 +---- test/asm/macro-@.out | 2 +- test/asm/macro-@.out.pipe | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/asm/fstack.c b/src/asm/fstack.c index 3035ab7c..3a84877e 100644 --- a/src/asm/fstack.c +++ b/src/asm/fstack.c @@ -318,7 +318,7 @@ uint32_t fstk_RunMacro(char *s) { struct sSymbol *sym = sym_FindMacro(s); - if (sym == NULL) + if (sym == NULL || sym->pMacro == NULL) return 0; pushcontext(); @@ -328,9 +328,6 @@ uint32_t fstk_RunMacro(char *s) nCurrentStatus = STAT_isMacro; strcpy(tzCurrentFileName, s); - if (sym->pMacro == NULL) - return 0; - pCurrentMacro = sym; CurrentFlexHandle = yy_scan_bytes(pCurrentMacro->pMacro, strlen(pCurrentMacro->pMacro)); diff --git a/test/asm/macro-@.out b/test/asm/macro-@.out index 0b399407..d31f4c95 100644 --- a/test/asm/macro-@.out +++ b/test/asm/macro-@.out @@ -1,2 +1,2 @@ -ERROR: macro-@.asm(1) -> @(-1): +ERROR: macro-@.asm(1): Macro '@' not defined diff --git a/test/asm/macro-@.out.pipe b/test/asm/macro-@.out.pipe index 725c38be..8e0a1a2e 100644 --- a/test/asm/macro-@.out.pipe +++ b/test/asm/macro-@.out.pipe @@ -1,2 +1,2 @@ -ERROR: -(1) -> @(-1): +ERROR: -(1): Macro '@' not defined