mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 09:18:04 +02:00
util: enforce unreachable()'s argument being a literal string
This prevents the bugs fixed in the previous commits. Signed-off-by: Eric Engestrom <eric@igalia.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22529>
This commit is contained in:
parent
5863bafbdc
commit
2dcd6bed6a
1 changed files with 3 additions and 3 deletions
|
|
@ -122,17 +122,17 @@
|
||||||
#if defined(HAVE___BUILTIN_UNREACHABLE) || __has_builtin(__builtin_unreachable)
|
#if defined(HAVE___BUILTIN_UNREACHABLE) || __has_builtin(__builtin_unreachable)
|
||||||
#define unreachable(str) \
|
#define unreachable(str) \
|
||||||
do { \
|
do { \
|
||||||
assert(!str); \
|
assert(!"" str); \
|
||||||
__builtin_unreachable(); \
|
__builtin_unreachable(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#elif defined (_MSC_VER)
|
#elif defined (_MSC_VER)
|
||||||
#define unreachable(str) \
|
#define unreachable(str) \
|
||||||
do { \
|
do { \
|
||||||
assert(!str); \
|
assert(!"" str); \
|
||||||
__assume(0); \
|
__assume(0); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
#define unreachable(str) assert(!str)
|
#define unreachable(str) assert(!"" str)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue