diff mbox

LWG 2441 Provide exact-width atomic typedefs

Message ID 20160720183845.GA24145@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely July 20, 2016, 6:38 p.m. UTC
* include/std/atomic (atomic_int8_t, atomic_uint8_t, atomic_int16_t)
	(atomic_uint16_t, atomic_int32_t, atomic_uint32_t, atomic_int64_t)
	(atomic_uint64_t): Define (LWG 2441).
	* testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc: Remove empty
	lines.
	* testsuite/29_atomics/headers/atomic/types_std_c++0x.cc: Test for
	the new types.
	* doc/xml/manual/intro.xml: Document DR 2441 status.

I've chosen to treat this as a DR and defined the types even for
-std=c++11 and -std=c++14. Again, if there are strong objections that
could be changed to only define them for -std=c++17 or -std=gnu++NN
but I'd rather not do that.

Tested x864-linux, committed to trunk
.
commit bc8afb20f0bcb079d2e132edf440693fcb243b22
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jul 20 18:32:00 2016 +0100

    LWG 2441 Provide exact-width atomic typedefs
    
    	* include/std/atomic (atomic_int8_t, atomic_uint8_t, atomic_int16_t)
    	(atomic_uint16_t, atomic_int32_t, atomic_uint32_t, atomic_int64_t)
    	(atomic_uint64_t): Define (LWG 2441).
    	* testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc: Remove empty
    	lines.
    	* testsuite/29_atomics/headers/atomic/types_std_c++0x.cc: Test for
    	the new types.
    	* doc/xml/manual/intro.xml: Document DR 2441 status.
diff mbox

Patch

diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml
index 6335614..c6b0656 100644
--- a/libstdc++-v3/doc/xml/manual/intro.xml
+++ b/libstdc++-v3/doc/xml/manual/intro.xml
@@ -1011,6 +1011,12 @@  requirements of the license of GCC.
     <listitem><para>Add <code>noexcept</code>.
     </para></listitem></varlistentry>
 
+    <varlistentry><term><link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="../ext/lwg-defects.html#2441">2441</link>:
+       <emphasis>Exact-width atomic typedefs should be provided</emphasis>
+    </term>
+    <listitem><para>Define the typedefs.
+    </para></listitem></varlistentry>
+
     <varlistentry><term><link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="../ext/lwg-defects.html#2454">2454</link>:
        <emphasis>Add <code>raw_storage_iterator::base()</code> member
        </emphasis>
diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic
index 8cbc91f..f8894bf 100644
--- a/libstdc++-v3/include/std/atomic
+++ b/libstdc++-v3/include/std/atomic
@@ -833,6 +833,34 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
   typedef atomic<char32_t>		atomic_char32_t;
 
 
+  // _GLIBCXX_RESOLVE_LIB_DEFECTS
+  // 2441. Exact-width atomic typedefs should be provided
+
+  /// atomic_int8_t
+  typedef atomic<int8_t>		atomic_int8_t;
+
+  /// atomic_uint8_t
+  typedef atomic<uint8_t>		atomic_uint8_t;
+
+  /// atomic_int16_t
+  typedef atomic<int16_t>		atomic_int16_t;
+
+  /// atomic_uint16_t
+  typedef atomic<uint16_t>		atomic_uint16_t;
+
+  /// atomic_int32_t
+  typedef atomic<int32_t>		atomic_int32_t;
+
+  /// atomic_uint32_t
+  typedef atomic<uint32_t>		atomic_uint32_t;
+
+  /// atomic_int64_t
+  typedef atomic<int64_t>		atomic_int64_t;
+
+  /// atomic_uint64_t
+  typedef atomic<uint64_t>		atomic_uint64_t;
+
+
   /// atomic_int_least8_t
   typedef atomic<int_least8_t>		atomic_int_least8_t;
 
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc
index a13f66a..1f56f5a 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc
@@ -21,6 +21,3 @@ 
 #include <atomic>
 
 // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
-
-
-
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc
index 32fe2a4..51adbf5 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc
@@ -72,4 +72,14 @@  void test01()
   using std::atomic_ptrdiff_t;
   using std::atomic_intmax_t;
   using std::atomic_uintmax_t;
+
+  // DR 2441
+  using std::atomic_int8_t;
+  using std::atomic_uint8_t;
+  using std::atomic_int16_t;
+  using std::atomic_uint16_t;
+  using std::atomic_int32_t;
+  using std::atomic_uint32_t;
+  using std::atomic_int64_t;
+  using std::atomic_uint64_t;
 }