From 8d0284da1b7558a25db26d568db74da507582aba Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Tue, 13 Feb 2024 23:52:12 +0000 Subject: [PATCH] compiler: abort in debug build if unreachable() is reached Signed-off-by: Yuxuan Shui --- src/compiler.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler.h b/src/compiler.h index 544daa5..63e337f 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -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