Skip to content

Commit

Permalink
Define CAMLunreachable in GCC < 10
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MisterDA committed Jul 24, 2024
1 parent 0ebe56b commit 26e1886
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/caml/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <intrin.h>
Expand Down

0 comments on commit 26e1886

Please sign in to comment.