aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-13 22:10:25 -0800
committerH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-13 22:10:25 -0800
commit4229317a5f27aaf2e7a6e75ee2fae54bb23f0fae (patch)
tree6f15fe98c93112dd87338dcffb490d1166e50590 /include
parent0fca7de45db1d96eee02ca2bc64be412247b883f (diff)
parent723ab481a6550454a6f834bb854e751744ca340a (diff)
downloadnasm-4229317a5f27aaf2e7a6e75ee2fae54bb23f0fae.tar.gz
nasm-4229317a5f27aaf2e7a6e75ee2fae54bb23f0fae.tar.xz
nasm-4229317a5f27aaf2e7a6e75ee2fae54bb23f0fae.zip
Merge branch 'mkwarnings'
Resolved conflicts: asm/nasm.c Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'include')
-rw-r--r--include/error.h72
-rw-r--r--include/nasm.h3
2 files changed, 24 insertions, 51 deletions
diff --git a/include/error.h b/include/error.h
index d5b4f852..3019615b 100644
--- a/include/error.h
+++ b/include/error.h
@@ -46,25 +46,30 @@
extern FILE *error_file; /* Error file descriptor */
/*
+ * Typedef for the severity field
+ */
+typedef uint32_t errflags;
+
+/*
* An error reporting function should look like this.
*/
-void printf_func(2, 3) nasm_error(int severity, const char *fmt, ...);
+void printf_func(2, 3) nasm_error(errflags severity, const char *fmt, ...);
void printf_func(1, 2) nasm_debug(const char *fmt, ...);
-void printf_func(2, 3) nasm_debugf(int flags, const char *fmt, ...);
+void printf_func(2, 3) nasm_debugf(errflags flags, const char *fmt, ...);
void printf_func(1, 2) nasm_note(const char *fmt, ...);
-void printf_func(2, 3) nasm_notef(int flags, const char *fmt, ...);
+void printf_func(2, 3) nasm_notef(errflags flags, const char *fmt, ...);
void printf_func(1, 2) nasm_warn(const char *fmt, ...);
-void printf_func(2, 3) nasm_warnf(int flags, const char *fmt, ...);
+void printf_func(2, 3) nasm_warnf(errflags flags, const char *fmt, ...);
void printf_func(1, 2) nasm_nonfatal(const char *fmt, ...);
-void printf_func(2, 3) nasm_nonfatalf(int flags, const char *fmt, ...);
+void printf_func(2, 3) nasm_nonfatalf(errflags flags, const char *fmt, ...);
fatal_func printf_func(1, 2) nasm_fatal(const char *fmt, ...);
-fatal_func printf_func(2, 3) nasm_fatalf(int flags, const char *fmt, ...);
+fatal_func printf_func(2, 3) nasm_fatalf(errflags flags, const char *fmt, ...);
fatal_func printf_func(1, 2) nasm_panic(const char *fmt, ...);
-fatal_func printf_func(2, 3) nasm_panicf(int flags, const char *fmt, ...);
+fatal_func printf_func(2, 3) nasm_panicf(errflags flags, const char *fmt, ...);
fatal_func nasm_panic_from_macro(const char *file, int line);
#define panic() nasm_panic_from_macro(__FILE__, __LINE__);
-typedef void (*vefunc) (int severity, const char *fmt, va_list ap);
+typedef void (*vefunc) (errflags severity, const char *fmt, va_list ap);
extern vefunc nasm_verror;
static inline vefunc nasm_set_verror(vefunc ve)
@@ -78,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 */
@@ -102,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) ((x) << WARN_SHR)
-#define WARN_MASK WARN(~0)
-#define WARN_IDX(x) ((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_IDX(x) (((errflags)(x)) >> WARN_SHR)
+#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 */
diff --git a/include/nasm.h b/include/nasm.h
index f259d063..08474135 100644
--- a/include/nasm.h
+++ b/include/nasm.h
@@ -53,6 +53,7 @@
#include "opflags.h"
#include "regs.h"
#include "srcfile.h"
+#include "error.h"
/* Time stamp for the official start of compilation */
struct compile_time {
@@ -368,7 +369,7 @@ struct preproc_ops {
void (*include_path)(struct strlist *ipath);
/* Unwind the macro stack when printing an error message */
- void (*error_list_macros)(int severity);
+ void (*error_list_macros)(errflags severity);
};
extern const struct preproc_ops nasmpp;