Module: Mesa
Branch: staging/23.0
Commit: 4db176201c60faab33bc33d65310ffde794a7485
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4db176201c60faab33bc33d65310ffde794a7485

Author: Mike Blumenkrantz <[email protected]>
Date:   Wed Apr 19 09:20:36 2023 -0400

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

this otherwise causes tons of compiler warnings

cc: mesa-stable

Reviewed-by: Emma Anholt <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22196>
(cherry picked from commit a6c8d74cd7ab5f761eb443611870acc3414f5a7e)

---

 .pick_status.json  | 2 +-
 src/util/u_debug.c | 5 +++--
 src/util/u_debug.h | 8 +++-----
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 2eaaac80bff..3dee6e381b5 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -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
diff --git a/src/util/u_debug.c b/src/util/u_debug.c
index a5f85120a98..65df21bd289 100644
--- a/src/util/u_debug.c
+++ b/src/util/u_debug.c
@@ -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);
 }
 
diff --git a/src/util/u_debug.h b/src/util/u_debug.h
index 4385be93a5d..e1a3113d92f 100644
--- a/src/util/u_debug.h
+++ b/src/util/u_debug.h
@@ -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

Reply via email to