Implement LWG#2441: 'Exact-width atomic typedefs should be provided'

llvm-svn: 274236
This commit is contained in:
Marshall Clow 2016-06-30 15:28:38 +00:00
parent 497677449b
commit e766a87b01
5 changed files with 70 additions and 1 deletions

View File

@ -515,6 +515,15 @@ typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
typedef atomic<int_fast64_t> atomic_int_fast64_t; typedef atomic<int_fast64_t> atomic_int_fast64_t;
typedef atomic<uint_fast64_t> atomic_uint_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<intptr_t> atomic_intptr_t;
typedef atomic<uintptr_t> atomic_uintptr_t; typedef atomic<uintptr_t> atomic_uintptr_t;
typedef atomic<size_t> atomic_size_t; typedef atomic<size_t> atomic_size_t;
@ -1811,6 +1820,15 @@ typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
typedef atomic<int_fast64_t> atomic_int_fast64_t; typedef atomic<int_fast64_t> atomic_int_fast64_t;
typedef atomic<uint_fast64_t> atomic_uint_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<intptr_t> atomic_intptr_t;
typedef atomic<uintptr_t> atomic_uintptr_t; typedef atomic<uintptr_t> atomic_uintptr_t;
typedef atomic<size_t> atomic_size_t; typedef atomic<size_t> atomic_size_t;

View File

@ -185,6 +185,15 @@ int main()
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS #endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<std::atomic_wchar_t, wchar_t>(); 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_char, char>();
test<volatile std::atomic_schar, signed char>(); test<volatile std::atomic_schar, signed char>();
test<volatile std::atomic_uchar, unsigned char>(); test<volatile std::atomic_uchar, unsigned char>();
@ -201,4 +210,13 @@ int main()
test<volatile std::atomic_char32_t, char32_t>(); test<volatile std::atomic_char32_t, char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS #endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<volatile std::atomic_wchar_t, wchar_t>(); 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>();
} }

View File

@ -25,6 +25,18 @@
// typedef atomic<char16_t> atomic_char16_t; // typedef atomic<char16_t> atomic_char16_t;
// typedef atomic<char32_t> atomic_char32_t; // typedef atomic<char32_t> atomic_char32_t;
// typedef atomic<wchar_t> atomic_wchar_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 <atomic>
#include <type_traits> #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<char16_t>, std::atomic_char16_t>::value), "");
static_assert((std::is_same<std::atomic<char32_t>, std::atomic_char32_t>::value), ""); static_assert((std::is_same<std::atomic<char32_t>, std::atomic_char32_t>::value), "");
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS #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), "");
} }

View File

@ -43,6 +43,14 @@ struct TestEachIntegralType {
TestFunctor<char16_t>()(); TestFunctor<char16_t>()();
TestFunctor<char32_t>()(); TestFunctor<char32_t>()();
#endif #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>()();
} }
}; };

View File

@ -269,7 +269,7 @@
<tr><td><a href="http://wg21.link/LWG2422">2422</a></td><td>std::numeric_limits&lt;T&gt;::is_modulo description: "most machines" errata</td><td>Oulu</td><td></td></tr> <tr><td><a href="http://wg21.link/LWG2422">2422</a></td><td>std::numeric_limits&lt;T&gt;::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/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/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/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/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> <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>