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:

committed by
Marge Bot

parent
5863bafbdc
commit
2dcd6bed6a
@@ -122,17 +122,17 @@
|
||||
#if defined(HAVE___BUILTIN_UNREACHABLE) || __has_builtin(__builtin_unreachable)
|
||||
#define unreachable(str) \
|
||||
do { \
|
||||
assert(!str); \
|
||||
assert(!"" str); \
|
||||
__builtin_unreachable(); \
|
||||
} while (0)
|
||||
#elif defined (_MSC_VER)
|
||||
#define unreachable(str) \
|
||||
do { \
|
||||
assert(!str); \
|
||||
assert(!"" str); \
|
||||
__assume(0); \
|
||||
} while (0)
|
||||
#else
|
||||
#define unreachable(str) assert(!str)
|
||||
#define unreachable(str) assert(!"" str)
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user