Mesa (main): util: Enable list_assert in debugoptimized builds

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 21 00:15:10 UTC 2022


Module: Mesa
Branch: main
Commit: ed06b3dd4917a13d2f547a649f3689f3f7fa5ef2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ed06b3dd4917a13d2f547a649f3689f3f7fa5ef2

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Thu Jul  7 17:59:48 2022 -0400

util: Enable list_assert in debugoptimized builds

In debugoptimized builds, DEBUG is not set (and neither is NDEBUG). The
intention of NDEBUG is to disable assertions. As such, list assertions should be
gated on !NDEBUG as opposed to on DEBUG.

But assert() is already disabled in that case, so we don't need our own special
assert (Eric).

This would have caught an assertion failure (due to the wrong iterator used)
sooner for the Valhall compiler.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reviewed-by: Eric Engestrom <eric at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17408>

---

 src/util/list.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/util/list.h b/src/util/list.h
index edc596f3d2d..68b668985d7 100644
--- a/src/util/list.h
+++ b/src/util/list.h
@@ -42,11 +42,7 @@
 #include <stddef.h>
 #include <assert.h>
 
-#ifdef DEBUG
-#  define list_assert(cond, msg)  assert(cond && msg)
-#else
-#  define list_assert(cond, msg)  (void)(0 && (cond))
-#endif
+#define list_assert(cond, msg)  assert(cond && msg)
 
 struct list_head
 {



More information about the mesa-commit mailing list