summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-07-01 22:12:59 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-07-01 22:12:59 -0700
commit48ef41957ad199eff524ed8d39b4fe27d844e80c (patch)
treeda3ed4433e59f50e61c2125d36934ea5b14d37d5
parentd3544ff534be7dcdf92e40d03d9601d816016420 (diff)
downloadnasm-48ef41957ad199eff524ed8d39b4fe27d844e80c.tar.gz
nasm-48ef41957ad199eff524ed8d39b4fe27d844e80c.tar.bz2
nasm-48ef41957ad199eff524ed8d39b4fe27d844e80c.zip
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>
-rw-r--r--nasm.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/nasm.c b/nasm.c
index 3def14e..4759577 100644
--- a/nasm.c
+++ b/nasm.c
@@ -1733,7 +1733,7 @@ static void assemble_file(char *fname, StrList **depend_ptr)
location.offset = offs = GET_CURR_OFFS;
} /* end while (line = preproc->getline... */
- if (pass0 && global_offset_changed)
+ if (pass0 == 2 && global_offset_changed && !terminate_after_phase)
report_error(ERR_NONFATAL,
"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);
report_error(ERR_NONFATAL,
"Possible causes: recursive EQUs, macro abuse.");
- terminate_after_phase = true;
break;
}
}
@@ -1841,19 +1840,22 @@ static enum directives getkw(char **directive, char **value)
static void report_error_gnu(int severity, const char *fmt, ...)
{
va_list ap;
+ char *currentfile = NULL;
+ int32_t lineno = 0;
if (is_suppressed_warning(severity))
return;
- if (severity & ERR_NOFILE)
- fputs("nasm: ", error_file);
- else {
- char *currentfile = NULL;
- int32_t lineno = 0;
+ if (!(severity & ERR_NOFILE))
src_get(&lineno, &currentfile);
- fprintf(error_file, "%s:%"PRId32": ", currentfile, lineno);
- nasm_free(currentfile);
+
+ if (currentfile) {
+ fprintf(error_file, "%s:%"PRId32": ", currentfile, lineno);
+ nasm_free(currentfile);
+ } else {
+ fputs("nasm: ", error_file);
}
+
va_start(ap, fmt);
report_error_common(severity, fmt, 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, ...)
{
va_list ap;
+ char *currentfile = NULL;
+ int32_t lineno = 0;
if (is_suppressed_warning(severity))
return;
- if (severity & ERR_NOFILE)
- fputs("nasm: ", error_file);
- else {
- char *currentfile = NULL;
- int32_t lineno = 0;
+ if (!(severity & ERR_NOFILE))
src_get(&lineno, &currentfile);
+
+ if (currentfile) {
fprintf(error_file, "%s(%"PRId32") : ", currentfile, lineno);
nasm_free(currentfile);
+ } else {
+ fputs("nasm: ", error_file);
}
+
va_start(ap, fmt);
report_error_common(severity, fmt, ap);
va_end(ap);