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
2381f6ef8c
commit
cdfc586295
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251804
@ -268,6 +268,14 @@
|
|||||||
#define _Alignof(x) __alignof(x)
|
#define _Alignof(x) __alignof(x)
|
||||||
#endif
|
#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
|
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||||
#define _Noreturn [[noreturn]]
|
#define _Noreturn [[noreturn]]
|
||||||
#else
|
#else
|
||||||
|
@ -43,10 +43,6 @@
|
|||||||
#error "stdatomic.h does not support your compiler"
|
#error "stdatomic.h does not support your compiler"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__CLANG_ATOMICS)
|
|
||||||
#define _Atomic(T) struct { volatile T __val; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 7.17.1 Atomic lock-free macros.
|
* 7.17.1 Atomic lock-free macros.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user