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:
Ed Schouten 2013-06-16 10:48:47 +00:00
parent 2381f6ef8c
commit cdfc586295
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251804
2 changed files with 8 additions and 4 deletions

View File

@ -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

View File

@ -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.
*/