0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-09-22 10:43:39 -04:00

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 <hpa@linux.intel.com>
This commit is contained in:
H. Peter Anvin
2017-03-08 01:26:40 -08:00
parent 38373e8f1c
commit b2047cbb98
6 changed files with 221 additions and 125 deletions

View File

@@ -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 */