libcl: add unreachable() macro

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33099>
This commit is contained in:
Alyssa Rosenzweig 2025-01-30 10:46:54 -05:00 committed by Marge Bot
parent 72bd3a6004
commit 2a1524a089

View file

@ -161,6 +161,15 @@ static inline void abort(void) { nir_printf_abort(); }
#define assert(x)
#endif
/* This is the unreachable macro from macros.h that uses __builtin_unreachable,
* which is a clang builtin available in OpenCL C.
*/
#define unreachable(str) \
do { \
assert(!"" str); \
__builtin_unreachable(); \
} while (0)
/* Core OpenCL C like likely/unlikely. We might be able to map to a clang built
* in though...
*/