When Parse_Error is called after the top-level Makefile is closed we

have no CURFILE anymore so we cannot print a file name or line number.

When ParseSkipLine() returns NULL (it does this when it has detected an
EOF in an .if block) try to pop the input stack and process the next line
This commit is contained in:
harti 2005-04-07 14:39:38 +00:00
parent 842b80c69a
commit 32fe258978

View File

@ -299,7 +299,9 @@ Parse_Error(int type, const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "\"%s\", line %d: ", CURFILE->fname, CURFILE->lineno);
if (CURFILE != NULL)
fprintf(stderr, "\"%s\", line %d: ",
CURFILE->fname, CURFILE->lineno);
if (type == PARSE_WARNING)
fprintf(stderr, "warning: ");
vfprintf(stderr, fmt, ap);
@ -2233,8 +2235,10 @@ ParseReadLine(void)
line = ParseSkipLine(1, 0);
} while (line &&
Cond_Eval(line, CURFILE->lineno) != COND_PARSE);
if (line == NULL)
break;
if (line == NULL) {
/* try to pop input stack */
goto again;
}
/*FALLTHRU*/
case COND_PARSE: