summaryrefslogtreecommitdiff
path: root/preproc.c
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2010-09-24 15:24:42 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2010-09-24 15:24:42 +0400
commit4a35008733ca585f6606ba5e75e925ef47dfbd23 (patch)
treeed3a9e95b0a72a58df312ac9d51eb244768ab4c7 /preproc.c
parent0e7370cfa64b9cfe81d4ce9a5f0a07203836f9c7 (diff)
downloadnasm-4a35008733ca585f6606ba5e75e925ef47dfbd23.tar.gz
nasm-4a35008733ca585f6606ba5e75e925ef47dfbd23.tar.bz2
nasm-4a35008733ca585f6606ba5e75e925ef47dfbd23.zip
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>
Diffstat (limited to 'preproc.c')
-rw-r--r--preproc.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/preproc.c b/preproc.c
index f9a2f85..f21445b 100644
--- a/preproc.c
+++ b/preproc.c
@@ -4745,12 +4745,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);
}