--- sqlite3.c.orig +++ sqlite3.c @@ -13448,7 +13448,8 @@ #ifndef __has_extension # define __has_extension(x) 0 /* compatibility with non-clang compilers */ #endif -#if GCC_VERSION>=4007000 || __has_extension(c_atomic) +/* for Xcode 4 (clang < 3.3) the existence of 'atomic' is detected by configure, but it is not fully functional, so key on clang_major > 4 */ +#if (!defined(__clang__) && ((GCC_VERSION>=4007000) || __has_extension(c_atomic))) || (defined(__clang_major__) && (__clang_major__ > 4) && __has_extension(c_atomic)) # define SQLITE_ATOMIC_INTRINSICS 1 # define AtomicLoad(PTR) __atomic_load_n((PTR),__ATOMIC_RELAXED) # define AtomicStore(PTR,VAL) __atomic_store_n((PTR),(VAL),__ATOMIC_RELAXED)