Date: Sun, 16 Jun 2013 10:48:48 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251804 - head/sys/sys Message-ID: <201306161048.r5GAmmkG082610@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Sun Jun 16 10:48:47 2013 New Revision: 251804 URL: http://svnweb.freebsd.org/changeset/base/251804 Log: 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". Modified: head/sys/sys/cdefs.h head/sys/sys/stdatomic.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Sun Jun 16 09:30:35 2013 (r251803) +++ head/sys/sys/cdefs.h Sun Jun 16 10:48:47 2013 (r251804) @@ -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 Modified: head/sys/sys/stdatomic.h ============================================================================== --- head/sys/sys/stdatomic.h Sun Jun 16 09:30:35 2013 (r251803) +++ head/sys/sys/stdatomic.h Sun Jun 16 10:48:47 2013 (r251804) @@ -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. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306161048.r5GAmmkG082610>