aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2014-08-14 18:56:10 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2014-08-14 18:56:10 +0000
commit0ee9c843d86b7ce96336e21f8bf0193afeaeeea9 (patch)
treef1cd78706b1222ecae5a2345776b12d88e3644d8 /gcc
parentba8aa6fca60d3db6375b5f2c1ca6ab57d5ba97da (diff)
downloadgcc-0ee9c843d86b7ce96336e21f8bf0193afeaeeea9.zip
gcc-0ee9c843d86b7ce96336e21f8bf0193afeaeeea9.tar.gz
gcc-0ee9c843d86b7ce96336e21f8bf0193afeaeeea9.tar.bz2
DR 458
DR 458 * ginclude/stdatomic.h (__atomic_type_lock_free): Remove. (ATOMIC_*_LOCK_FREE): Map to __GCC_ATOMIC_*_LOCK_FREE. * gcc.dg/c11-stdatomic-2.c: New test. From-SVN: r213981
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ginclude/stdatomic.h34
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/c11-stdatomic-2.c27
4 files changed, 48 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 35d7a4a..8f731ca 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-08-14 Marek Polacek <polacek@redhat.com>
+
+ DR 458
+ * ginclude/stdatomic.h (__atomic_type_lock_free): Remove.
+ (ATOMIC_*_LOCK_FREE): Map to __GCC_ATOMIC_*_LOCK_FREE.
+
2014-08-14 Tom de Vries <tom@codesourcery.com>
* emit-rtl.h (mem_attrs_eq_p): Remove duplicate declaration.
diff --git a/gcc/ginclude/stdatomic.h b/gcc/ginclude/stdatomic.h
index 108259b..26b4b6e 100644
--- a/gcc/ginclude/stdatomic.h
+++ b/gcc/ginclude/stdatomic.h
@@ -95,30 +95,16 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t;
#define atomic_signal_fence(MO) __atomic_signal_fence (MO)
#define atomic_is_lock_free(OBJ) __atomic_is_lock_free (sizeof (*(OBJ)), (OBJ))
-#define __atomic_type_lock_free(T) \
- (__atomic_always_lock_free (sizeof (T), (void *) 0) \
- ? 2 \
- : (__atomic_is_lock_free (sizeof (T), (void *) 0) ? 1 : 0))
-#define ATOMIC_BOOL_LOCK_FREE \
- __atomic_type_lock_free (atomic_bool)
-#define ATOMIC_CHAR_LOCK_FREE \
- __atomic_type_lock_free (atomic_char)
-#define ATOMIC_CHAR16_T_LOCK_FREE \
- __atomic_type_lock_free (atomic_char16_t)
-#define ATOMIC_CHAR32_T_LOCK_FREE \
- __atomic_type_lock_free (atomic_char32_t)
-#define ATOMIC_WCHAR_T_LOCK_FREE \
- __atomic_type_lock_free (atomic_wchar_t)
-#define ATOMIC_SHORT_LOCK_FREE \
- __atomic_type_lock_free (atomic_short)
-#define ATOMIC_INT_LOCK_FREE \
- __atomic_type_lock_free (atomic_int)
-#define ATOMIC_LONG_LOCK_FREE \
- __atomic_type_lock_free (atomic_long)
-#define ATOMIC_LLONG_LOCK_FREE \
- __atomic_type_lock_free (atomic_llong)
-#define ATOMIC_POINTER_LOCK_FREE \
- __atomic_type_lock_free (void * _Atomic)
+#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
+#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
+#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
+#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
+#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
+#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
+#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
+#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
+#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
+#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
/* Note that these macros require __typeof__ and __auto_type to remove
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b879b3a..bc879c1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-08-14 Marek Polacek <polacek@redhat.com>
+
+ DR 458
+ * gcc.dg/c11-stdatomic-2.c: New test.
+
2014-08-14 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/62106
diff --git a/gcc/testsuite/gcc.dg/c11-stdatomic-2.c b/gcc/testsuite/gcc.dg/c11-stdatomic-2.c
new file mode 100644
index 0000000..d746b5c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-stdatomic-2.c
@@ -0,0 +1,27 @@
+/* Test stdatomic.h header contents. Test that ATOMIC_*_LOCK_FREE
+ macros can be used in an #if directive (DR#458). */
+/* { dg-do preprocess } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+#include <stdatomic.h>
+
+#if ATOMIC_BOOL_LOCK_FREE
+#endif
+#if ATOMIC_CHAR_LOCK_FREE
+#endif
+#if ATOMIC_CHAR16_T_LOCK_FREE
+#endif
+#if ATOMIC_CHAR32_T_LOCK_FREE
+#endif
+#if ATOMIC_WCHAR_T_LOCK_FREE
+#endif
+#if ATOMIC_SHORT_LOCK_FREE
+#endif
+#if ATOMIC_INT_LOCK_FREE
+#endif
+#if ATOMIC_LONG_LOCK_FREE
+#endif
+#if ATOMIC_LLONG_LOCK_FREE
+#endif
+#if ATOMIC_POINTER_LOCK_FREE
+#endif