summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-12 18:05:52 -0800
committerH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-12 18:05:52 -0800
commit8e08fb6da7bf1ac50b7c960c5b13c3bed7535b3d (patch)
tree57586939b851810ce229f936a7b64f43f6bdb155
parentdf4d3425993f80f0e56922368c845a40587a7dc0 (diff)
parent51222ab69e7ac1854587321442638620aa4829ba (diff)
downloadnasm-8e08fb6da7bf1ac50b7c960c5b13c3bed7535b3d.tar.gz
Merge remote-tracking branch 'origin/nasm-2.14.xx'
Resolved Conflicts: asm/assemble.c asm/directiv.c asm/error.c asm/float.c asm/labels.c asm/listing.c asm/nasm.c asm/parser.c asm/preproc.c asm/stdscan.c include/error.h output/outelf.c version Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
-rw-r--r--asm/error.c66
-rw-r--r--asm/labels.c58
-rw-r--r--asm/listing.c71
-rw-r--r--asm/nasm.c168
-rw-r--r--configure.ac5
-rw-r--r--include/error.h63
6 files changed, 233 insertions, 198 deletions
diff --git a/asm/error.c b/asm/error.c
index 969bb28f..fa8d2d62 100644
--- a/asm/error.c
+++ b/asm/error.c
@@ -46,38 +46,44 @@
* Description of the suppressible warnings for the command line and
* the [warning] directive.
*/
+#define on (WARN_ST_ENABLED)
+#define off 0
+#define err (WARN_ST_ENABLED|WARN_ST_ERROR)
+
const struct warning warnings[WARN_ALL+1] = {
- { "other", "any warning not specifially mentioned below", true },
- { "macro-params", "macro calls with wrong parameter count", true },
- { "macro-selfref", "cyclic macro references", false },
- { "macro-defaults", "macros with more default than optional parameters", true },
- { "orphan-labels", "labels alone on lines without trailing `:'", true },
- { "number-overflow", "numeric constant does not fit", true },
- { "gnu-elf-extensions", "using 8- or 16-bit relocation in ELF32, a GNU extension", false },
- { "float-overflow", "floating point overflow", true },
- { "float-denorm", "floating point denormal", false },
- { "float-underflow", "floating point underflow", false },
- { "float-toolong", "too many digits in floating-point number", true },
- { "user", "%warning directives", true },
- { "lock", "lock prefix on unlockable instructions", true },
- { "hle", "invalid hle prefixes", true },
- { "bnd", "invalid bnd prefixes", true },
- { "zext-reloc", "relocation zero-extended to match output format", true },
- { "ptr", "non-NASM keyword used in other assemblers", true },
- { "bad-pragma", "empty or malformed %pragma", false },
- { "unknown-pragma", "unknown %pragma facility or directive", false },
- { "not-my-pragma", "%pragma not applicable to this compilation", false },
- { "unknown-warning", "unknown warning in -W/-w or warning directive", false },
- { "negative-rep", "regative %rep count", true },
- { "phase", "phase error during stabilization", false },
-
- /* THIS ENTRY MUST COME LAST */
- { "all", "all possible warnings", false }
+ {NULL, NULL, on}, /* must be on - used for unconditional enable */
+ {"macro-params", "macro calls with wrong parameter count", on},
+ {"macro-selfref", "cyclic macro references", off},
+ {"macro-defaults", "macros with more default than optional parameters", on},
+ {"orphan-labels", "labels alone on lines without trailing `:'", on},
+ {"number-overflow", "numeric constant does not fit", on},
+ {"gnu-elf-extensions", "using 8- or 16-bit relocation in ELF32, a GNU extension", off},
+ {"float-overflow", "floating point overflow", on},
+ {"float-denorm", "floating point denormal", off},
+ {"float-underflow", "floating point underflow", off},
+ {"float-toolong", "too many digits in floating-point number", on},
+ {"user", "%warning directives", on},
+ {"lock", "lock prefix on unlockable instructions", on},
+ {"hle", "invalid hle prefixes", on},
+ {"bnd", "invalid bnd prefixes", on},
+ {"zext-reloc", "relocation zero-extended to match output format", on},
+ {"ptr", "non-NASM keyword used in other assemblers", on},
+ {"bad-pragma", "empty or malformed %pragma", off},
+ {"unknown-pragma", "unknown %pragma facility or directive", off},
+ {"not-my-pragma", "%pragma not applicable to this compilation", off},
+ {"unknown-warning", "unknown warning in -W/-w or warning directive", off},
+ {"negative-rep", "regative %rep count", on},
+ {"phase", "phase error during stabilization", off},
+ {"label-redef", "label redefined to an identical value", off},
+ {"label-redef-late", "label (re)defined during code generation", err},
+
+ /* THESE ENTRIES SHOULD COME LAST */
+ {"other", "any warning not specifially mentioned above", on},
+ {"all", "all possible warnings", off}
};
-/* Current state and command-line state, for reset */
-uint8_t warning_state[WARN_ALL];
-uint8_t warning_state_init[WARN_ALL];
+uint8_t warning_state[WARN_ALL];/* Current state */
+uint8_t warning_state_init[WARN_ALL]; /* Command-line state, for reset */
/* Global error handling function */
vefunc nasm_verror;
@@ -127,7 +133,7 @@ fatal_func nasm_assert_failed(const char *file, int line, const char *msg)
/*
* This is called when processing a -w or -W option, or a warning directive.
- * Returns true if if the action was successful.
+ * Returns on if if the action was successful.
*/
bool set_warning_status(const char *value)
{
diff --git a/asm/labels.c b/asm/labels.c
index 8eeb5b71..1152ba76 100644
--- a/asm/labels.c
+++ b/asm/labels.c
@@ -493,33 +493,41 @@ void define_label(const char *label, int32_t segment,
lptr->defn.size != size;
global_offset_changed += changed;
- if (changed) {
- if (lastdef == lpass) {
- int32_t saved_line = 0;
- const char *saved_fname = NULL;
-
- /*
- * Defined elsewhere in the program, seen in this pass.
- */
- nasm_nonfatal("label `%s' inconsistently redefined",
- lptr->defn.label);
-
- src_get(&saved_line, &saved_fname);
- src_set(lptr->defn.def_line, lptr->defn.def_file);
- nasm_notef(ERR_HERE, "label `%s' originally defined", lptr->defn.label);
- src_set(saved_line, saved_fname);
- } else if (pass0 > 1 && lptr->defn.type != LBL_SPECIAL) {
- /*
- * This probably should be ERR_NONFATAL, but not quite yet. As a
- * special case, LBL_SPECIAL symbols are allowed to be changed
- * even during the last pass.
- */
- nasm_warn("label `%s' %s during code generation",
- lptr->defn.label,
- created ? "defined" : "changed");
+ if (lastdef == lpass) {
+ int32_t saved_line = 0;
+ const char *saved_fname = NULL;
+ int noteflags;
+
+ /*
+ * Defined elsewhere in the program, seen in this pass.
+ */
+ if (changed) {
+ nasm_nonfatal("label `%s' inconsistently redefined", lptr->defn.label);
+ noteflags = ERR_NOTE|ERR_HERE;
+ } else {
+ nasm_warnf(WARN_LABEL_REDEF|ERR_PASS2,
+ "label `%s' redefined to an identical value", lptr->defn.label);
+ noteflags = ERR_NOTE|ERR_HERE|WARN_LABEL_REDEF|ERR_PASS2;
}
- }
+ src_get(&saved_line, &saved_fname);
+ src_set(lptr->defn.def_line, lptr->defn.def_file);
+ nasm_error(noteflags, "label `%s' originally defined",
+ lptr->defn.label);
+ src_set(saved_line, saved_fname);
+ } else if (changed && pass0 > 1 && lptr->defn.type != LBL_SPECIAL) {
+ /*
+ * WARN_LABEL_LATE defaults to an error, as this should never actually happen.
+ * Just in case this is a backwards compatibility problem, still make it a
+ * warning so that the user can suppress or demote it.
+ *
+ * As a special case, LBL_SPECIAL symbols are allowed to be changed
+ * even during the last pass.
+ */
+ nasm_warnf(WARN_LABEL_LATE,
+ "label `%s' %s during code generation",
+ lptr->defn.label, created ? "defined" : "changed");
+ }
lptr->defn.segment = segment;
lptr->defn.offset = offset;
lptr->defn.size = size;
diff --git a/asm/listing.c b/asm/listing.c
index 5484bd5d..440cc177 100644
--- a/asm/listing.c
+++ b/asm/listing.c
@@ -48,7 +48,7 @@
#include "error.h"
#include "listing.h"
-#define LIST_MAX_LEN 216 /* something sensible */
+#define LIST_MAX_LEN 256 /* something sensible */
#define LIST_INDENT 40
#define LIST_HEXBIT 18
@@ -67,7 +67,11 @@ static char xdigit[] = "0123456789ABCDEF";
static char listline[LIST_MAX_LEN];
static bool listlinep;
-static char listerror[LIST_MAX_LEN];
+struct list_error {
+ struct list_error *next;
+ char str[1];
+};
+struct list_error *listerr_head, **listerr_tail;
static char listdata[2 * LIST_INDENT]; /* we need less than that actually */
static int32_t listoffset;
@@ -85,32 +89,32 @@ static FILE *listfp;
static void list_emit(void)
{
int i;
+ struct list_error *le, *tmp;
- if (!listlinep && !listdata[0])
- return;
-
- fprintf(listfp, "%6"PRId32" ", listlineno);
+ if (listlinep || *listdata) {
+ fprintf(listfp, "%6"PRId32" ", listlineno);
- if (listdata[0])
- fprintf(listfp, "%08"PRIX32" %-*s", listoffset, LIST_HEXBIT + 1,
- listdata);
- else
- fprintf(listfp, "%*s", LIST_HEXBIT + 10, "");
+ if (listdata[0])
+ fprintf(listfp, "%08"PRIX32" %-*s", listoffset, LIST_HEXBIT + 1,
+ listdata);
+ else
+ fprintf(listfp, "%*s", LIST_HEXBIT + 10, "");
- if (listlevel_e)
- fprintf(listfp, "%s<%d>", (listlevel < 10 ? " " : ""),
- listlevel_e);
- else if (listlinep)
- fprintf(listfp, " ");
+ if (listlevel_e)
+ fprintf(listfp, "%s<%d>", (listlevel < 10 ? " " : ""),
+ listlevel_e);
+ else if (listlinep)
+ fprintf(listfp, " ");
- if (listlinep)
- fprintf(listfp, " %s", listline);
+ if (listlinep)
+ fprintf(listfp, " %s", listline);
- putc('\n', listfp);
- listlinep = false;
- listdata[0] = '\0';
+ putc('\n', listfp);
+ listlinep = false;
+ listdata[0] = '\0';
+ }
- if (listerror[0]) {
+ list_for_each_safe(le, tmp, listerr_head) {
fprintf(listfp, "%6"PRId32" ", listlineno);
for (i = 0; i < LIST_HEXBIT; i++)
putc('*', listfp);
@@ -121,9 +125,10 @@ static void list_emit(void)
else
fprintf(listfp, " ");
- fprintf(listfp, " %s\n", listerror);
- listerror[0] = '\0';
+ fprintf(listfp, " %s\n", le->str);
+ nasm_free(le);
}
+ listerr_tail = &listerr_head;
}
static void list_init(const char *fname)
@@ -141,7 +146,8 @@ static void list_init(const char *fname)
*listline = '\0';
listlineno = 0;
- *listerror = '\0';
+ listerr_head = NULL;
+ listerr_tail = &listerr_head;
listp = true;
listlevel = 0;
suppress = 0;
@@ -326,15 +332,28 @@ static void list_downlevel(int type)
static void list_error(int severity, const char *fmt, ...)
{
+ struct list_error *le;
va_list ap;
+ int len;
if (!listfp)
return;
va_start(ap, fmt);
- vsnprintf(listerror, sizeof listerror, fmt, ap);
+ len = vsnprintf(NULL, 0, fmt, ap);
va_end(ap);
+ /* sizeof(*le) already accounts for the final NULL */
+ le = nasm_malloc(sizeof(*le) + len);
+
+ va_start(ap, fmt);
+ vsnprintf(le->str, len+1, fmt, ap);
+ va_end(ap);
+
+ le->next = NULL;
+ *listerr_tail = le;
+ listerr_tail = &le->next;
+
if ((severity & ERR_MASK) >= ERR_FATAL)
list_emit();
}
diff --git a/asm/nasm.c b/asm/nasm.c
index a8d10783..48217455 100644
--- a/asm/nasm.c
+++ b/asm/nasm.c
@@ -76,7 +76,6 @@ struct forwrefinfo { /* info held on forward refs. */
static void parse_cmdline(int, char **, int);
static void assemble_file(const char *, struct strlist *);
-static bool is_suppressed_warning(int severity);
static bool skip_this_pass(int severity);
static void nasm_verror_asm(int severity, const char *fmt, va_list args);
static void usage(void);
@@ -1326,11 +1325,12 @@ static void parse_cmdline(int argc, char **argv, int pass)
char *envreal, *envcopy = NULL, *p;
int i;
- /* Initialize all the warnings to their default state */
- for (i = 0; i < WARN_ALL; i++) {
- warning_state_init[i] = warning_state[i] =
- warnings[i].enabled ? WARN_ST_ENABLED : 0;
- }
+ /*
+ * Initialize all the warnings to their default state, including
+ * warning index 0 used for "always on".
+ */
+ for (i = 0; i < WARN_ALL; i++)
+ warning_state_init[i] = warning_state[i] = warnings[i].state;
/*
* First, process the NASMENV environment variable.
@@ -1385,7 +1385,6 @@ static void parse_cmdline(int argc, char **argv, int pass)
if (!inname)
nasm_fatalf(ERR_USAGE, "no input file specified");
-
else if ((errname && !strcmp(inname, errname)) ||
(outname && !strcmp(inname, outname)) ||
(listname && !strcmp(inname, listname)) ||
@@ -1698,51 +1697,34 @@ static void assemble_file(const char *fname, struct strlist *depend_list)
}
}
-/*
- * check to see if this is a suppressable warning
+/**
+ * get warning index; 0 if this is non-suppressible.
*/
-static inline bool is_valid_warning(int severity)
+static size_t warn_index(int severity)
{
- /* Not a warning at all */
- if ((severity & ERR_MASK) != ERR_WARNING)
- return false;
+ size_t index;
- return WARN_IDX(severity) < WARN_ALL;
-}
+ if ((severity & ERR_MASK) >= ERR_FATAL)
+ return 0; /* Fatal errors are never suppressible */
-/**
- * check for suppressed warning
- * checks for suppressed warning or pass one only warning and we're
- * not in pass 1
- *
- * @param severity the severity of the warning or error
- * @return true if we should abort error/warning printing
- */
-static bool is_suppressed_warning(int severity)
-{
- /* Might be a warning but suppresed explicitly */
- if (is_valid_warning(severity) && !(severity & ERR_USAGE))
- return !(warning_state[WARN_IDX(severity)] & WARN_ST_ENABLED);
- else
- return false;
-}
+ /* If this is a warning and no index is provided, it is WARN_OTHER */
+ if ((severity & (ERR_MASK|WARN_MASK)) == ERR_WARNING)
+ severity |= WARN_OTHER;
-static bool warning_is_error(int severity)
-{
- if (is_valid_warning(severity))
- return !!(warning_state[WARN_IDX(severity)] & WARN_ST_ERROR);
- else
- return false;
+ index = WARN_IDX(severity);
+ nasm_assert(index < WARN_ALL);
+
+ return index;
}
static bool skip_this_pass(int severity)
{
/*
* See if it's a pass-specific error or warning which should be skipped.
- * We cannot skip errors stronger than ERR_NONFATAL as by definition
- * they cannot be resumed from.
+ * We can never skip fatal errors as by definition they cannot be
+ * resumed from.
*/
- if ((severity & ERR_MASK) > ERR_NONFATAL)
+ if ((severity & ERR_MASK) >= ERR_FATAL)
return false;
/*
@@ -1755,6 +1737,45 @@ static bool skip_this_pass(int severity)
}
/**
+ * check for suppressed message (usually warnings or notes)
+ *
+ * @param severity the severity of the warning or error
+ * @return true if we should abort error/warning printing
+ */
+static bool is_suppressed(int severity)
+{
+ if ((severity & ERR_MASK) >= ERR_FATAL)
+ return false; /* Fatal errors can never be suppressed */
+
+ return !(warning_state[warn_index(severity)] & WARN_ST_ENABLED);
+}
+
+/**
+ * Return the true error type (the ERR_MASK part) of the given
+ * severity, accounting for warnings that may need to be promoted to
+ * error.
+ *
+ * @param severity the severity of the warning or error
+ * @return true if we should error out
+ */
+static int true_error_type(int severity)
+{
+ const uint8_t warn_is_err = WARN_ST_ENABLED|WARN_ST_ERROR;
+ int type;
+
+ type = severity & ERR_MASK;
+
+ /* Promote warning to error? */
+ if (type == ERR_WARNING) {
+ uint8_t state = warning_state[warn_index(severity)];
+ if ((state & warn_is_err) == warn_is_err)
+ type = ERR_NONFATAL;
+ }
+
+ return type;
+}
+
+/**
* common error reporting
* This is the common back end of the error reporting schemes currently
* implemented. It prints the nature of the warning and then the
@@ -1770,12 +1791,16 @@ static void nasm_verror_asm(int severity, const char *fmt, va_list args)
char warnsuf[64];
char linestr[64];
const char *pfx;
- bool warn_is_err = warning_is_error(severity);
- bool warn_is_other = WARN_IDX(severity) == WARN_OTHER;
+ int spec_type = severity & ERR_MASK; /* type originally specified */
+ int true_type = true_error_type(severity);
const char *currentfile = NULL;
int32_t lineno = 0;
+ static const char * const pfx_table[ERR_MASK+1] = {
+ "debug: ", "note: ", "warning: ", "error: ",
+ "", "", "fatal: ", "panic: "
+ };
- if (is_suppressed_warning(severity))
+ if (is_suppressed(severity))
return;
if (!(severity & ERR_NOFILE)) {
@@ -1789,49 +1814,24 @@ static void nasm_verror_asm(int severity, const char *fmt, va_list args)
}
}
- switch (severity & (ERR_MASK|ERR_NO_SEVERITY)) {
- case ERR_NOTE:
- pfx = "note: ";
- break;
- case ERR_WARNING:
- if (!warn_is_err) {
- pfx = "warning: ";
- break;
- }
- /* fall through */
- case ERR_NONFATAL:
- pfx = "error: ";
- break;
- case ERR_FATAL:
- pfx = "fatal: ";
- break;
- case ERR_PANIC:
- pfx = "panic: ";
- break;
- case ERR_DEBUG:
- pfx = "debug: ";
- break;
- default:
- pfx = "";
- break;
- }
-
/*
* For a debug/warning/note event, if ERR_HERE is set don't
* output anything if there is no current filename available
*/
- if (!currentfile && (severity & ERR_HERE) &&
- ((severity & ERR_MASK) < ERR_WARNING ||
- (is_valid_warning(severity) && !warn_is_err)))
+ if (!currentfile && (severity & ERR_HERE) && true_type <= ERR_WARNING)
return;
+ if (severity & ERR_NO_SEVERITY)
+ pfx = "";
+ else
+ pfx = pfx_table[true_type];
vsnprintf(msg, sizeof msg, fmt, args);
*warnsuf = 0;
- if (is_valid_warning(severity) && (warn_is_err || !warn_is_other)) {
+ if (spec_type == ERR_WARNING) {
snprintf(warnsuf, sizeof warnsuf, " [-w+%s%s]",
- warn_is_err ? "error=" : "",
- warnings[WARN_IDX(severity)].name);
+ true_type ? "error=" : "",
+ warnings[warn_index(severity)].name);
}
*linestr = 0;
@@ -1877,15 +1877,11 @@ static void nasm_verror_asm(int severity, const char *fmt, va_list args)
preproc->error_list_macros(severity);
- switch (severity & ERR_MASK) {
+ switch (true_type) {
case ERR_NOTE:
case ERR_DEBUG:
- /* no further action, by definition */
- break;
case ERR_WARNING:
- /* Treat warnings as errors */
- if (warning_is_error(severity))
- terminate_after_phase = true;
+ /* no further action, by definition */
break;
case ERR_NONFATAL:
terminate_after_phase = true;
@@ -1993,14 +1989,14 @@ static void help(const char xopt)
}
}
- printf("\nWarnings for the -W/-w options:\n");
+ printf("\nWarnings for the -W/-w options: (default in brackets)\n");
- for (i = 0; i <= WARN_ALL; i++)
+ for (i = 1; i <= WARN_ALL; i++)
printf(" %-23s %s%s\n",
warnings[i].name, warnings[i].help,
i == WARN_ALL ? "\n" :
- warnings[i].enabled ? " (default on)" :
- " (default off)");
+ (warnings[i].state & WARN_ST_ERROR) ? " [error]" :
+ (warnings[i].state & WARN_ST_ENABLED) ? " [on]" : " [off]");
if (xopt == 'f') {
printf("valid output formats for -f are"
diff --git a/configure.ac b/configure.ac
index 878b3269..a7be0c50 100644
--- a/configure.ac
+++ b/configure.ac
@@ -284,6 +284,11 @@ PA_ADD_CFLAGS([-Wlong-long],[-Wno-long-long])
dnl This is needed because we intentionally expect strncpy() to fill
dnl in a zero-padded (not zero-terminated) buffer in several backends
PA_ADD_CFLAGS([-Wstringop-truncation],[-Wno-stringop-truncation])
+dnl This is needed because we assume 2's-completement signed arithmetic;
+dnl on compilers with gcc-like command line syntax we pass the -fwrapv
+dnl option for exactly that reason.
+PA_ADD_CFLAGS([-Wshift-negative-value],[-Wno-shift-negative-value])
+
dnl PA_ADD_CFLAGS([-Wwrite-strings])
PA_ARG_ENABLED([werror],
[compile with -Werror to error out on any warning],
diff --git a/include/error.h b/include/error.h
index db3e0785..de07d45e 100644
--- a/include/error.h
+++ b/include/error.h
@@ -94,53 +94,54 @@ 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(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
- * 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_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_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_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 */
+#define WARN_LABEL_REDEF WARN(23) /* label redefined, but consistent */
+#define WARN_LABEL_LATE WARN(24) /* label (re)defined during code generation */
-/* The "all" warning acts as a global switch, it must come last */
-#define WARN_ALL 23 /* Do not use WARN() here */
-
-struct warning {
- const char *name;
- const char *help;
- bool enabled;
-};
-extern const struct warning warnings[WARN_ALL+1];
+/* 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 */
/* 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];