atomics: Define HAVE_GCC_ATOMIC_OPERATIONS when building with clang

We should probably check for stdatomic.h and use the c11 functions if
available.
This commit is contained in:
Tobias Brunner
2018-07-03 11:31:31 +02:00
parent 929badfefd
commit 942599b623
+7 -1
View File
@@ -27,8 +27,14 @@
*/
typedef u_int refcount_t;
/* use __atomic* built-ins with clang, if available (note that clang also
* defines __GNUC__, however only claims to be GCC 4.2) */
#if defined(__clang__)
# if __has_builtin(__atomic_add_fetch)
# define HAVE_GCC_ATOMIC_OPERATIONS
# endif
/* use __atomic* built-ins with GCC 4.7 and newer */
#ifdef __GNUC__
#elif defined(__GNUC__)
# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6))
# define HAVE_GCC_ATOMIC_OPERATIONS
# endif