diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-07-07 12:04:12 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-07-07 12:04:12 -0700 |
commit | a23aa4a3e931b0333336406d6b2b30b96c24507d (patch) | |
tree | e5e2a94eb9077a54e97c0fdd04c68080f6205b46 /nasm.c | |
parent | 5bc87609d214255d4ecdf3285d1b26e7df7dbc56 (diff) | |
download | nasm-a23aa4a3e931b0333336406d6b2b30b96c24507d.tar.gz nasm-a23aa4a3e931b0333336406d6b2b30b96c24507d.tar.bz2 nasm-a23aa4a3e931b0333336406d6b2b30b96c24507d.zip |
listing: preserve list file on error, include errors
Instead of removing the list file on error, keep the list file and
include the errors in the list file. This makes it actually possible
to debug things that involve deep macro recursion, where the line
number is pretty much meaningless.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'nasm.c')
-rw-r--r-- | nasm.c | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -474,8 +474,6 @@ int main(int argc, char **argv) fclose (ofile); remove(outname); - if (listname[0]) - remove(listname); } } break; @@ -1922,28 +1920,36 @@ static bool is_suppressed_warning(int severity) static void report_error_common(int severity, const char *fmt, va_list args) { + char msg[1024]; + const char *pfx; + switch (severity & (ERR_MASK|ERR_NO_SEVERITY)) { case ERR_WARNING: - fputs("warning: ", error_file); + pfx = "warning: "; break; case ERR_NONFATAL: - fputs("error: ", error_file); + pfx = "error: "; break; case ERR_FATAL: - fputs("fatal: ", error_file); + pfx = "fatal: "; break; case ERR_PANIC: - fputs("panic: ", error_file); + pfx = "panic: "; break; case ERR_DEBUG: - fputs("debug: ", error_file); + pfx = "debug: "; break; default: + pfx = ""; break; } - vfprintf(error_file, fmt, args); - putc('\n', error_file); + vsnprintf(msg, sizeof msg, fmt, args); + + fprintf(error_file, "%s%s\n", pfx, msg); + + if (*listname) + nasmlist.error(severity, pfx, msg); if (severity & ERR_USAGE) want_usage = true; |