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.
  */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to