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@collabora.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17408>
This commit is contained in:
Alyssa Rosenzweig 2022-07-07 17:59:48 -04:00 committed by Marge Bot
parent 6139493ae3
commit ed06b3dd49
1 changed files with 1 additions and 5 deletions

View File

@ -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
{