[Mesa-dev] [PATCH] util: Unbreak usage of assert()/debug_assert() inside expressions.

Jose Fonseca jfonseca at vmware.com
Fri Dec 12 06:09:45 PST 2014


From: José Fonseca <jfonseca at vmware.com>

f0ba7d897d1c22202531acb70f134f2edc30557d made debug_assert()/assert()
unsafe for expressions, but only now with u_atomic.h started to rely on
them for Windows this became an issue.

This fixes non-debug builds with MSVC.
---
 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 badd5e2..4c22fdf 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -185,7 +185,7 @@ void _debug_assert_fail(const char *expr,
 #ifdef DEBUG
 #define debug_assert(expr) ((expr) ? (void)0 : _debug_assert_fail(#expr, __FILE__, __LINE__, __FUNCTION__))
 #else
-#define debug_assert(expr) do { } while (0 && (expr))
+#define debug_assert(expr) (void)(0 && (expr))
 #endif
 
 
-- 
2.1.0



More information about the mesa-dev mailing list