diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2016-05-09 12:00:19 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2016-05-09 12:00:19 -0700 |
commit | 934f0478d409bced70ba1660512d4839cd76c571 (patch) | |
tree | 72b06e8ec57909096559451aed65314a2cc5a5c3 | |
parent | 3d72e45a137dcf5ff014856ea631811200341ad3 (diff) | |
download | nasm-934f0478d409bced70ba1660512d4839cd76c571.tar.gz |
Fix the handling of pass1 warnings, display control option for warnings
Fix pass1 warnings so they actually display.
When issuing suppressible warnings, display the option that controls
them, as gcc has been doing for a while.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | nasm.c | 22 |
1 files changed, 15 insertions, 7 deletions
@@ -1953,15 +1953,19 @@ static bool is_suppressed_warning(int severity) static bool skip_this_pass(int severity) { - /* See if it's a pass-one only warning and we're not in pass one. */ + /* See if it's a pass-specific warning which should be skipped. */ + if ((severity & ERR_MASK) > ERR_WARNING) return false; - if (((severity & ERR_PASS1) && pass0 != 1) || - ((severity & ERR_PASS2) && pass0 != 2)) - return true; - return false; + /* + * passn is 1 on the very first pass only. + * pass0 is 2 on the code-generation (final) pass only. + * These are the passes we care about in this case. + */ + return (((severity & ERR_PASS1) && passn != 1) || + ((severity & ERR_PASS2) && pass0 != 2)); } /** @@ -2000,14 +2004,18 @@ static void nasm_verror_common(int severity, const char *fmt, va_list args) break; } - vsnprintf(msg, sizeof msg, fmt, args); + vsnprintf(msg, sizeof msg - 64, fmt, args); + if (severity & ERR_WARN_MASK) { + char *p = strchr(msg, '\0'); + snprintf(p, 64, " [-w+%s]", warnings[WARN_IDX(severity)].name); + } if (!skip_this_pass(severity)) fprintf(error_file, "%s%s\n", pfx, msg); /* * Don't suppress this with skip_this_pass(), or we don't get - * preprocessor warnings in the list file + * pass1 or preprocessor warnings in the list file */ if ((severity & ERR_MASK) >= ERR_WARNING) lfmt->error(severity, pfx, msg); |