From a73ccfebcc9f60e6f2234cbf10cf7551279524d3 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 28 Aug 2019 19:02:47 -0700 Subject: error: replace nasm_verror() indirection with preproc callback Since pp_error_list_macros() was introduced, the only need for pp_verror() is to suppress error messages in certain contexts. Replace this function with a preprocessor callback, preproc->pp_suppress_error(), so we can drop the nasm_verror() function pointer entirely. Signed-off-by: H. Peter Anvin --- rdoff/rdoff.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'rdoff') diff --git a/rdoff/rdoff.c b/rdoff/rdoff.c index bdba82ae..77f2b42f 100644 --- a/rdoff/rdoff.c +++ b/rdoff/rdoff.c @@ -228,23 +228,24 @@ int rdf_errno = 0; /* ======================================================================== * Hook for nasm_error() to work * ======================================================================== */ -fatal_func nasm_verror_critical(errflags severity, const char *fmt, va_list val) +void nasm_verror(errflags severity, const char *fmt, va_list val) { + severity &= ERR_MASK; + vfprintf(stderr, fmt, val); - exit((severity & ERR_MASK) - ERR_FATAL + 2); + if (severity >= ERR_FATAL) + exit(severity - ERR_FATAL + 1); } -static void rdoff_verror(errflags severity, const char *fmt, va_list val) +fatal_func nasm_verror_critical(errflags severity, const char *fmt, va_list val) { - if ((severity & ERR_MASK) >= ERR_FATAL) - nasm_verror_critical(severity, fmt, val); - else - vfprintf(stderr, fmt, val); + nasm_verror(severity, fmt, val); + abort(); } void rdoff_init(void) { - nasm_set_verror(rdoff_verror); + } /* ======================================================================== -- cgit v1.2.3