util/debug: move null checks out of debug message macro

this otherwise causes tons of compiler warnings

cc: mesa-stable

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22196>
(cherry picked from commit a6c8d74cd7)
This commit is contained in:
Mike Blumenkrantz 2023-04-19 09:20:36 -04:00 committed by Dylan Baker
parent a081493e0d
commit 4db176201c
3 changed files with 7 additions and 8 deletions

View file

@ -2784,7 +2784,7 @@
"description": "util/debug: move null checks out of debug message macro",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -67,10 +67,11 @@ _util_debug_message(struct util_debug_callback *cb,
enum util_debug_type type,
const char *fmt, ...)
{
if (!cb || !cb->debug_message)
return;
va_list args;
va_start(args, fmt);
if (cb && cb->debug_message)
cb->debug_message(cb->data, id, type, fmt, args);
cb->debug_message(cb->data, id, type, fmt, args);
va_end(args);
}

View file

@ -262,11 +262,9 @@ debug_get_version_option(const char *name, unsigned *major, unsigned *minor);
*/
#define util_debug_message(cb, type, fmt, ...) do { \
static unsigned id = 0; \
if ((cb) && (cb)->debug_message) { \
_util_debug_message(cb, &id, \
UTIL_DEBUG_TYPE_ ## type, \
fmt, ##__VA_ARGS__); \
} \
_util_debug_message(cb, &id, \
UTIL_DEBUG_TYPE_ ## type, \
fmt, ##__VA_ARGS__); \
} while (0)
void