aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-13 21:53:31 -0800
committerH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-13 21:53:31 -0800
commit723ab481a6550454a6f834bb854e751744ca340a (patch)
treecb217692a76d3dcab83c7ad922e3adca9006dccd /include
parent6bde2ed8806b3e53657d46b61ee79d7afe5c2e13 (diff)
downloadnasm-723ab481a6550454a6f834bb854e751744ca340a.tar.gz
nasm-723ab481a6550454a6f834bb854e751744ca340a.tar.xz
nasm-723ab481a6550454a6f834bb854e751744ca340a.zip
warnings: define warning classes at point of usemkwarnings
It is extremely desirable to allow the user fine-grained control of warnings, but this has been complicated by the fact that a warning class has had to be defined in no less than three places (error.h, error.c, nasmdoc.src) before it can be used in source code. Instead, use a script to define these via magic comments at the point of use. This hopefully will encourage creating new classes as needed. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'include')
-rw-r--r--include/error.h49
1 files changed, 8 insertions, 41 deletions
diff --git a/include/error.h b/include/error.h
index 34e7d50f..3019615b 100644
--- a/include/error.h
+++ b/include/error.h
@@ -83,7 +83,6 @@ static inline vefunc nasm_set_verror(vefunc ve)
* These are the error severity codes which get passed as the first
* argument to an efunc.
*/
-
#define ERR_DEBUG 0x00000000 /* put out debugging message */
#define ERR_NOTE 0x00000001 /* additional error information */
#define ERR_WARNING 0x00000002 /* warn only: no further action */
@@ -107,55 +106,23 @@ static inline vefunc nasm_set_verror(vefunc ve)
* They are assumed to occupy the most significant bits of the
* severity code.
*/
-
#define WARN_SHR 12 /* how far to shift right */
-#define WARN(x) (((errflags)(x)) << WARN_SHR)
-#define WARN_MASK WARN(~0)
#define WARN_IDX(x) (((errflags)(x)) >> WARN_SHR)
-
-#define WARN_MACRO_PARAMS WARN( 1) /* macro-num-parameters warning */
-#define WARN_MACRO_SELFREF WARN( 2) /* macro self-reference */
-#define WARN_MACRO_DEFAULTS WARN( 3) /* macro default parameters check */
-#define WARN_ORPHAN_LABELS WARN( 4) /* orphan label (no colon, and alone on line) */
-#define WARN_NUMBER_OVERFLOW WARN( 5) /* numeric overflow */
-#define WARN_GNU_ELF_EXTENSIONS WARN( 6) /* using GNU ELF extensions */
-#define WARN_FLOAT_OVERFLOW WARN( 7) /* FP overflow */
-#define WARN_FLOAT_DENORM WARN( 8) /* FP denormal */
-#define WARN_FLOAT_UNDERFLOW WARN( 9) /* FP underflow */
-#define WARN_FLOAT_TOOLONG WARN(10) /* FP too many digits */
-#define WARN_USER WARN(11) /* %warning directives */
-#define WARN_LOCK WARN(12) /* bad LOCK prefixes */
-#define WARN_HLE WARN(13) /* bad HLE prefixes */
-#define WARN_BND WARN(14) /* bad BND prefixes */
-#define WARN_ZEXTRELOC WARN(15) /* relocation zero-extended */
-#define WARN_PTR WARN(16) /* not a NASM keyword */
-#define WARN_BAD_PRAGMA WARN(17) /* malformed pragma */
-#define WARN_UNKNOWN_PRAGMA WARN(18) /* unknown pragma */
-#define WARN_NOT_MY_PRAGMA WARN(19) /* pragma inapplicable */
-#define WARN_UNK_WARNING WARN(20) /* unknown warning */
-#define WARN_NEGATIVE_REP WARN(21) /* negative repeat count */
-#define WARN_PHASE WARN(22) /* phase error in pass 1 */
-#define WARN_LABEL_REDEF WARN(23) /* label redefined, but consistent */
-#define WARN_LABEL_REDEF_LATE WARN(24) /* label (re)defined during code generation */
-
-/* These two should come last */
-#define WARN_ALL (24+2) /* Do not use WARN() here */
-#define WARN_OTHER WARN(WARN_ALL-1) /* any noncategorized warning */
+#define WARN_MASK ((~(errflags)0) << WARN_SHR)
/* This is a bitmask */
#define WARN_ST_ENABLED 1 /* Warning is currently enabled */
#define WARN_ST_ERROR 2 /* Treat this warning as an error */
-struct warning {
- const char *name;
- const char *help;
- uint8_t state; /* Default state for this warning */
-};
-extern const struct warning warnings[WARN_ALL+1];
-extern uint8_t warning_state[WARN_ALL];
-extern uint8_t warning_state_init[WARN_ALL];
+/* Possible initial state for warnings */
+#define WARN_INIT_OFF 0
+#define WARN_INIT_ON WARN_ST_ENABLED
+#define WARN_INIT_ERR (WARN_ST_ENABLED|WARN_ST_ERROR)
/* Process a warning option or directive */
bool set_warning_status(const char *value);
+/* Should be included from within error.h only */
+#include "warnings.h"
+
#endif /* NASM_ERROR_H */