aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--configure.in10
-rw-r--r--include/ruby/ruby.h3
3 files changed, 20 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d5a24f1de5..9e9fc5180d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Feb 24 15:49:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (__builtin_unreachable): check for clang.
+ [ruby-core:42849]
+
+ * include/ruby/ruby.h (UNREACHABLE): fallback definition.
+
Fri Feb 24 13:54:33 2012 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/parser.c: prevent a memory leak by protecting calls to
diff --git a/configure.in b/configure.in
index 18ed6b53db..8f9e7d0810 100644
--- a/configure.in
+++ b/configure.in
@@ -908,6 +908,16 @@ if test "$GCC" = yes; then
if test "$rb_cv_gcc_atomic_builtins" = yes; then
AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS)
fi
+
+ AC_CACHE_CHECK(for __builtin_unreachable, rb_cv_func___builtin_unreachable,
+ [AC_TRY_LINK([@%:@include <stdlib.h>],
+ [exit(0); __builtin_unreachable();],
+ [rb_cv_func___builtin_unreachable=yes],
+ [rb_cv_func___builtin_unreachable=no])
+ ])
+ if test "$rb_cv_func___builtin_unreachable" = yes; then
+ AC_DEFINE_UNQUOTED(UNREACHABLE, [__builtin_unreachable()])
+ fi
fi
AC_CACHE_CHECK(for exported function attribute, rb_cv_func_exported, [
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 75f0d71965..898d2e251d 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -36,6 +36,9 @@ extern "C" {
#ifndef NOINLINE
# define NOINLINE(x) x
#endif
+#ifndef UNREACHABLE
+# define UNREACHABLE /* unreachable */
+#endif
#ifdef __GNUC__
#define PRINTF_ARGS(decl, string_index, first_to_check) \