summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2020-06-04 15:53:31 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2020-06-04 15:59:47 -0700
commit4964d80fe48582c95b88dd84d8e9d4e5a17c1de2 (patch)
treef98cf536ecccab1ce10c8ac9c8f836ea89f890e7 /include
parent12df4dd12f530f11e147a59be846c0453e79bb0c (diff)
downloadnasm-4964d80fe48582c95b88dd84d8e9d4e5a17c1de2.tar.gz
BR 3392652: hold smacro expansion warnings until we are sure
Don't issue smacro expansion warnings until we are sure we are actually *done* with the smacro expansion. The last pass of expand_smacro_noreset() gets to commit warnings. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'include')
-rw-r--r--include/error.h20
-rw-r--r--include/nasm.h2
2 files changed, 19 insertions, 3 deletions
diff --git a/include/error.h b/include/error.h
index 3bfe30a6..d5dc65da 100644
--- a/include/error.h
+++ b/include/error.h
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2019 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2020 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -99,13 +99,14 @@ fatal_func nasm_verror_critical(errflags severity, const char *fmt, va_list ap);
#define ERR_NO_SEVERITY 0x00000200 /* suppress printing severity */
#define ERR_PP_PRECOND 0x00000400 /* for preprocessor use */
#define ERR_PP_LISTMACRO 0x00000800 /* from preproc->error_list_macros() */
+#define ERR_HOLD 0x00001000 /* this error/warning can be held */
/*
* These codes define specific types of suppressible warning.
* They are assumed to occupy the most significant bits of the
* severity code.
*/
-#define WARN_SHR 12 /* how far to shift right */
+#define WARN_SHR 16 /* how far to shift right */
#define WARN_IDX(x) (((errflags)(x)) >> WARN_SHR)
#define WARN_MASK ((~(errflags)0) << WARN_SHR)
@@ -127,6 +128,21 @@ void pop_warnings(void);
void init_warnings(void);
void reset_warnings(void);
+/*
+ * Tentative error hold for warnings/errors indicated with ERR_HOLD.
+ *
+ * This is a stack; the "hold" argument *must*
+ * match the value returned from nasm_error_hold_push().
+ * If "issue" is true the errors are committed (or promoted to the next
+ * higher stack level), if false then they are discarded.
+ *
+ * Errors stronger than ERR_NONFATAL cannot be held.
+ */
+struct nasm_errhold;
+typedef struct nasm_errhold *errhold;
+errhold nasm_error_hold_push(void);
+void nasm_error_hold_pop(errhold hold, bool issue);
+
/* Should be included from within error.h only */
#include "warnings.h"
diff --git a/include/nasm.h b/include/nasm.h
index bb9dbf6b..046f5fb9 100644
--- a/include/nasm.h
+++ b/include/nasm.h
@@ -1344,4 +1344,4 @@ extern const char *outname; /* output filename */
*/
int64_t switch_segment(int32_t segment);
-#endif
+#endif /* NASM_NASM_H */