From 24ba3ab28a3e9ab3333deaaaa19eddd332c14225 Mon Sep 17 00:00:00 2001 From: Lymia Aluysia Date: Tue, 17 Jan 2017 23:36:27 -0600 Subject: [PATCH] Fix check for HAVE_GCC_ATOMIC_BUILTINS --- configure | 66 --------------------------------------------- configure.ac | 42 ----------------------------- src/util/atomic.hpp | 2 +- 3 files changed, 1 insertion(+), 109 deletions(-) diff --git a/configure b/configure index e25cf3ec..2b751db2 100755 --- a/configure +++ b/configure @@ -6012,72 +6012,6 @@ fi done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler provides atomic builtins" >&5 -$as_echo_n "checking whether the compiler provides atomic builtins... " >&6; } -if ${ap_cv_atomic_builtins+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ap_cv_atomic_builtins=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main() -{ - unsigned long val = 1010, tmp, *mem = &val; - - if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020) - return 1; - - tmp = val; - - if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010) - return 1; - - if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0) - return 1; - - tmp = 3030; - - if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp) - return 1; - - if (__sync_lock_test_and_set(&val, 4040) != 3030) - return 1; - - mem = &tmp; - - if (__sync_val_compare_and_swap(&mem, &tmp, &val) != &tmp) - return 1; - - __sync_synchronize(); - - if (mem != &val) - return 1; - - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ap_cv_atomic_builtins=yes -else - ap_cv_atomic_builtins=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ap_cv_atomic_builtins" >&5 -$as_echo "$ap_cv_atomic_builtins" >&6; } - -if test "x$ap_cv_atomic_builtins" = "xyes"; then - -$as_echo "#define HAVE_GCC_ATOMIC_BUILTINS 1" >>confdefs.h - -fi - ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF diff --git a/configure.ac b/configure.ac index 553201c3..a483414e 100644 --- a/configure.ac +++ b/configure.ac @@ -76,48 +76,6 @@ AC_FUNC_MALLOC AC_FUNC_SELECT_ARGTYPES AC_CHECK_FUNCS([floor memset pow select sqrt]) -AC_CACHE_CHECK([whether the compiler provides atomic builtins], [ap_cv_atomic_builtins], -[AC_TRY_RUN([ -int main() -{ - unsigned long val = 1010, tmp, *mem = &val; - - if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020) - return 1; - - tmp = val; - - if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010) - return 1; - - if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0) - return 1; - - tmp = 3030; - - if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp) - return 1; - - if (__sync_lock_test_and_set(&val, 4040) != 3030) - return 1; - - mem = &tmp; - - if (__sync_val_compare_and_swap(&mem, &tmp, &val) != &tmp) - return 1; - - __sync_synchronize(); - - if (mem != &val) - return 1; - - return 0; -}], [ap_cv_atomic_builtins=yes], [ap_cv_atomic_builtins=no], [ap_cv_atomic_builtins=no])]) - -if test "x$ap_cv_atomic_builtins" = "xyes"; then - AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1, [Define if compiler provides atomic builtins]) -fi - AC_OUTPUT([ Makefile ]) diff --git a/src/util/atomic.hpp b/src/util/atomic.hpp index 5950e839..bc5d62b9 100644 --- a/src/util/atomic.hpp +++ b/src/util/atomic.hpp @@ -54,7 +54,7 @@ #define HAVE_FAST_ATOMIC // ----------------------------------------------------------------------------- : AtomicInt : GCC -#elif defined(__GNUC__) && !defined(HAVE_GCC_ATOMIC_BUILTINS) +#elif defined(__GNUC__) /// An integer which is equivalent to an AtomicInt, but which doesn't support attomic operations typedef unsigned int AtomicIntEquiv;