From 26e1886606526a8cb82b08eb41751316246d36fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Wed, 24 Jul 2024 10:22:12 +0200 Subject: [PATCH] Define CAMLunreachable in GCC < 10 GCC 10 introduced support for __has_builtin. GCC 9 needs a return in all (switch) branches. GCC 4.3 introduced support for __builtin_trap. As for other builtins, we need a fallback to use them with GCC < 10. --- runtime/caml/misc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/caml/misc.h b/runtime/caml/misc.h index 1b774f16f85c..7c651b564145 100644 --- a/runtime/caml/misc.h +++ b/runtime/caml/misc.h @@ -280,7 +280,7 @@ CAMLnoret CAMLextern void caml_failed_assert (char *, char_os *, int); #define CAMLassert(x) ((void) 0) #endif -#if __has_builtin(__builtin_trap) +#if __has_builtin(__builtin_trap) || defined(__GNUC__) #define CAMLunreachable() (__builtin_trap()) #elif defined(_MSC_VER) #include