From b9aad993816d420efc014213b4686b6bdafde7dd Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 18 Feb 2024 19:14:20 +0900 Subject: [PATCH] [qfcc] Clean up warning and notice return types They never needed to return expr. --- tools/qfcc/include/diagnostic.h | 8 ++++---- tools/qfcc/source/diagnostic.c | 8 +++----- tools/qfcc/source/stub.c | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/tools/qfcc/include/diagnostic.h b/tools/qfcc/include/diagnostic.h index 529f7db99..65ce5333a 100644 --- a/tools/qfcc/include/diagnostic.h +++ b/tools/qfcc/include/diagnostic.h @@ -54,13 +54,13 @@ void _internal_error (const expr_t *e, const char *file, int line, __attribute__ ((format (PRINTF, 5, 6), noreturn)); #define internal_error(e, fmt...) _internal_error(e, __FILE__, __LINE__, __FUNCTION__, fmt) -const expr_t *_warning (const expr_t *e, const char *file, - int line, const char *func, const char *fmt, ...) +void _warning (const expr_t *e, const char *file, int line, const char *func, + const char *fmt, ...) __attribute__ ((format (PRINTF, 5, 6))); #define warning(e, fmt...) _warning(e, __FILE__, __LINE__, __FUNCTION__, fmt) -const expr_t *_notice (const expr_t *e, const char *file, - int line, const char *func, const char *fmt, ...) +void _notice (const expr_t *e, const char *file, int line, const char *func, + const char *fmt, ...) __attribute__ ((format (PRINTF, 5, 6))); #define notice(e, fmt...) _notice(e, __FILE__, __LINE__, __FUNCTION__, fmt) diff --git a/tools/qfcc/source/diagnostic.c b/tools/qfcc/source/diagnostic.c index a6ba01d5e..7d0632f07 100644 --- a/tools/qfcc/source/diagnostic.c +++ b/tools/qfcc/source/diagnostic.c @@ -208,14 +208,14 @@ _bug (const expr_t *e, const char *file, int line, const char *func, va_end (args); } -const expr_t * +const void _notice (const expr_t *e, const char *file, int line, const char *func, const char *fmt, ...) { va_list args; if (options.notices.silent) - return e; + return; va_start (args, fmt); if (options.notices.promote) { @@ -237,10 +237,9 @@ _notice (const expr_t *e, const char *file, int line, const char *func, dstring_delete (message); } va_end (args); - return e; } -const expr_t * +const void _warning (const expr_t *e, const char *file, int line, const char *func, const char *fmt, ...) { @@ -249,7 +248,6 @@ _warning (const expr_t *e, const char *file, int line, const char *func, va_start (args, fmt); __warning (e, file, line, func, fmt, args); va_end (args); - return e; } void diff --git a/tools/qfcc/source/stub.c b/tools/qfcc/source/stub.c index 723d37627..46edc6407 100644 --- a/tools/qfcc/source/stub.c +++ b/tools/qfcc/source/stub.c @@ -55,7 +55,7 @@ void codespace_addcode (codespace_t *codespace, struct dstatement_s *code, int s __attribute__((const)) int function_parms (function_t *f, byte *parm_size) {return 0;} void def_to_ddef (def_t *def, ddef_t *ddef, int aux) {} __attribute__((noreturn)) void _internal_error (const expr_t *e, const char *file, int line, const char *func, const char *fmt, ...) {abort();} -__attribute__((const)) const expr_t *_warning (const expr_t *e, const char *file, int line, const char *func, const char *fmt, ...) {return 0;} +void _warning (const expr_t *e, const char *file, int line, const char *func, const char *fmt, ...) {} __attribute__((const)) const expr_t *_error (const expr_t *e, const char *file, int line, const char *func, const char *fmt, ...) {return 0;} __attribute__((const)) symbol_t *make_structure (const char *name, int su, struct_def_t *defs, const type_t *type) {return 0;} __attribute__((const)) symbol_t *symtab_addsymbol (symtab_t *symtab, symbol_t *symbol) {return 0;}