summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-12 15:58:32 -0800
committerH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-12 15:58:32 -0800
commit93367ea97b5984cd3b1b53d4ec9f3e6b7fd05a73 (patch)
treeb1f9f1d12191dc75b7d920a790f7163a8967e18c /include
parent64b56eaa3961038302ea3a8cc20d1f39c8d03c01 (diff)
downloadnasm-93367ea97b5984cd3b1b53d4ec9f3e6b7fd05a73.tar.gz
warnings; move WARN_OTHER to the end; allow non-warnings to be suppressed
Putting WARN_OTHER at the end of the list creates a number of advantages and simplifications: 1. It is more user friendly! It is far more of a logical location for the default case to be at the end of the printed list. 2. The value 0 can be used in a number of places to indicate a non-suppressible event. By having warning_state[0] always contain WARN_ST_ENABLED, we can always do the table lookup, even. 3. It means non-warnings (except fatal/panic) can now be conditioned on warning states. In those cases, WARN_*, including WARN_OTHER, can be added to the mask for any category. This is especially useful for notes. The only downside is that we have to explicitly detect the case where we have ERR_WARNING but no WARN_ flag. This is a trivial test. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'include')
-rw-r--r--include/error.h45
1 files changed, 23 insertions, 22 deletions
diff --git a/include/error.h b/include/error.h
index 63ec12b6..1d904849 100644
--- a/include/error.h
+++ b/include/error.h
@@ -83,41 +83,42 @@ static inline vefunc nasm_set_verror(vefunc ve)
/*
* These codes define specific types of suppressible warning.
+ * They are assumed to occupy the most significant bits of the
+ * severity code.
*/
-#define WARN_MASK 0xFFFFF000 /* the mask for this feature */
-#define WARN_SHR 12 /* how far to shift right */
+#define WARN_SHR 12 /* how far to shift right */
+#define WARN(x) ((x) << WARN_SHR)
+#define WARN_MASK WARN(~0)
+#define WARN_IDX(x) ((x) >> WARN_SHR)
-#define WARN(x) ((x) << WARN_SHR)
-#define WARN_IDX(x) (((x) & WARN_MASK) >> WARN_SHR)
-
-#define WARN_OTHER WARN( 0) /* any noncategorized warning */
-#define WARN_MNP WARN( 1) /* macro-num-parameters warning */
-#define WARN_MSR WARN( 2) /* macro self-reference */
-#define WARN_MDP WARN( 3) /* macro default parameters check */
-#define WARN_OL WARN( 4) /* orphan label (no colon, and
+#define WARN_MNP WARN( 1) /* macro-num-parameters warning */
+#define WARN_MSR WARN( 2) /* macro self-reference */
+#define WARN_MDP WARN( 3) /* macro default parameters check */
+#define WARN_OL WARN( 4) /* orphan label (no colon, and
* alone on line) */
-#define WARN_NOV WARN( 5) /* numeric overflow */
-#define WARN_GNUELF WARN( 6) /* using GNU ELF extensions */
-#define WARN_FL_OVERFLOW WARN( 7) /* FP overflow */
-#define WARN_FL_DENORM WARN( 8) /* FP denormal */
-#define WARN_FL_UNDERFLOW WARN( 9) /* FP underflow */
-#define WARN_FL_TOOLONG WARN(10) /* FP too many digits */
-#define WARN_USER WARN(11) /* %warning directives */
+#define WARN_NOV WARN( 5) /* numeric overflow */
+#define WARN_GNUELF WARN( 6) /* using GNU ELF extensions */
+#define WARN_FL_OVERFLOW WARN( 7) /* FP overflow */
+#define WARN_FL_DENORM WARN( 8) /* FP denormal */
+#define WARN_FL_UNDERFLOW WARN( 9) /* FP underflow */
+#define WARN_FL_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_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_BAD_PRAGMA WARN(17) /* malformed pragma */
#define WARN_UNKNOWN_PRAGMA WARN(18) /* unknown pragma */
#define WARN_NOTMY_PRAGMA WARN(19) /* pragma inapplicable */
#define WARN_UNK_WARNING WARN(20) /* unknown warning */
-#define WARN_NEG_REP WARN(21) /* negative repeat count */
+#define WARN_NEG_REP WARN(21) /* negative repeat count */
#define WARN_PHASE WARN(22) /* phase error in pass 1 */
-/* The "all" warning acts as a global switch, it must come last */
-#define WARN_ALL 23 /* Do not use WARN() here */
+/* These two should come last */
+#define WARN_ALL (22+2) /* Do not use WARN() here */
+#define WARN_OTHER WARN(WARN_ALL-1) /* any noncategorized warning */
struct warning {
const char *name;