Properly enable Clang-style atomics when available.
In addition to testing against cxx_atomic, we must check c_atomic. The former is only set when building C++ code. Also use __has_extension instead of __has_feature. This allows us to use the atomics outside of C11. Reported by: Ariane van der Steldt <ariane stack nl> PR: threads/170073
This commit is contained in:
parent
c689c7da4c
commit
114318f8e8
@ -33,7 +33,7 @@
|
|||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#include <sys/_types.h>
|
#include <sys/_types.h>
|
||||||
|
|
||||||
#if __has_feature(cxx_atomic)
|
#if __has_extension(c_atomic) || __has_extension(cxx_atomic)
|
||||||
#define __CLANG_ATOMICS
|
#define __CLANG_ATOMICS
|
||||||
#elif __GNUC_PREREQ__(4, 7)
|
#elif __GNUC_PREREQ__(4, 7)
|
||||||
#define __GNUC_ATOMICS
|
#define __GNUC_ATOMICS
|
||||||
|
Loading…
Reference in New Issue
Block a user