We were crashing because we didn't generate this error until the preproc
module was getting cleaned up, which doesn't happen until after linemap
is cleaned up. Instead detect and output this error when we reach the end
of preprocessed tokens during the parsing stage.
svn path=/trunk/yasm/; revision=2185
{
int h;
- if (defining)
+ if (pass_ == 1)
{
- error(ERR_NONFATAL, "end of file while still defining macro `%s'",
- defining->name);
- free_mmacro(defining);
+ if (defining)
+ {
+ error(ERR_NONFATAL, "end of file while still defining macro `%s'",
+ defining->name);
+ free_mmacro(defining);
+ }
+ return;
}
while (cstk)
ctx_pop();
line = nasmpp.getline();
if (!line)
+ {
+ nasmpp.cleanup(1);
return NULL; /* EOF */
+ }
linnum = preproc_nasm->prior_linnum += preproc_nasm->lineinc;
altline = nasm_src_get(&linnum, &preproc_nasm->file_name);
EXTRA_DIST += modules/preprocs/nasm/tests/ifcritical-err.errwarn
EXTRA_DIST += modules/preprocs/nasm/tests/longline.asm
EXTRA_DIST += modules/preprocs/nasm/tests/longline.hex
+EXTRA_DIST += modules/preprocs/nasm/tests/macroeof-err.asm
+EXTRA_DIST += modules/preprocs/nasm/tests/macroeof-err.errwarn
EXTRA_DIST += modules/preprocs/nasm/tests/noinclude-err.asm
EXTRA_DIST += modules/preprocs/nasm/tests/noinclude-err.errwarn
EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-bigint.asm
--- /dev/null
+%macro foo 0
--- /dev/null
+-:1: error: end of file while still defining macro `foo'