diff options
Diffstat (limited to 'test/std/atomics')
36 files changed, 248 insertions, 119 deletions
diff --git a/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp b/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp index 3a74e13faf19..22bbbd6af535 100644 --- a/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp +++ b/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp @@ -22,13 +22,15 @@ int main() { { - std::atomic_flag f(false); + std::atomic_flag f; + f.clear(); f.test_and_set(); atomic_flag_clear(&f); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f(false); + volatile std::atomic_flag f; + f.clear(); f.test_and_set(); atomic_flag_clear(&f); assert(f.test_and_set() == 0); diff --git a/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp b/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp index 0467384455cc..1a212c6f352a 100644 --- a/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp +++ b/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp @@ -22,38 +22,44 @@ int main() { { - std::atomic_flag f(false); - f.test_and_set(); + std::atomic_flag f; // uninitialized first + atomic_flag_clear_explicit(&f, std::memory_order_relaxed); + assert(f.test_and_set() == 0); atomic_flag_clear_explicit(&f, std::memory_order_relaxed); assert(f.test_and_set() == 0); } { - std::atomic_flag f(false); - f.test_and_set(); + std::atomic_flag f; + atomic_flag_clear_explicit(&f, std::memory_order_release); + assert(f.test_and_set() == 0); atomic_flag_clear_explicit(&f, std::memory_order_release); assert(f.test_and_set() == 0); } { - std::atomic_flag f(false); - f.test_and_set(); + std::atomic_flag f; + atomic_flag_clear_explicit(&f, std::memory_order_seq_cst); + assert(f.test_and_set() == 0); atomic_flag_clear_explicit(&f, std::memory_order_seq_cst); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f(false); - f.test_and_set(); + volatile std::atomic_flag f; + atomic_flag_clear_explicit(&f, std::memory_order_relaxed); + assert(f.test_and_set() == 0); atomic_flag_clear_explicit(&f, std::memory_order_relaxed); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f(false); - f.test_and_set(); + volatile std::atomic_flag f; + atomic_flag_clear_explicit(&f, std::memory_order_release); + assert(f.test_and_set() == 0); atomic_flag_clear_explicit(&f, std::memory_order_release); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f(false); - f.test_and_set(); + volatile std::atomic_flag f; + atomic_flag_clear_explicit(&f, std::memory_order_seq_cst); + assert(f.test_and_set() == 0); atomic_flag_clear_explicit(&f, std::memory_order_seq_cst); assert(f.test_and_set() == 0); } diff --git a/test/std/atomics/atomics.flag/clear.pass.cpp b/test/std/atomics/atomics.flag/clear.pass.cpp index ea5ae45ae99a..255af8f176ea 100644 --- a/test/std/atomics/atomics.flag/clear.pass.cpp +++ b/test/std/atomics/atomics.flag/clear.pass.cpp @@ -22,50 +22,58 @@ int main() { { - std::atomic_flag f(false); - f.test_and_set(); + std::atomic_flag f; // uninitialized + f.clear(); + assert(f.test_and_set() == 0); f.clear(); assert(f.test_and_set() == 0); } { - std::atomic_flag f(false); - f.test_and_set(); + std::atomic_flag f; + f.clear(std::memory_order_relaxed); + assert(f.test_and_set() == 0); f.clear(std::memory_order_relaxed); assert(f.test_and_set() == 0); } { - std::atomic_flag f(false); - f.test_and_set(); + std::atomic_flag f; + f.clear(std::memory_order_release); + assert(f.test_and_set() == 0); f.clear(std::memory_order_release); assert(f.test_and_set() == 0); } { - std::atomic_flag f(false); - f.test_and_set(); + std::atomic_flag f; + f.clear(std::memory_order_seq_cst); + assert(f.test_and_set() == 0); f.clear(std::memory_order_seq_cst); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f(false); - f.test_and_set(); + volatile std::atomic_flag f; + f.clear(); + assert(f.test_and_set() == 0); f.clear(); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f(false); - f.test_and_set(); + volatile std::atomic_flag f; + f.clear(std::memory_order_relaxed); + assert(f.test_and_set() == 0); f.clear(std::memory_order_relaxed); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f(false); - f.test_and_set(); + volatile std::atomic_flag f; + f.clear(std::memory_order_release); + assert(f.test_and_set() == 0); f.clear(std::memory_order_release); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f(false); - f.test_and_set(); + volatile std::atomic_flag f; + f.clear(std::memory_order_seq_cst); + assert(f.test_and_set() == 0); f.clear(std::memory_order_seq_cst); assert(f.test_and_set() == 0); } diff --git a/test/std/atomics/atomics.flag/init03.pass.cpp b/test/std/atomics/atomics.flag/init03.pass.cpp deleted file mode 100644 index 0910bc5ceccb..000000000000 --- a/test/std/atomics/atomics.flag/init03.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: libcpp-has-no-threads - -// <atomic> - -// struct atomic_flag - -// TESTING EXTENSION atomic_flag(bool) - -#include <atomic> -#include <cassert> - -int main() -{ - std::atomic_flag f(false); - assert(f.test_and_set() == 0); -} diff --git a/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp b/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp new file mode 100644 index 000000000000..e42e9f28448a --- /dev/null +++ b/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp @@ -0,0 +1,101 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: libcpp-has-no-threads, c++98, c++03, c++11, c++14 + +// <atomic> + +// static constexpr bool is_always_lock_free; + +#include <atomic> +#include <cassert> + +#if !defined(__cpp_lib_atomic_is_always_lock_free) +# error Feature test macro missing. +#endif + +template <typename T> void checkAlwaysLockFree() { + if (std::atomic<T>::is_always_lock_free) + assert(std::atomic<T>().is_lock_free()); +} + +int main() +{ +// structs and unions can't be defined in the template invocation. +// Work around this with a typedef. +#define CHECK_ALWAYS_LOCK_FREE(T) \ + do { \ + typedef T type; \ + checkAlwaysLockFree<type>(); \ + } while (0) + + CHECK_ALWAYS_LOCK_FREE(bool); + CHECK_ALWAYS_LOCK_FREE(char); + CHECK_ALWAYS_LOCK_FREE(signed char); + CHECK_ALWAYS_LOCK_FREE(unsigned char); + CHECK_ALWAYS_LOCK_FREE(char16_t); + CHECK_ALWAYS_LOCK_FREE(char32_t); + CHECK_ALWAYS_LOCK_FREE(wchar_t); + CHECK_ALWAYS_LOCK_FREE(short); + CHECK_ALWAYS_LOCK_FREE(unsigned short); + CHECK_ALWAYS_LOCK_FREE(int); + CHECK_ALWAYS_LOCK_FREE(unsigned int); + CHECK_ALWAYS_LOCK_FREE(long); + CHECK_ALWAYS_LOCK_FREE(unsigned long); + CHECK_ALWAYS_LOCK_FREE(long long); + CHECK_ALWAYS_LOCK_FREE(unsigned long long); + CHECK_ALWAYS_LOCK_FREE(std::nullptr_t); + CHECK_ALWAYS_LOCK_FREE(void*); + CHECK_ALWAYS_LOCK_FREE(float); + CHECK_ALWAYS_LOCK_FREE(double); + CHECK_ALWAYS_LOCK_FREE(long double); + CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(1 * sizeof(int))))); + CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(2 * sizeof(int))))); + CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(4 * sizeof(int))))); + CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(16 * sizeof(int))))); + CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(32 * sizeof(int))))); + CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(1 * sizeof(float))))); + CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(2 * sizeof(float))))); + CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(4 * sizeof(float))))); + CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(16 * sizeof(float))))); + CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(32 * sizeof(float))))); + CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(1 * sizeof(double))))); + CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(2 * sizeof(double))))); + CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(4 * sizeof(double))))); + CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(16 * sizeof(double))))); + CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(32 * sizeof(double))))); + CHECK_ALWAYS_LOCK_FREE(struct Empty {}); + CHECK_ALWAYS_LOCK_FREE(struct OneInt { int i; }); + CHECK_ALWAYS_LOCK_FREE(struct IntArr2 { int i[2]; }); + CHECK_ALWAYS_LOCK_FREE(struct LLIArr2 { long long int i[2]; }); + CHECK_ALWAYS_LOCK_FREE(struct LLIArr4 { long long int i[4]; }); + CHECK_ALWAYS_LOCK_FREE(struct LLIArr8 { long long int i[8]; }); + CHECK_ALWAYS_LOCK_FREE(struct LLIArr16 { long long int i[16]; }); + CHECK_ALWAYS_LOCK_FREE(struct Padding { char c; /* padding */ long long int i; }); + CHECK_ALWAYS_LOCK_FREE(union IntFloat { int i; float f; }); + + // C macro and static constexpr must be consistent. + static_assert(std::atomic<bool>::is_always_lock_free == (2 == ATOMIC_BOOL_LOCK_FREE)); + static_assert(std::atomic<char>::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE)); + static_assert(std::atomic<signed char>::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE)); + static_assert(std::atomic<unsigned char>::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE)); + static_assert(std::atomic<char16_t>::is_always_lock_free == (2 == ATOMIC_CHAR16_T_LOCK_FREE)); + static_assert(std::atomic<char32_t>::is_always_lock_free == (2 == ATOMIC_CHAR32_T_LOCK_FREE)); + static_assert(std::atomic<wchar_t>::is_always_lock_free == (2 == ATOMIC_WCHAR_T_LOCK_FREE)); + static_assert(std::atomic<short>::is_always_lock_free == (2 == ATOMIC_SHORT_LOCK_FREE)); + static_assert(std::atomic<unsigned short>::is_always_lock_free == (2 == ATOMIC_SHORT_LOCK_FREE)); + static_assert(std::atomic<int>::is_always_lock_free == (2 == ATOMIC_INT_LOCK_FREE)); + static_assert(std::atomic<unsigned int>::is_always_lock_free == (2 == ATOMIC_INT_LOCK_FREE)); + static_assert(std::atomic<long>::is_always_lock_free == (2 == ATOMIC_LONG_LOCK_FREE)); + static_assert(std::atomic<unsigned long>::is_always_lock_free == (2 == ATOMIC_LONG_LOCK_FREE)); + static_assert(std::atomic<long long>::is_always_lock_free == (2 == ATOMIC_LLONG_LOCK_FREE)); + static_assert(std::atomic<unsigned long long>::is_always_lock_free == (2 == ATOMIC_LLONG_LOCK_FREE)); + static_assert(std::atomic<void*>::is_always_lock_free == (2 == ATOMIC_POINTER_LOCK_FREE)); + static_assert(std::atomic<std::nullptr_t>::is_always_lock_free == (2 == ATOMIC_POINTER_LOCK_FREE)); +} diff --git a/test/std/atomics/atomics.lockfree/lockfree.pass.cpp b/test/std/atomics/atomics.lockfree/lockfree.pass.cpp index a975a69a66ff..0ace9cfe7ba3 100644 --- a/test/std/atomics/atomics.lockfree/lockfree.pass.cpp +++ b/test/std/atomics/atomics.lockfree/lockfree.pass.cpp @@ -11,6 +11,7 @@ // <atomic> +// #define ATOMIC_BOOL_LOCK_FREE unspecified // #define ATOMIC_CHAR_LOCK_FREE unspecified // #define ATOMIC_CHAR16_T_LOCK_FREE unspecified // #define ATOMIC_CHAR32_T_LOCK_FREE unspecified @@ -19,12 +20,16 @@ // #define ATOMIC_INT_LOCK_FREE unspecified // #define ATOMIC_LONG_LOCK_FREE unspecified // #define ATOMIC_LLONG_LOCK_FREE unspecified +// #define ATOMIC_POINTER_LOCK_FREE unspecified #include <atomic> #include <cassert> int main() { + assert(ATOMIC_BOOL_LOCK_FREE == 0 || + ATOMIC_BOOL_LOCK_FREE == 1 || + ATOMIC_BOOL_LOCK_FREE == 2); assert(ATOMIC_CHAR_LOCK_FREE == 0 || ATOMIC_CHAR_LOCK_FREE == 1 || ATOMIC_CHAR_LOCK_FREE == 2); @@ -49,4 +54,7 @@ int main() assert(ATOMIC_LLONG_LOCK_FREE == 0 || ATOMIC_LLONG_LOCK_FREE == 1 || ATOMIC_LLONG_LOCK_FREE == 2); + assert(ATOMIC_POINTER_LOCK_FREE == 0 || + ATOMIC_POINTER_LOCK_FREE == 1 || + ATOMIC_POINTER_LOCK_FREE == 2); } diff --git a/test/std/atomics/atomics.types.generic/address.pass.cpp b/test/std/atomics/atomics.types.generic/address.pass.cpp index eceac25c9d94..137e46b6a155 100644 --- a/test/std/atomics/atomics.types.generic/address.pass.cpp +++ b/test/std/atomics/atomics.types.generic/address.pass.cpp @@ -45,13 +45,13 @@ // T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst); // T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile; // T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst); -// +// // atomic() = default; // constexpr atomic(T* desr); // atomic(const atomic&) = delete; // atomic& operator=(const atomic&) = delete; // atomic& operator=(const atomic&) volatile = delete; -// +// // T* operator=(T*) volatile; // T* operator=(T*); // T* operator++(int) volatile; @@ -122,8 +122,8 @@ do_test() { _ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23}; - A& zero = *new (storage) A(); - assert(zero == 0); + A& zero = *new (storage) A(); + assert(zero == T(0)); zero.~A(); } } diff --git a/test/std/atomics/atomics.types.generic/bool.pass.cpp b/test/std/atomics/atomics.types.generic/bool.pass.cpp index 8eb04ee577cf..e85893d12b8d 100644 --- a/test/std/atomics/atomics.types.generic/bool.pass.cpp +++ b/test/std/atomics/atomics.types.generic/bool.pass.cpp @@ -39,7 +39,7 @@ // memory_order m = memory_order_seq_cst) volatile; // bool compare_exchange_strong(T& expc, T desr, // memory_order m = memory_order_seq_cst); -// +// // atomic() = default; // constexpr atomic(T desr); // atomic(const atomic&) = delete; @@ -227,7 +227,7 @@ int main() { typedef std::atomic<bool> A; _ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1}; - A& zero = *new (storage) A(); + A& zero = *new (storage) A(); assert(zero == false); zero.~A(); } diff --git a/test/std/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp b/test/std/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp index a7874b9f5af4..714fbdc3926b 100644 --- a/test/std/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp +++ b/test/std/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp @@ -19,7 +19,7 @@ // typedef atomic<uint_least32_t> atomic_uint_least32_t; // typedef atomic<int_least64_t> atomic_int_least64_t; // typedef atomic<uint_least64_t> atomic_uint_least64_t; -// +// // typedef atomic<int_fast8_t> atomic_int_fast8_t; // typedef atomic<uint_fast8_t> atomic_uint_fast8_t; // typedef atomic<int_fast16_t> atomic_int_fast16_t; @@ -28,7 +28,7 @@ // typedef atomic<uint_fast32_t> atomic_uint_fast32_t; // typedef atomic<int_fast64_t> atomic_int_fast64_t; // typedef atomic<uint_fast64_t> atomic_uint_fast64_t; -// +// // typedef atomic<intptr_t> atomic_intptr_t; // typedef atomic<uintptr_t> atomic_uintptr_t; // typedef atomic<size_t> atomic_size_t; diff --git a/test/std/atomics/atomics.types.generic/integral.pass.cpp b/test/std/atomics/atomics.types.generic/integral.pass.cpp index 802a37c30a93..a449dc6d5f57 100644 --- a/test/std/atomics/atomics.types.generic/integral.pass.cpp +++ b/test/std/atomics/atomics.types.generic/integral.pass.cpp @@ -41,7 +41,7 @@ // memory_order m = memory_order_seq_cst) volatile; // bool compare_exchange_strong(integral& expc, integral desr, // memory_order m = memory_order_seq_cst); -// +// // integral // fetch_add(integral op, memory_order m = memory_order_seq_cst) volatile; // integral fetch_add(integral op, memory_order m = memory_order_seq_cst); @@ -57,7 +57,7 @@ // integral // fetch_xor(integral op, memory_order m = memory_order_seq_cst) volatile; // integral fetch_xor(integral op, memory_order m = memory_order_seq_cst); -// +// // atomic() = default; // constexpr atomic(integral desr); // atomic(const atomic&) = delete; @@ -65,7 +65,7 @@ // atomic& operator=(const atomic&) volatile = delete; // integral operator=(integral desr) volatile; // integral operator=(integral desr); -// +// // integral operator++(int) volatile; // integral operator++(int); // integral operator--(int) volatile; @@ -152,7 +152,7 @@ do_test() { _ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23}; - A& zero = *new (storage) A(); + A& zero = *new (storage) A(); assert(zero == 0); zero.~A(); } @@ -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>(); } diff --git a/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp b/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp index e8fae85fb4b3..e4deae1bf0d5 100644 --- a/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp +++ b/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp @@ -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), ""); } diff --git a/test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp b/test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp index d940980e32f0..1309f3f1b78b 100644 --- a/test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp +++ b/test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp @@ -37,7 +37,7 @@ // memory_order m = memory_order_seq_cst) volatile noexcept; // bool compare_exchange_strong(T& expc, T desr, // memory_order m = memory_order_seq_cst) noexcept; -// +// // atomic() noexcept = default; // constexpr atomic(T desr) noexcept; // atomic(const atomic&) = delete; diff --git a/test/std/atomics/atomics.types.generic/trivially_copyable.pass.cpp b/test/std/atomics/atomics.types.generic/trivially_copyable.pass.cpp index 5b094f0a89c1..622643f216bd 100644 --- a/test/std/atomics/atomics.types.generic/trivially_copyable.pass.cpp +++ b/test/std/atomics/atomics.types.generic/trivially_copyable.pass.cpp @@ -43,7 +43,7 @@ // memory_order m = memory_order_seq_cst) volatile noexcept; // bool compare_exchange_strong(T& expc, T desr, // memory_order m = memory_order_seq_cst) noexcept; -// +// // atomic() noexcept = default; // constexpr atomic(T desr) noexcept; // atomic(const atomic&) = delete; diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp index 7b221dc6eff8..e40979f45a8f 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp @@ -15,7 +15,7 @@ // template <class T> // bool // atomic_compare_exchange_strong(volatile atomic<T>* obj, T* expc, T desr); -// +// // template <class T> // bool // atomic_compare_exchange_strong(atomic<T>* obj, T* expc, T desr); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp index 27de5bec4928..8ac8fc0c2d0f 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp @@ -17,7 +17,7 @@ // atomic_compare_exchange_strong_explicit(volatile atomic<T>* obj, T* expc, // T desr, // memory_order s, memory_order f); -// +// // template <class T> // bool // atomic_compare_exchange_strong_explicit(atomic<T>* obj, T* expc, T desr, diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp index 8c12715647e8..da0f5c3de43b 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp @@ -15,7 +15,7 @@ // template <class T> // bool // atomic_compare_exchange_weak(volatile atomic<T>* obj, T* expc, T desr); -// +// // template <class T> // bool // atomic_compare_exchange_weak(atomic<T>* obj, T* expc, T desr); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp index 90a93f02b978..b70446bdf7f2 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp @@ -17,7 +17,7 @@ // atomic_compare_exchange_weak_explicit(volatile atomic<T>* obj, T* expc, // T desr, // memory_order s, memory_order f); -// +// // template <class T> // bool // atomic_compare_exchange_weak_explicit(atomic<T>* obj, T* expc, T desr, diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp index 035d974427a4..680fe8f8287b 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp @@ -15,7 +15,7 @@ // template <class T> // T // atomic_exchange(volatile atomic<T>* obj, T desr); -// +// // template <class T> // T // atomic_exchange(atomic<T>* obj, T desr); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp index 4d66bb5f3b81..0df4033c8ba7 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp @@ -15,7 +15,7 @@ // template <class T> // T // atomic_exchange_explicit(volatile atomic<T>* obj, T desr, memory_order m); -// +// // template <class T> // T // atomic_exchange_explicit(atomic<T>* obj, T desr, memory_order m); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp index 48ff601539cf..e30543bdbf45 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp @@ -15,15 +15,15 @@ // template <class Integral> // Integral // atomic_fetch_add(volatile atomic<Integral>* obj, Integral op); -// +// // template <class Integral> // Integral // atomic_fetch_add(atomic<Integral>* obj, Integral op); -// +// // template <class T> // T* // atomic_fetch_add(volatile atomic<T*>* obj, ptrdiff_t op); -// +// // template <class T> // T* // atomic_fetch_add(atomic<T*>* obj, ptrdiff_t op); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp index 57355d30411e..e101029bdacc 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp @@ -14,7 +14,7 @@ // template <class Integral> // Integral // atomic_fetch_and(volatile atomic<Integral>* obj, Integral op); -// +// // template <class Integral> // Integral // atomic_fetch_and(atomic<Integral>* obj, Integral op); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp index 26ff5f65e7db..7180c14d4ba2 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp @@ -14,7 +14,7 @@ // template <class Integral> // Integral // atomic_fetch_and_explicit(volatile atomic<Integral>* obj, Integral op); -// +// // template <class Integral> // Integral // atomic_fetch_and_explicit(atomic<Integral>* obj, Integral op); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp index ca44fdc3217d..241026bcf68c 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp @@ -14,7 +14,7 @@ // template <class Integral> // Integral // atomic_fetch_or(volatile atomic<Integral>* obj, Integral op); -// +// // template <class Integral> // Integral // atomic_fetch_or(atomic<Integral>* obj, Integral op); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp index 72bbde798cb9..c7e0b1232cf2 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp @@ -14,7 +14,7 @@ // template <class Integral> // Integral // atomic_fetch_or_explicit(volatile atomic<Integral>* obj, Integral op); -// +// // template <class Integral> // Integral // atomic_fetch_or_explicit(atomic<Integral>* obj, Integral op); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp index 2743040428c5..e1b12647452b 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp @@ -15,15 +15,15 @@ // template <class Integral> // Integral // atomic_fetch_sub(volatile atomic<Integral>* obj, Integral op); -// +// // template <class Integral> // Integral // atomic_fetch_sub(atomic<Integral>* obj, Integral op); -// +// // template <class T> // T* // atomic_fetch_sub(volatile atomic<T*>* obj, ptrdiff_t op); -// +// // template <class T> // T* // atomic_fetch_sub(atomic<T*>* obj, ptrdiff_t op); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp index 6e94c505fd8c..882a1f2c43b0 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp @@ -20,7 +20,7 @@ // Integral // atomic_fetch_sub_explicit(atomic<Integral>* obj, Integral op, // memory_order m); -// +// // template <class T> // T* // atomic_fetch_sub_explicit(volatile atomic<T*>* obj, ptrdiff_t op, diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp index 42d57dedbd11..9306abfd06c5 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp @@ -14,7 +14,7 @@ // template <class Integral> // Integral // atomic_fetch_xor(volatile atomic<Integral>* obj, Integral op); -// +// // template <class Integral> // Integral // atomic_fetch_xor(atomic<Integral>* obj, Integral op); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp index 8f388fee6325..c6a80a17eef6 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp @@ -14,7 +14,7 @@ // template <class Integral> // Integral // atomic_fetch_xor_explicit(volatile atomic<Integral>* obj, Integral op); -// +// // template <class Integral> // Integral // atomic_fetch_xor_explicit(atomic<Integral>* obj, Integral op); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h index 6cbc0c35c0f5..482b7319dab2 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h @@ -24,10 +24,10 @@ struct UserAtomicType { return x.i == y.i; } }; -template < template <class TestArg> class TestFunctor > +template < template <class TestArg> class TestFunctor > struct TestEachIntegralType { void operator()() const { - TestFunctor<char>()(); + TestFunctor<char>()(); TestFunctor<signed char>()(); TestFunctor<unsigned char>()(); TestFunctor<short>()(); @@ -43,10 +43,18 @@ 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>()(); } }; -template < template <class TestArg> class TestFunctor > +template < template <class TestArg> class TestFunctor > struct TestEachAtomicType { void operator()() const { TestEachIntegralType<TestFunctor>()(); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp index 884c02dfe7ea..2cac65a8348a 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp @@ -15,7 +15,7 @@ // template <class T> // void // atomic_init(volatile atomic<T>* obj, T desr); -// +// // template <class T> // void // atomic_init(atomic<T>* obj, T desr); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp index 5d50016ed32c..27e398736b6b 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp @@ -14,7 +14,7 @@ // template <class T> // bool // atomic_is_lock_free(const volatile atomic<T>* obj); -// +// // template <class T> // bool // atomic_is_lock_free(const atomic<T>* obj); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp index e7b8e64b434f..b6d330cef9d8 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp @@ -15,7 +15,7 @@ // template <class T> // T // atomic_load(const volatile atomic<T>* obj); -// +// // template <class T> // T // atomic_load(const atomic<T>* obj); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp index 56533fa871e5..1208b79026ea 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp @@ -15,7 +15,7 @@ // template <class T> // T // atomic_load_explicit(const volatile atomic<T>* obj, memory_order m); -// +// // template <class T> // T // atomic_load_explicit(const atomic<T>* obj, memory_order m); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp index e61dae904116..3f8245bff6cd 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp @@ -14,7 +14,7 @@ // template <class T> // void // atomic_store(volatile atomic<T>* obj, T desr); -// +// // template <class T> // void // atomic_store(atomic<T>* obj, T desr); diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp index e57cf8b1b323..627a04b74077 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp @@ -14,7 +14,7 @@ // template <class T> // void // atomic_store_explicit(volatile atomic<T>* obj, T desr, memory_order m); -// +// // template <class T> // void // atomic_store_explicit(atomic<T>* obj, T desr, memory_order m); diff --git a/test/std/atomics/version.pass.cpp b/test/std/atomics/version.pass.cpp deleted file mode 100644 index fae2736d229f..000000000000 --- a/test/std/atomics/version.pass.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: libcpp-has-no-threads - -// <atomic> - -#include <atomic> - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} |