Commit f0ba7d897d1c22202531a added this code to expose asserts to the
compiler in an attempt to hide 'unused variable' warnings, incorrectly
claiming it was a no-op. This has two bad effects:
- any assert with side-effects are executed when they should be
  disabled
- the whole content of the assert must be understandable by the
  compiler, which isn't true if variable or members are correctly
  guarded by NDEBUG

Fix this by effectively reverting f0ba7d897d1c22202531a.

Unused variables warnings can be addressed by marking the variables as
MAYBE_UNUSED instead, as is done in the rest of Mesa.

Fixes: f0ba7d897d1c22202531a "util: better fix for unused variable
       warnings with asserts"
Cc: Keith Whitwell <kei...@vmware.com>
Reported-by: Gert Wollny <gw.foss...@gmail.com>
Signed-off-by: Eric Engestrom <eric.engest...@imgtec.com>
---
 src/gallium/auxiliary/util/u_debug.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/util/u_debug.h 
b/src/gallium/auxiliary/util/u_debug.h
index d2ea89f59c10e1bc0944..88e9bb8a29d63826167e 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -188,7 +188,7 @@ void _debug_assert_fail(const char *expr,
 #ifndef NDEBUG
 #define debug_assert(expr) ((expr) ? (void)0 : _debug_assert_fail(#expr, 
__FILE__, __LINE__, __FUNCTION__))
 #else
-#define debug_assert(expr) (void)(0 && (expr))
+#define debug_assert(expr) ((void)0)
 #endif
 
 
-- 
Cheers,
  Eric

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to