From: nasm-bot f. H. P. A. <hp...@li...> - 2016-05-09 19:09:17
|
Commit-ID: 934f0478d409bced70ba1660512d4839cd76c571 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=934f0478d409bced70ba1660512d4839cd76c571 Author: H. Peter Anvin <hp...@li...> AuthorDate: Mon, 9 May 2016 12:00:19 -0700 Committer: H. Peter Anvin <hp...@li...> CommitDate: Mon, 9 May 2016 12:00:19 -0700 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 <hp...@li...> --- nasm.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/nasm.c b/nasm.c index fc26bba..bb9e206 100644 --- a/nasm.c +++ b/nasm.c @@ -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); |