From: Ivan Maidanski Date: Tue, 5 Dec 2017 07:41:39 +0000 (+0300) Subject: Do not define AO_GCC_FORCE_HAVE_CAS for Clang 3.8+ (Aarch64) X-Git-Tag: v7.6.2~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06cbf7cb7b172c555ec76f90f32c04f346beeff4;p=libatomic_ops Do not define AO_GCC_FORCE_HAVE_CAS for Clang 3.8+ (Aarch64) (Cherry-pick commits 83fca68, baa9851 from 'master' branch.) Clang now defines __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros (so, the workaround is not needed anymore). * src/atomic_ops/sysdeps/gcc/aarch64.h (AO_GCC_FORCE_HAVE_CAS): Do not define if AO_CLANG_PREREQ(3, 8) (unless __APPLE_CC__). --- diff --git a/src/atomic_ops/sysdeps/gcc/aarch64.h b/src/atomic_ops/sysdeps/gcc/aarch64.h index 08680ce..1204816 100644 --- a/src/atomic_ops/sysdeps/gcc/aarch64.h +++ b/src/atomic_ops/sysdeps/gcc/aarch64.h @@ -204,12 +204,17 @@ #endif /* !AO_PREFER_BUILTIN_ATOMICS */ +/* As of clang-5.0, __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 */ +/* macro is still missing (while the double-word CAS is available). */ #if defined(__clang__) - /* As of clang-3.6/arm64, __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n are missing. */ -# define AO_GCC_FORCE_HAVE_CAS # define AO_GCC_HAVE_double_SYNC_CAS #endif +#if (defined(__clang__) && !AO_CLANG_PREREQ(3, 8)) || defined(__APPLE_CC__) + /* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros are missing. */ +# define AO_GCC_FORCE_HAVE_CAS +#endif + #include "generic.h" #undef AO_GCC_FORCE_HAVE_CAS