Move _Atomic() into <sys/cdefs.h>.
That way _Atomic() is defined next to all the other C11 keywords for which we provide compatibility for pre-C11 compilers. While there, fix the definition to place "volatile" at the end. Otherwise pointer types will become "volatile T *" instead of "T * volatile".
This commit is contained in:
parent
99f22b551f
commit
6ee0e40b48
@ -268,6 +268,14 @@
|
||||
#define _Alignof(x) __alignof(x)
|
||||
#endif
|
||||
|
||||
#if !__has_extension(c_atomic) && !__has_extension(cxx_atomic)
|
||||
/*
|
||||
* No native support for _Atomic(). Place object in structure to prevent
|
||||
* most forms of direct non-atomic access.
|
||||
*/
|
||||
#define _Atomic(T) struct { T volatile __val; }
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||
#define _Noreturn [[noreturn]]
|
||||
#else
|
||||
|
@ -43,10 +43,6 @@
|
||||
#error "stdatomic.h does not support your compiler"
|
||||
#endif
|
||||
|
||||
#if !defined(__CLANG_ATOMICS)
|
||||
#define _Atomic(T) struct { volatile T __val; }
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 7.17.1 Atomic lock-free macros.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user