diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2017-03-07 19:23:03 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2017-03-07 19:31:04 -0800 |
commit | b20bc733c93f9f4fd3ba44dd6af36dc3b578d041 (patch) | |
tree | 18f2112c446ae63e33c3e919da87006c64dc8cdc /include/nasmlib.h | |
parent | ed40e2528d3d3d39fd72c32710933d30d2babca1 (diff) | |
download | nasm-b20bc733c93f9f4fd3ba44dd6af36dc3b578d041.tar.gz |
asm/*: Move directive processing to its own file, refactor error handling
Move directive processing to its own file, and move nasmlib/error.c to
asm/error.c (it was not used by the disassembler); remove some extern
declarations from .c files, and do some general code cleanups.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'include/nasmlib.h')
-rw-r--r-- | include/nasmlib.h | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/include/nasmlib.h b/include/nasmlib.h index 7d712e97..dbe623b7 100644 --- a/include/nasmlib.h +++ b/include/nasmlib.h @@ -64,81 +64,6 @@ extern unsigned char nasm_tolower_tab[256]; #define nasm_isxdigit(x) isxdigit((unsigned char)(x)) /* - * ------------------------- - * Error reporting functions - * ------------------------- - */ - -/* - * An error reporting function should look like this. - */ -void printf_func(2, 3) nasm_error(int severity, const char *fmt, ...); -no_return printf_func(2, 3) nasm_fatal(int flags, const char *fmt, ...); -no_return printf_func(2, 3) nasm_panic(int flags, const char *fmt, ...); -no_return 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); -extern vefunc nasm_verror; -static inline vefunc nasm_set_verror(vefunc ve) -{ - vefunc old_verror = nasm_verror; - nasm_verror = ve; - return old_verror; -} - -/* - * 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_WARNING 0x00000001 /* warn only: no further action */ -#define ERR_NONFATAL 0x00000002 /* terminate assembly after phase */ -#define ERR_FATAL 0x00000006 /* instantly fatal: exit with error */ -#define ERR_PANIC 0x00000007 /* internal error: panic instantly - * and dump core for reference */ -#define ERR_MASK 0x00000007 /* mask off the above codes */ -#define ERR_NOFILE 0x00000010 /* don't give source file name/line */ -#define ERR_USAGE 0x00000020 /* print a usage message */ -#define ERR_PASS1 0x00000040 /* only print this error on pass one */ -#define ERR_PASS2 0x00000080 - -#define ERR_NO_SEVERITY 0x00000100 /* suppress printing severity */ -#define ERR_PP_PRECOND 0x00000200 /* for preprocessor use */ -#define ERR_PP_LISTMACRO 0x00000400 /* from preproc->error_list_macros() */ - -/* - * These codes define specific types of suppressible warning. - */ - -#define ERR_WARN_MASK 0xFFFFF000 /* the mask for this feature */ -#define ERR_WARN_SHR 12 /* how far to shift right */ - -#define WARN(x) ((x) << ERR_WARN_SHR) -#define WARN_IDX(x) (((x) & ERR_WARN_MASK) >> ERR_WARN_SHR) - -#define ERR_WARN_TERM WARN( 0) /* treat warnings as errors */ -#define ERR_WARN_MNP WARN( 1) /* macro-num-parameters warning */ -#define ERR_WARN_MSR WARN( 2) /* macro self-reference */ -#define ERR_WARN_MDP WARN( 3) /* macro default parameters check */ -#define ERR_WARN_OL WARN( 4) /* orphan label (no colon, and - * alone on line) */ -#define ERR_WARN_NOV WARN( 5) /* numeric overflow */ -#define ERR_WARN_GNUELF WARN( 6) /* using GNU ELF extensions */ -#define ERR_WARN_FL_OVERFLOW WARN( 7) /* FP overflow */ -#define ERR_WARN_FL_DENORM WARN( 8) /* FP denormal */ -#define ERR_WARN_FL_UNDERFLOW WARN( 9) /* FP underflow */ -#define ERR_WARN_FL_TOOLONG WARN(10) /* FP too many digits */ -#define ERR_WARN_USER WARN(11) /* %warning directives */ -#define ERR_WARN_LOCK WARN(12) /* bad LOCK prefixes */ -#define ERR_WARN_HLE WARN(13) /* bad HLE prefixes */ -#define ERR_WARN_BND WARN(14) /* bad BND prefixes */ -#define ERR_WARN_ZEXTRELOC WARN(15) /* relocation zero-extended */ -#define ERR_WARN_PTR WARN(16) /* not a NASM keyword */ -#define ERR_WARN_MAX 16 /* the highest numbered one */ - -/* * Wrappers around malloc, realloc and free. nasm_malloc will * fatal-error and die rather than return NULL; nasm_realloc will * do likewise, and will also guarantee to work right on being |