summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}