summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2010-09-24 15:24:42 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2010-10-27 21:40:59 +0400
commit71787fda1b4c60201a9d83a14e325f30a99100a5 (patch)
tree5bc39a75ed268a928f71f03de4a5322f865659a5
parentdb6975919c0c037ef3115bbe5c8bfe386c96f831 (diff)
downloadnasm-71787fda1b4c60201a9d83a14e325f30a99100a5.tar.gz
BR3074517: Print %macro name inside %rep blocks
If we're to print inside %rep block we should find out which %macro it belongs. Reported-by: Rob Neff Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--preproc.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/preproc.c b/preproc.c
index 1a1905a4..19de89e9 100644
--- a/preproc.c
+++ b/preproc.c
@@ -4746,12 +4746,22 @@ static int expand_mmacro(Token * tline)
static void verror(int severity, const char *fmt, va_list arg)
{
char buff[1024];
+ MMacro *mmac = NULL;
+ int delta = 0;
vsnprintf(buff, sizeof(buff), fmt, arg);
- if (istk && istk->mstk && istk->mstk->name)
- nasm_error(severity, "(%s:%d) %s", istk->mstk->name,
- istk->mstk->lineno, buff);
+ /* get %macro name */
+ if (istk && istk->mstk) {
+ mmac = istk->mstk;
+ /* but %rep blocks should be skipped */
+ while (mmac && !mmac->name)
+ mmac = mmac->next_active, delta++;
+ }
+
+ if (mmac)
+ nasm_error(severity, "(%s:%d) %s",
+ mmac->name, mmac->lineno - delta, buff);
else
nasm_error(severity, "%s", buff);
}