From 4a35008733ca585f6606ba5e75e925ef47dfbd23 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Fri, 24 Sep 2010 15:24:42 +0400 Subject: [PATCH] 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 --- preproc.c | 16 +++++++++++++--- 1 file 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); } -- 2.34.1