From 0a9e882d8b2a1e46e982b5d43038f01c113463ca Mon Sep 17 00:00:00 2001 From: eschnett Date: Tue, 5 Mar 2013 12:07:31 +0000 Subject: Correct autoconf of __builtin_unreachable() Correct autodetection of __builtin_unreachable() Correct fallback implementation of CCTK_BUILTIN_UNREACHABLE git-svn-id: http://svn.cactuscode.org/flesh/trunk@4976 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/make/aclocal.m4 | 4 ++-- lib/make/cctk_Config.h.in | 4 ++-- lib/make/configure | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/make/aclocal.m4 b/lib/make/aclocal.m4 index 551b206d..2d459ce2 100644 --- a/lib/make/aclocal.m4 +++ b/lib/make/aclocal.m4 @@ -1064,7 +1064,7 @@ fi AC_DEFUN(CCTK_C_BUILTIN_EXPECT, [AC_CACHE_CHECK([for C __builtin_expect], cctk_cv_have_c_builtin_expect, [cctk_cv_have_c_builtin_expect=no -AC_TRY_COMPILE(, __builtin_expect(0,0);, cctk_cv_have_c_builtin_expect=yes, cctk_cv_have_c_builtin_expect=no) +AC_TRY_LINK(, __builtin_expect(0,0);, cctk_cv_have_c_builtin_expect=yes, cctk_cv_have_c_builtin_expect=no) ]) if test "$cctk_cv_have_c_builtin_expect" = "yes" ; then AC_DEFINE(HAVE_CCTK_C_BUILTIN_EXPECT) @@ -1089,7 +1089,7 @@ fi AC_DEFUN(CCTK_C_BUILTIN_UNREACHABLE, [AC_CACHE_CHECK([for C __builtin_unreachable], cctk_cv_have_c_builtin_unreachable, [cctk_cv_have_c_builtin_unreachable=no -AC_TRY_COMPILE(, __builtin_unreachable();, cctk_cv_have_c_builtin_unreachable=yes, cctk_cv_have_c_builtin_unreachable=no) +AC_TRY_LINK(, __builtin_unreachable();, cctk_cv_have_c_builtin_unreachable=yes, cctk_cv_have_c_builtin_unreachable=no) ]) if test "$cctk_cv_have_c_builtin_unreachable" = "yes" ; then AC_DEFINE(HAVE_CCTK_C_BUILTIN_UNREACHABLE) diff --git a/lib/make/cctk_Config.h.in b/lib/make/cctk_Config.h.in index 5214e1ee..2de9fd0a 100644 --- a/lib/make/cctk_Config.h.in +++ b/lib/make/cctk_Config.h.in @@ -370,7 +370,7 @@ typedef enum {false, true} bool; #ifdef HAVE_CCTK_C_BUILTIN_UNREACHABLE # define CCTK_BUILTIN_UNREACHABLE() __builtin_unreachable() #else -# define CCTK_BUILTIN_UNREACHABLE() CCTK_Abort() +# define CCTK_BUILTIN_UNREACHABLE() CCTK_Abort(0, 1) #endif /* OpenMP collapse clause */ @@ -579,7 +579,7 @@ typedef enum {false, true} bool; #ifdef HAVE_CCTK_CXX_BUILTIN_UNREACHABLE # define CCTK_BUILTIN_UNREACHABLE() __builtin_unreachable() #else -# define CCTK_BUILTIN_UNREACHABLE() ((void)0) +# define CCTK_BUILTIN_UNREACHABLE() CCTK_Abort(0, 1) #endif /* Some C++ compilers recognise the restrict keyword */ diff --git a/lib/make/configure b/lib/make/configure index 8ea8b006..4c45038f 100755 --- a/lib/make/configure +++ b/lib/make/configure @@ -6633,7 +6633,7 @@ int main() { __builtin_expect(0,0); ; return 0; } EOF -if { (eval echo configure:6637: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cctk_cv_have_c_builtin_expect=yes else @@ -6720,7 +6720,7 @@ int main() { __builtin_unreachable(); ; return 0; } EOF -if { (eval echo configure:6724: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6724: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cctk_cv_have_c_builtin_unreachable=yes else @@ -8105,7 +8105,7 @@ cat > conftest.$ac_ext <