libcl: Respect NDEBUG for assert
In C, NDEBUG allows disabling the assert macro, let's follow this behaviour. Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Eric R. Smith <eric.smith@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32939>
This commit is contained in:

committed by
Marge Bot

parent
ecdccae990
commit
2e38a15070
@@ -126,6 +126,7 @@ static inline void abort(void) { nir_printf_abort(); }
|
||||
* careful to use a single printf so the lines don't get split up if multiple
|
||||
* threads assert in parallel.
|
||||
*/
|
||||
#ifndef NDEBUG
|
||||
#define _ASSERT_STRING(x) _ASSERT_STRING_INNER(x)
|
||||
#define _ASSERT_STRING_INNER(x) #x
|
||||
#define assert(x) if (!(x)) { \
|
||||
@@ -133,6 +134,9 @@ static inline void abort(void) { nir_printf_abort(); }
|
||||
_ASSERT_STRING(__LINE__) "\nExpected " #x "\n\n"); \
|
||||
nir_printf_abort(); \
|
||||
}
|
||||
#else
|
||||
#define assert(x)
|
||||
#endif
|
||||
|
||||
/* Core OpenCL C like likely/unlikely. We might be able to map to a clang built
|
||||
* in though...
|
||||
|
Reference in New Issue
Block a user