From b2047cbb9885dfee037311ff66ef76296b99aecc Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 8 Mar 2017 01:26:40 -0800 Subject: Make -Werror controllable on a per-warning-class basis Make -Werror possible to control on a per-warning-class basis. While I was fixing up that code anyway, merge the handling of the -w, -W and [warning] argument and directives. Furthermore, make *all* warnings suppressible; any warning that isn't categorized now belong to category "other". However, for cleanliness sake an "other" option does not get listed in the warning messages. Signed-off-by: H. Peter Anvin --- include/error.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/error.h b/include/error.h index 18a50073..b1e42ba9 100644 --- a/include/error.h +++ b/include/error.h @@ -89,7 +89,7 @@ static inline vefunc nasm_set_verror(vefunc ve) #define WARN(x) ((x) << ERR_WARN_SHR) #define WARN_IDX(x) (((x) & ERR_WARN_MASK) >> ERR_WARN_SHR) -#define ERR_WARN_TERM WARN( 0) /* treat warnings as errors */ +#define ERR_WARN_OTHER WARN( 0) /* any noncategorized warning */ #define ERR_WARN_MNP WARN( 1) /* macro-num-parameters warning */ #define ERR_WARN_MSR WARN( 2) /* macro self-reference */ #define ERR_WARN_MDP WARN( 3) /* macro default parameters check */ @@ -110,16 +110,26 @@ static inline vefunc nasm_set_verror(vefunc ve) #define ERR_WARN_BAD_PRAGMA WARN(17) /* malformed pragma */ #define ERR_WARN_UNKNOWN_PRAGMA WARN(18) /* unknown pragma */ #define ERR_WARN_NOTMY_PRAGMA WARN(19) /* pragma inapplicable */ -#define ERR_WARN_MAX 19 /* the highest numbered one */ +#define ERR_WARN_UNK_WARNING WARN(20) /* unknown warning */ + +/* The "all" warning acts as a global switch, it must come last */ +#define ERR_WARN_ALL 21 /* Do not use WARN() here */ struct warning { const char *name; const char *help; bool enabled; }; -extern const struct warning warnings[ERR_WARN_MAX+1]; -extern bool warning_on[ERR_WARN_MAX+1]; /* Current state */ -extern bool warning_on_global[ERR_WARN_MAX+1]; /* Command-line state */ -void init_warnings(void); +extern const struct warning warnings[ERR_WARN_ALL+1]; + +/* This is a bitmask */ +#define WARN_ST_ENABLED 1 /* Warning is currently enabled */ +#define WARN_ST_ERROR 2 /* Treat this warning as an error */ + +extern uint8_t warning_state[ERR_WARN_ALL]; +extern uint8_t warning_state_init[ERR_WARN_ALL]; + +/* Process a warning option or directive */ +bool set_warning_status(const char *); #endif /* NASM_ERROR_H */ -- cgit v1.2.1