compiler: abort in debug build if unreachable() is reached

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2024-02-13 23:52:12 +00:00
parent 9b6b6855d7
commit 8d0284da1b

View File

@@ -105,9 +105,9 @@
#ifndef unreachable
# if defined(__GNUC__) || defined(__clang__)
# define unreachable() __builtin_unreachable()
# define unreachable() assert(false); __builtin_unreachable()
# else
# define unreachable() do {} while(0)
# define unreachable() assert(false); do {} while(0)
# endif
#endif