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
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
1 changed files with 2 additions and 2 deletions

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