HAVE_GCC_ATOMICS covers the test and set
authorSam Lantinga <slouken@libsdl.org>
Fri, 21 Jan 2011 21:45:55 -0800
changeset 507155ff76cdbbb8
parent 5070 042ad5e274ed
child 5072 2341ecc03388
HAVE_GCC_ATOMICS covers the test and set
configure.in
include/SDL_config_iphoneos.h
src/atomic/SDL_spinlock.c
     1.1 --- a/configure.in	Fri Jan 21 21:43:56 2011 -0800
     1.2 +++ b/configure.in	Fri Jan 21 21:45:55 2011 -0800
     1.3 @@ -311,18 +311,18 @@
     1.4  
     1.5      if test x$have_gcc_atomics = xyes; then
     1.6          AC_DEFINE(HAVE_GCC_ATOMICS)
     1.7 -    fi
     1.8 -
     1.9 -    # See if we have the minimum operation needed for GCC atomics
    1.10 -    AC_TRY_LINK([
    1.11 -    ],[
    1.12 -    int a;
    1.13 -    __sync_lock_test_and_set(&a, 1);
    1.14 -    ],[
    1.15 -    have_gcc_sync_lock_test_and_set=yes
    1.16 -    ])
    1.17 -    if test x$have_gcc_sync_lock_test_and_set = xyes; then
    1.18 -        AC_DEFINE(HAVE_GCC_SYNC_LOCK_TEST_AND_SET)
    1.19 +    else
    1.20 +        # See if we have the minimum operation needed for GCC atomics
    1.21 +        AC_TRY_LINK([
    1.22 +        ],[
    1.23 +        int a;
    1.24 +        __sync_lock_test_and_set(&a, 1);
    1.25 +        ],[
    1.26 +        have_gcc_sync_lock_test_and_set=yes
    1.27 +        ])
    1.28 +        if test x$have_gcc_sync_lock_test_and_set = xyes; then
    1.29 +            AC_DEFINE(HAVE_GCC_SYNC_LOCK_TEST_AND_SET)
    1.30 +        fi
    1.31      fi
    1.32  fi
    1.33  
     2.1 --- a/include/SDL_config_iphoneos.h	Fri Jan 21 21:43:56 2011 -0800
     2.2 +++ b/include/SDL_config_iphoneos.h	Fri Jan 21 21:45:55 2011 -0800
     2.3 @@ -44,7 +44,6 @@
     2.4  #define SDL_HAS_64BIT_TYPE	1
     2.5  
     2.6  #define HAVE_GCC_ATOMICS	1
     2.7 -#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET	1
     2.8  
     2.9  #define HAVE_ALLOCA_H		1
    2.10  #define HAVE_SYS_TYPES_H	1
     3.1 --- a/src/atomic/SDL_spinlock.c	Fri Jan 21 21:43:56 2011 -0800
     3.2 +++ b/src/atomic/SDL_spinlock.c	Fri Jan 21 21:45:55 2011 -0800
     3.3 @@ -36,7 +36,7 @@
     3.4  #elif defined(__MACOSX__)
     3.5      return OSAtomicCompareAndSwap32Barrier(0, 1, lock);
     3.6  
     3.7 -#elif defined(HAVE_GCC_SYNC_LOCK_TEST_AND_SET)
     3.8 +#elif defined(HAVE_GCC_ATOMICS) || defined(HAVE_GCC_SYNC_LOCK_TEST_AND_SET)
     3.9      return (__sync_lock_test_and_set(lock, 1) == 0);
    3.10  
    3.11  #elif defined(__GNUC__) && defined(__arm__) && defined(__ARM_ARCH_5__)