summaryrefslogtreecommitdiff
path: root/preproc.c
diff options
context:
space:
mode:
authorEd Beroset <beroset@mindspring.com>2002-05-17 03:10:13 +0000
committerEd Beroset <beroset@mindspring.com>2002-05-17 03:10:13 +0000
commit168c9c0c43f9128519bd45afbbf84a363b89832d (patch)
tree523ad860344dbccc3a5465f8d6a21b9d9d82de54 /preproc.c
parentdd5e1fae734e0a44fd41b2f34c76b873285d944d (diff)
downloadnasm-168c9c0c43f9128519bd45afbbf84a363b89832d.tar.gz
nasm-168c9c0c43f9128519bd45afbbf84a363b89832d.tar.bz2
nasm-168c9c0c43f9128519bd45afbbf84a363b89832d.zip
Fixed bug 556600 in which an unterminated macro error never included a file
name or line number.
Diffstat (limited to 'preproc.c')
-rw-r--r--preproc.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/preproc.c b/preproc.c
index 6de1ffb..bdcf1db 100644
--- a/preproc.c
+++ b/preproc.c
@@ -390,7 +390,7 @@ static MMacro *defining;
* gives our position in the macro set, when we're processing it.
*/
#include "macros.c"
-static char **stdmacpos;
+static const char **stdmacpos;
/*
* 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 Context *get_ctx(char *name, int all_contexts);
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 delete_Blocks(void);
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.
*/
static void
-error(int severity, char *fmt, ...)
+error(int severity, const char *fmt, ...)
{
va_list arg;
char buff[1024];
@@ -4020,7 +4020,7 @@ error(int severity, char *fmt, ...)
if (istk && istk->mstk && istk->mstk->name)
_error(severity | ERR_PASS1, "(%s:%d) %s", istk->mstk->name,
istk->mstk->lineno, buff);
- else
+ else
_error(severity | ERR_PASS1, "%s", buff);
}
@@ -4196,10 +4196,14 @@ pp_getline(void)
fclose(i->fp);
if (i->conds)
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;
list->downlevel(LIST_INCLUDE);
- src_set_linnum(i->lineno);
- nasm_free(src_set_fname(i->fname));
nasm_free(i);
if (!istk)
return NULL;