[libcxx] r274236 - Implement LWG#2441: 'Exact-width atomic typedefs should be provided'

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 30 08:28:38 PDT 2016


Author: marshall
Date: Thu Jun 30 10:28:38 2016
New Revision: 274236

URL: http://llvm.org/viewvc/llvm-project?rev=274236&view=rev
Log:
Implement LWG#2441: 'Exact-width atomic typedefs should be provided'

Modified:
    libcxx/trunk/include/atomic
    libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp
    libcxx/trunk/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp
    libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h
    libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/atomic
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/atomic?rev=274236&r1=274235&r2=274236&view=diff
==============================================================================
--- libcxx/trunk/include/atomic (original)
+++ libcxx/trunk/include/atomic Thu Jun 30 10:28:38 2016
@@ -515,6 +515,15 @@ typedef atomic<uint_fast32_t> atomic_uin
 typedef atomic<int_fast64_t>  atomic_int_fast64_t;
 typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
 
+typedef atomic<int8_t>   atomic_int8_t;
+typedef atomic<uint8_t>  atomic_uint8_t;
+typedef atomic<int16_t>  atomic_int16_t;
+typedef atomic<uint16_t> atomic_uint16_t;
+typedef atomic<int32_t>  atomic_int32_t;
+typedef atomic<uint32_t> atomic_uint32_t;
+typedef atomic<int64_t>  atomic_int64_t;
+typedef atomic<uint64_t> atomic_uint64_t;
+
 typedef atomic<intptr_t>  atomic_intptr_t;
 typedef atomic<uintptr_t> atomic_uintptr_t;
 typedef atomic<size_t>    atomic_size_t;
@@ -1811,6 +1820,15 @@ typedef atomic<uint_fast32_t> atomic_uin
 typedef atomic<int_fast64_t>  atomic_int_fast64_t;
 typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
 
+typedef atomic< int8_t>  atomic_int8_t;
+typedef atomic<uint8_t>  atomic_uint8_t;
+typedef atomic< int16_t> atomic_int16_t;
+typedef atomic<uint16_t> atomic_uint16_t;
+typedef atomic< int32_t> atomic_int32_t;
+typedef atomic<uint32_t> atomic_uint32_t;
+typedef atomic< int64_t> atomic_int64_t;
+typedef atomic<uint64_t> atomic_uint64_t;
+
 typedef atomic<intptr_t>  atomic_intptr_t;
 typedef atomic<uintptr_t> atomic_uintptr_t;
 typedef atomic<size_t>    atomic_size_t;

Modified: libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp?rev=274236&r1=274235&r2=274236&view=diff
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp (original)
+++ libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp Thu Jun 30 10:28:38 2016
@@ -185,6 +185,15 @@ int main()
 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
     test<std::atomic_wchar_t, wchar_t>();
 
+	test<std::atomic_int8_t,    int8_t>();
+	test<std::atomic_uint8_t,  uint8_t>();
+	test<std::atomic_int16_t,   int16_t>();
+	test<std::atomic_uint16_t, uint16_t>();
+	test<std::atomic_int32_t,   int32_t>();
+	test<std::atomic_uint32_t, uint32_t>();
+	test<std::atomic_int64_t,   int64_t>();
+	test<std::atomic_uint64_t, uint64_t>();
+	
     test<volatile std::atomic_char, char>();
     test<volatile std::atomic_schar, signed char>();
     test<volatile std::atomic_uchar, unsigned char>();
@@ -201,4 +210,13 @@ int main()
     test<volatile std::atomic_char32_t, char32_t>();
 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
     test<volatile std::atomic_wchar_t, wchar_t>();
+
+	test<volatile std::atomic_int8_t,    int8_t>();
+	test<volatile std::atomic_uint8_t,  uint8_t>();
+	test<volatile std::atomic_int16_t,   int16_t>();
+	test<volatile std::atomic_uint16_t, uint16_t>();
+	test<volatile std::atomic_int32_t,   int32_t>();
+	test<volatile std::atomic_uint32_t, uint32_t>();
+	test<volatile std::atomic_int64_t,   int64_t>();
+	test<volatile std::atomic_uint64_t, uint64_t>();
 }

Modified: libcxx/trunk/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp?rev=274236&r1=274235&r2=274236&view=diff
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp (original)
+++ libcxx/trunk/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp Thu Jun 30 10:28:38 2016
@@ -25,6 +25,18 @@
 // typedef atomic<char16_t>           atomic_char16_t;
 // typedef atomic<char32_t>           atomic_char32_t;
 // typedef atomic<wchar_t>            atomic_wchar_t;
+//
+// typedef atomic<intptr_t>           atomic_intptr_t;
+// typedef atomic<uintptr_t>          atomic_uintptr_t;
+//
+// typedef atomic<int8_t>             atomic_int8_t;
+// typedef atomic<uint8_t>            atomic_uint8_t;
+// typedef atomic<int16_t>            atomic_int16_t;
+// typedef atomic<uint16_t>           atomic_uint16_t;
+// typedef atomic<int32_t>            atomic_int32_t;
+// typedef atomic<uint32_t>           atomic_uint32_t;
+// typedef atomic<int64_t>            atomic_int64_t;
+// typedef atomic<uint64_t>           atomic_uint64_t;
 
 #include <atomic>
 #include <type_traits>
@@ -47,4 +59,17 @@ int main()
     static_assert((std::is_same<std::atomic<char16_t>, std::atomic_char16_t>::value), "");
     static_assert((std::is_same<std::atomic<char32_t>, std::atomic_char32_t>::value), "");
 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+
+//  Added by LWG 2441
+    static_assert((std::is_same<std::atomic<intptr_t>,  std::atomic_intptr_t>::value), "");
+    static_assert((std::is_same<std::atomic<uintptr_t>, std::atomic_uintptr_t>::value), "");
+
+    static_assert((std::is_same<std::atomic<int8_t>,    std::atomic_int8_t>::value), "");
+    static_assert((std::is_same<std::atomic<uint8_t>,   std::atomic_uint8_t>::value), "");
+    static_assert((std::is_same<std::atomic<int16_t>,   std::atomic_int16_t>::value), "");
+    static_assert((std::is_same<std::atomic<uint16_t>,  std::atomic_uint16_t>::value), "");
+    static_assert((std::is_same<std::atomic<int32_t>,   std::atomic_int32_t>::value), "");
+    static_assert((std::is_same<std::atomic<uint32_t>,  std::atomic_uint32_t>::value), "");
+    static_assert((std::is_same<std::atomic<int64_t>,   std::atomic_int64_t>::value), "");
+    static_assert((std::is_same<std::atomic<uint64_t>,  std::atomic_uint64_t>::value), "");
 }

Modified: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h?rev=274236&r1=274235&r2=274236&view=diff
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h (original)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h Thu Jun 30 10:28:38 2016
@@ -43,6 +43,14 @@ struct TestEachIntegralType {
         TestFunctor<char16_t>()();
         TestFunctor<char32_t>()();
 #endif
+		TestFunctor<  int8_t>()();
+		TestFunctor< uint8_t>()();
+		TestFunctor< int16_t>()();
+		TestFunctor<uint16_t>()();
+		TestFunctor< int32_t>()();
+		TestFunctor<uint32_t>()();
+		TestFunctor< int64_t>()();
+		TestFunctor<uint64_t>()();
     }
 };
 

Modified: libcxx/trunk/www/cxx1z_status.html
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=274236&r1=274235&r2=274236&view=diff
==============================================================================
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Thu Jun 30 10:28:38 2016
@@ -269,7 +269,7 @@
 	<tr><td><a href="http://wg21.link/LWG2422">2422</a></td><td>std::numeric_limits<T>::is_modulo description: "most machines" errata</td><td>Oulu</td><td></td></tr>
 	<tr><td><a href="http://wg21.link/LWG2426">2426</a></td><td>Issue about compare_exchange</td><td>Oulu</td><td></td></tr>
 	<tr><td><a href="http://wg21.link/LWG2436">2436</a></td><td>Comparators for associative containers should always be CopyConstructible</td><td>Oulu</td><td>Complete</td></tr>
-	<tr><td><a href="http://wg21.link/LWG2441">2441</a></td><td>Exact-width atomic typedefs should be provided</td><td>Oulu</td><td></td></tr>
+	<tr><td><a href="http://wg21.link/LWG2441">2441</a></td><td>Exact-width atomic typedefs should be provided</td><td>Oulu</td><td>Complete</td></tr>
 	<tr><td><a href="http://wg21.link/LWG2451">2451</a></td><td>[fund.ts.v2] optional should 'forward' T's implicit conversions</td><td>Oulu</td><td></td></tr>
 	<tr><td><a href="http://wg21.link/LWG2509">2509</a></td><td>[fund.ts.v2] any_cast doesn't work with rvalue reference targets and cannot move with a value target</td><td>Oulu</td><td></td></tr>
 	<tr><td><a href="http://wg21.link/LWG2516">2516</a></td><td>[fund.ts.v2] Public "exposition only" members in observer_ptr</td><td>Oulu</td><td></td></tr>




More information about the cfe-commits mailing list