Fixed bug 556600 in which an unterminated macro error never included a file

name or line number.
This commit is contained in:
Ed Beroset 2002-05-17 03:10:13 +00:00
parent dd5e1fae73
commit 168c9c0c43

View file

@ -390,7 +390,7 @@ static MMacro *defining;
* gives our position in the macro set, when we're processing it. * gives our position in the macro set, when we're processing it.
*/ */
#include "macros.c" #include "macros.c"
static char **stdmacpos; static const char **stdmacpos;
/* /*
* The extra standard macros that come from the object format, if * The extra standard macros that come from the object format, if
@ -419,7 +419,7 @@ static Token *expand_smacro(Token * tline);
static Token *expand_id(Token * tline); static Token *expand_id(Token * tline);
static Context *get_ctx(char *name, int all_contexts); static Context *get_ctx(char *name, int all_contexts);
static void make_tok_num(Token * tok, long val); static void make_tok_num(Token * tok, long val);
static void error(int severity, char *fmt, ...); static void error(int severity, const char *fmt, ...);
static void *new_Block(size_t size); static void *new_Block(size_t size);
static void delete_Blocks(void); static void delete_Blocks(void);
static Token *new_Token(Token * next, int type, char *text, int txtlen); static Token *new_Token(Token * next, int type, char *text, int txtlen);
@ -4004,7 +4004,7 @@ expand_mmacro(Token * tline)
* per pass) we will want to show errors only during pass one. * per pass) we will want to show errors only during pass one.
*/ */
static void static void
error(int severity, char *fmt, ...) error(int severity, const char *fmt, ...)
{ {
va_list arg; va_list arg;
char buff[1024]; char buff[1024];
@ -4020,7 +4020,7 @@ error(int severity, char *fmt, ...)
if (istk && istk->mstk && istk->mstk->name) if (istk && istk->mstk && istk->mstk->name)
_error(severity | ERR_PASS1, "(%s:%d) %s", istk->mstk->name, _error(severity | ERR_PASS1, "(%s:%d) %s", istk->mstk->name,
istk->mstk->lineno, buff); istk->mstk->lineno, buff);
else else
_error(severity | ERR_PASS1, "%s", buff); _error(severity | ERR_PASS1, "%s", buff);
} }
@ -4196,10 +4196,14 @@ pp_getline(void)
fclose(i->fp); fclose(i->fp);
if (i->conds) if (i->conds)
error(ERR_FATAL, "expected `%%endif' before end of file"); error(ERR_FATAL, "expected `%%endif' before end of file");
/* only set line and file name if there's a next node */
if (i->next)
{
src_set_linnum(i->lineno);
nasm_free(src_set_fname(i->fname));
}
istk = i->next; istk = i->next;
list->downlevel(LIST_INCLUDE); list->downlevel(LIST_INCLUDE);
src_set_linnum(i->lineno);
nasm_free(src_set_fname(i->fname));
nasm_free(i); nasm_free(i);
if (!istk) if (!istk)
return NULL; return NULL;