From 2f16043879fbfb73bc114c2c28aab036fd55c4c5 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 30 Sep 2008 16:39:17 -0700 Subject: [PATCH] Allow %warning output to be suppressed Allow the user to suppress user-specified warnings. Signed-off-by: H. Peter Anvin --- doc/changes.src | 3 +++ doc/nasmdoc.src | 3 +++ nasm.c | 9 ++++++--- nasmlib.h | 3 ++- preproc.c | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/doc/changes.src b/doc/changes.src index 6624f128..b0f3ab42 100644 --- a/doc/changes.src +++ b/doc/changes.src @@ -13,6 +13,9 @@ since 2007. \b Make the behaviour of \c{-O0} match NASM 0.98 legacy behavior. See \k{opt-O}. +\b \c{-w-user} can be used to suppress the output of \c{%warning} directives. + See \k{opt-w}. + \S{cl-2.04} Version 2.04 diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index 9b66bb6d..54322ff3 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -889,6 +889,9 @@ Disabled by default. \b \i\c{float-toolong} warns about too many digits in floating-point numbers. Enabled by default. +\b \i\c{user} controls \c{%warning} directives (see \k{pperror}). +Enabled by default. + In addition, you can set warning classes across sections. Warning classes may be enabled with \i\c{[warning +warning-name]}, disabled with \i\c{[warning -warning-name]} or reset to their diff --git a/nasm.c b/nasm.c index a92db929..3aedfb0c 100644 --- a/nasm.c +++ b/nasm.c @@ -107,7 +107,8 @@ static const char *depend_file = NULL; static bool suppressed[ERR_WARN_MAX+1]; static bool suppressed_global[ERR_WARN_MAX+1] = { - true, false, true, false, false, false, true, false, true, true, false + true, false, true, false, false, false, true, false, true, true, false, + true }; /* * The option names for the suppressible warnings. As before, entry @@ -116,7 +117,8 @@ static bool suppressed_global[ERR_WARN_MAX+1] = { static const char *suppressed_names[ERR_WARN_MAX+1] = { "error", "macro-params", "macro-selfref", "macro-defaults", "orphan-labels", "number-overflow", "gnu-elf-extensions", - "float-overflow", "float-denorm", "float-underflow", "float-toolong" + "float-overflow", "float-denorm", "float-underflow", "float-toolong", + "user" }; /* @@ -134,7 +136,8 @@ static const char *suppressed_what[ERR_WARN_MAX+1] = { "floating point overflow", "floating point denormal", "floating point underflow", - "too many digits in floating-point number" + "too many digits in floating-point number", + "%warning directives" }; /* diff --git a/nasmlib.h b/nasmlib.h index e46ca45e..9cc285db 100644 --- a/nasmlib.h +++ b/nasmlib.h @@ -93,7 +93,8 @@ extern efunc nasm_malloc_error; #define ERR_WARN_FL_DENORM WARN( 8) /* FP denormal */ #define ERR_WARN_FL_UNDERFLOW WARN( 9) /* FP underflow */ #define ERR_WARN_FL_TOOLONG WARN(10) /* FP too many digits */ -#define ERR_WARN_MAX 10 /* the highest numbered one */ +#define ERR_WARN_USER WARN(11) /* %warning directives */ +#define ERR_WARN_MAX 11 /* the highest numbered one */ /* * Wrappers around malloc, realloc and free. nasm_malloc will diff --git a/preproc.c b/preproc.c index 7f1c44f0..90a62e6e 100644 --- a/preproc.c +++ b/preproc.c @@ -2377,7 +2377,7 @@ static int do_directive(Token * tline) severity = ERR_NONFATAL|ERR_NO_SEVERITY; goto issue_error; case PP_WARNING: - severity = ERR_WARNING|ERR_NO_SEVERITY; + severity = ERR_WARNING|ERR_NO_SEVERITY|ERR_WARN_USER; goto issue_error; issue_error: -- 2.11.4.GIT