mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-07-24 10:25:42 -04:00
Fix early report_error(); avoid nuisance phase warnings
Fix report_error() to (hopefully) not fault if used without ERR_NOFILE if no filename is available. Avoid nuisance phase error between passes warnings if we have detected other errors. In those case, the phase error is almost certainly spurious. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
d3544ff534
commit
48ef41957a
29
nasm.c
29
nasm.c
@ -1733,7 +1733,7 @@ static void assemble_file(char *fname, StrList **depend_ptr)
|
|||||||
location.offset = offs = GET_CURR_OFFS;
|
location.offset = offs = GET_CURR_OFFS;
|
||||||
} /* end while (line = preproc->getline... */
|
} /* end while (line = preproc->getline... */
|
||||||
|
|
||||||
if (pass0 && global_offset_changed)
|
if (pass0 == 2 && global_offset_changed && !terminate_after_phase)
|
||||||
report_error(ERR_NONFATAL,
|
report_error(ERR_NONFATAL,
|
||||||
"phase error detected at end of assembly.");
|
"phase error detected at end of assembly.");
|
||||||
|
|
||||||
@ -1762,7 +1762,6 @@ static void assemble_file(char *fname, StrList **depend_ptr)
|
|||||||
"after %d passes, giving up.", passn);
|
"after %d passes, giving up.", passn);
|
||||||
report_error(ERR_NONFATAL,
|
report_error(ERR_NONFATAL,
|
||||||
"Possible causes: recursive EQUs, macro abuse.");
|
"Possible causes: recursive EQUs, macro abuse.");
|
||||||
terminate_after_phase = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1841,19 +1840,22 @@ static enum directives getkw(char **directive, char **value)
|
|||||||
static void report_error_gnu(int severity, const char *fmt, ...)
|
static void report_error_gnu(int severity, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
char *currentfile = NULL;
|
||||||
|
int32_t lineno = 0;
|
||||||
|
|
||||||
if (is_suppressed_warning(severity))
|
if (is_suppressed_warning(severity))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (severity & ERR_NOFILE)
|
if (!(severity & ERR_NOFILE))
|
||||||
fputs("nasm: ", error_file);
|
|
||||||
else {
|
|
||||||
char *currentfile = NULL;
|
|
||||||
int32_t lineno = 0;
|
|
||||||
src_get(&lineno, ¤tfile);
|
src_get(&lineno, ¤tfile);
|
||||||
|
|
||||||
|
if (currentfile) {
|
||||||
fprintf(error_file, "%s:%"PRId32": ", currentfile, lineno);
|
fprintf(error_file, "%s:%"PRId32": ", currentfile, lineno);
|
||||||
nasm_free(currentfile);
|
nasm_free(currentfile);
|
||||||
|
} else {
|
||||||
|
fputs("nasm: ", error_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
report_error_common(severity, fmt, ap);
|
report_error_common(severity, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
@ -1877,19 +1879,22 @@ static void report_error_gnu(int severity, const char *fmt, ...)
|
|||||||
static void report_error_vc(int severity, const char *fmt, ...)
|
static void report_error_vc(int severity, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
char *currentfile = NULL;
|
||||||
|
int32_t lineno = 0;
|
||||||
|
|
||||||
if (is_suppressed_warning(severity))
|
if (is_suppressed_warning(severity))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (severity & ERR_NOFILE)
|
if (!(severity & ERR_NOFILE))
|
||||||
fputs("nasm: ", error_file);
|
|
||||||
else {
|
|
||||||
char *currentfile = NULL;
|
|
||||||
int32_t lineno = 0;
|
|
||||||
src_get(&lineno, ¤tfile);
|
src_get(&lineno, ¤tfile);
|
||||||
|
|
||||||
|
if (currentfile) {
|
||||||
fprintf(error_file, "%s(%"PRId32") : ", currentfile, lineno);
|
fprintf(error_file, "%s(%"PRId32") : ", currentfile, lineno);
|
||||||
nasm_free(currentfile);
|
nasm_free(currentfile);
|
||||||
|
} else {
|
||||||
|
fputs("nasm: ", error_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
report_error_common(severity, fmt, ap);
|
report_error_common(severity, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user