Index: include/__config =================================================================== --- include/__config +++ include/__config @@ -318,6 +318,10 @@ # define _LIBCPP_HAS_IS_BASE_OF #endif +#if __has_extension(c_atomic) +#define _LIBCPP_HAS_C11_ATOMICS +#endif + // Objective-C++ features (opt-in) #if __has_feature(objc_arc) #define _LIBCPP_HAS_OBJC_ARC @@ -751,4 +755,9 @@ #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE #endif +#if (defined(_LIBCPP_HAS_C11_ATOMICS) || _GNUC_VER >= 407) \ + && !defined(_LIBCPP_HAS_NO_THREADS) +#define _LIBCPP_HAS_CXX_ATOMICS +#endif + #endif // _LIBCPP_CONFIG Index: include/atomic =================================================================== --- include/atomic +++ include/atomic @@ -537,11 +537,13 @@ #error is not supported on this single threaded system #else // !_LIBCPP_HAS_NO_THREADS +#ifndef _LIBCPP_HAS_CXX_ATOMICS +#error is not implemented +#endif + _LIBCPP_BEGIN_NAMESPACE_STD -#if !__has_feature(cxx_atomic) && _GNUC_VER < 407 -#error is not implemented -#else +#ifdef _LIBCPP_HAS_CXX_ATOMICS typedef enum memory_order { @@ -549,11 +551,11 @@ memory_order_release, memory_order_acq_rel, memory_order_seq_cst } memory_order; -#if _GNUC_VER >= 407 +#if !defined(_LIBCPP_HAS_C11_ATOMICS) namespace __gcc_atomic { template struct __gcc_atomic_t { - __gcc_atomic_t() _NOEXCEPT {} + __gcc_atomic_t() _NOEXCEPT : __a_value() {} explicit __gcc_atomic_t(_Tp value) _NOEXCEPT : __a_value(value) {} _Tp __a_value; }; @@ -573,7 +575,7 @@ sizeof(__test_atomic_assignable<_Tp, _Td>(1)) == sizeof(char); }; -static inline constexpr int __to_gcc_order(memory_order __order) { +static inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) { // Avoid switch statement to make this a constexpr. return __order == memory_order_relaxed ? __ATOMIC_RELAXED: (__order == memory_order_acquire ? __ATOMIC_ACQUIRE: @@ -583,7 +585,7 @@ __ATOMIC_CONSUME)))); } -static inline constexpr int __to_gcc_failure_order(memory_order __order) { +static inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) { // Avoid switch statement to make this a constexpr. return __order == memory_order_relaxed ? __ATOMIC_RELAXED: (__order == memory_order_acquire ? __ATOMIC_ACQUIRE: @@ -633,10 +635,6 @@ __atomic_signal_fence(__gcc_atomic::__to_gcc_order(__order)); } -static inline bool __c11_atomic_is_lock_free(size_t __size) { - return __atomic_is_lock_free(__size, 0); -} - template static inline void __c11_atomic_store(volatile _Atomic(_Tp)* __a, _Tp __val, memory_order __order) { @@ -808,7 +806,7 @@ return __atomic_fetch_xor(&__a->__a_value, __pattern, __gcc_atomic::__to_gcc_order(__order)); } -#endif // _GNUC_VER >= 407 +#endif // !defined(_LIBCPP_HAS_NO_C11_ATOMICS) template inline _LIBCPP_INLINE_VISIBILITY @@ -827,10 +825,20 @@ _LIBCPP_INLINE_VISIBILITY bool is_lock_free() const volatile _NOEXCEPT - {return __c11_atomic_is_lock_free(sizeof(_Tp));} + { +#ifdef _LIBCPP_HAS_C11_ATOMICS + return __c11_atomic_is_lock_free(sizeof(_Tp)); +#else + return __atomic_is_lock_free(sizeof(_Tp), 0); +#endif + } + _LIBCPP_INLINE_VISIBILITY bool is_lock_free() const _NOEXCEPT - {return __c11_atomic_is_lock_free(sizeof(_Tp));} + { + return static_cast<__atomic_base const volatile*>(this)->is_lock_free(); + } + _LIBCPP_INLINE_VISIBILITY void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {__c11_atomic_store(&__a_, __d, __m);} @@ -1773,8 +1781,10 @@ typedef atomic atomic_intmax_t; typedef atomic atomic_uintmax_t; +#if _LIBCPP_STD_VER >= 11 #define ATOMIC_FLAG_INIT {false} #define ATOMIC_VAR_INIT(__v) {__v} +#endif // lock-free property @@ -1789,10 +1799,10 @@ #define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE #define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE -#endif // !__has_feature(cxx_atomic) +#endif // _LIBCPP_HAS_C11_ATOMICS _LIBCPP_END_NAMESPACE_STD -#endif // !_LIBCPP_HAS_NO_THREADS +#endif // _LIBCPP_HAS_CXX_ATOMICS #endif // _LIBCPP_ATOMIC Index: include/ios =================================================================== --- include/ios +++ include/ios @@ -216,7 +216,7 @@ #include <__locale> #include -#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS) +#ifdef _LIBCPP_HAS_CXX_ATOMICS #include // for __xindex_ #endif @@ -367,7 +367,7 @@ int* __index_; size_t __event_size_; size_t __event_cap_; -#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS) +#ifdef _LIBCPP_HAS_CXX_ATOMICS static atomic __xindex_; #else static int __xindex_; Index: include/memory =================================================================== --- include/memory +++ include/memory @@ -610,7 +610,7 @@ #include #endif -#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS) +#ifdef _LIBCPP_HAS_CXX_ATOMICS # include #endif @@ -5332,7 +5332,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p); -#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS) +#ifdef _LIBCPP_HAS_CXX_ATOMICS class _LIBCPP_TYPE_VIS __sp_mut { @@ -5458,7 +5458,7 @@ return atomic_compare_exchange_weak(__p, __v, __w); } -#endif // __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS) +#endif // defined(_LIBCPP_HAS_CXX_ATOMICS) //enum class struct _LIBCPP_TYPE_VIS pointer_safety Index: src/ios.cpp =================================================================== --- src/ios.cpp +++ src/ios.cpp @@ -152,7 +152,7 @@ } // xalloc -#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS) +#ifdef _LIBCPP_HAS_CXX_ATOMICS atomic ios_base::__xindex_ = ATOMIC_VAR_INIT(0); #else int ios_base::__xindex_ = 0; Index: src/memory.cpp =================================================================== --- src/memory.cpp +++ src/memory.cpp @@ -121,7 +121,7 @@ #endif // _LIBCPP_NO_RTTI -#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS) +#ifdef _LIBCPP_HAS_CXX_ATOMICS static const std::size_t __sp_mut_count = 16; static pthread_mutex_t mut_back_imp[__sp_mut_count] = @@ -174,7 +174,7 @@ return muts[hash()(p) & (__sp_mut_count-1)]; } -#endif // __has_feature(cxx_atomic) && !_LIBCPP_HAS_NO_THREADS +#endif // _LIBCPP_HAS_CXX_ATOMICS void declare_reachable(void*) Index: test/libcxx/atomics/init_macros.pass.cpp =================================================================== --- /dev/null +++ test/libcxx/atomics/init_macros.pass.cpp @@ -0,0 +1,40 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +// + +#include + +#if __cplusplus >= 201103L +# +# ifndef ATOMIC_VAR_INIT +# error ATOMIC_VAR_INIT should be defined +# endif +# +# ifndef ATOMIC_FLAG_INIT +# error ATOMIC_FLAG_INIT should be defined +# endif +# +#else // C++03 +# +# ifndef ATOMIC_VAR_INIT +# error ATOMIC_VAR_INIT should not be defined +# endif +# +# ifndef ATOMIC_FLAG_INIT +# error ATOMIC_FLAG_INIT should not be defined +# endif +# +#endif + +int main() +{ +} Index: test/libcxx/atomics/libcpp-has-no-threads.fail.cpp =================================================================== --- /dev/null +++ test/libcxx/atomics/libcpp-has-no-threads.fail.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// Test that including fails to compile when _LIBCPP_HAS_NO_THREADS +// is defined. + +#ifndef _LIBCPP_HAS_NO_THREADS +#define _LIBCPP_HAS_NO_THREADS +#endif + +#include + +int main() +{ +} Index: test/libcxx/atomics/libcpp-has-no-threads.pass.cpp =================================================================== --- /dev/null +++ test/libcxx/atomics/libcpp-has-no-threads.pass.cpp @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// +// XFAIL: libcpp-has-no-threads + +#ifdef _LIBCPP_HAS_NO_THREADS +#error This should be XFAIL'd for the purpose of detecting that the LIT feature\ + 'libcpp-has-no-threads' is available iff _LIBCPP_HAS_NO_THREADS is defined +#endif + +int main() +{ +} Index: test/libcxx/atomics/version.pass.cpp =================================================================== --- /dev/null +++ test/libcxx/atomics/version.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +// + +#include + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} Index: test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp =================================================================== --- test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp +++ test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp @@ -22,13 +22,15 @@ int main() { { - std::atomic_flag f = ATOMIC_FLAG_INIT; + 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 = ATOMIC_FLAG_INIT; + volatile std::atomic_flag f; + f.clear(); f.test_and_set(); atomic_flag_clear(&f); assert(f.test_and_set() == 0); Index: test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp =================================================================== --- test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp +++ test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp @@ -22,37 +22,43 @@ int main() { { - std::atomic_flag f = ATOMIC_FLAG_INIT; + std::atomic_flag f; + f.clear(); f.test_and_set(); atomic_flag_clear_explicit(&f, std::memory_order_relaxed); assert(f.test_and_set() == 0); } { - std::atomic_flag f = ATOMIC_FLAG_INIT; + std::atomic_flag f; + f.clear(); f.test_and_set(); atomic_flag_clear_explicit(&f, std::memory_order_release); assert(f.test_and_set() == 0); } { - std::atomic_flag f = ATOMIC_FLAG_INIT; + std::atomic_flag f; + f.clear(); f.test_and_set(); atomic_flag_clear_explicit(&f, std::memory_order_seq_cst); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f = ATOMIC_FLAG_INIT; + volatile std::atomic_flag f; + f.clear(); f.test_and_set(); atomic_flag_clear_explicit(&f, std::memory_order_relaxed); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f = ATOMIC_FLAG_INIT; + volatile std::atomic_flag f; + f.clear(); f.test_and_set(); atomic_flag_clear_explicit(&f, std::memory_order_release); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f = ATOMIC_FLAG_INIT; + volatile std::atomic_flag f; + f.clear(); f.test_and_set(); atomic_flag_clear_explicit(&f, std::memory_order_seq_cst); assert(f.test_and_set() == 0); Index: test/std/atomics/atomics.flag/clear.pass.cpp =================================================================== --- test/std/atomics/atomics.flag/clear.pass.cpp +++ test/std/atomics/atomics.flag/clear.pass.cpp @@ -22,49 +22,57 @@ int main() { { - std::atomic_flag f = ATOMIC_FLAG_INIT; + std::atomic_flag f; + f.clear(); f.test_and_set(); f.clear(); assert(f.test_and_set() == 0); } { - std::atomic_flag f = ATOMIC_FLAG_INIT; + std::atomic_flag f; + f.clear(); f.test_and_set(); f.clear(std::memory_order_relaxed); assert(f.test_and_set() == 0); } { - std::atomic_flag f = ATOMIC_FLAG_INIT; + std::atomic_flag f; + f.clear(); f.test_and_set(); f.clear(std::memory_order_release); assert(f.test_and_set() == 0); } { - std::atomic_flag f = ATOMIC_FLAG_INIT; + std::atomic_flag f; + f.clear(); f.test_and_set(); f.clear(std::memory_order_seq_cst); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f = ATOMIC_FLAG_INIT; + volatile std::atomic_flag f; + f.clear(); f.test_and_set(); f.clear(); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f = ATOMIC_FLAG_INIT; + volatile std::atomic_flag f; + f.clear(); f.test_and_set(); f.clear(std::memory_order_relaxed); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f = ATOMIC_FLAG_INIT; + volatile std::atomic_flag f; + f.clear(); f.test_and_set(); f.clear(std::memory_order_release); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f = ATOMIC_FLAG_INIT; + volatile std::atomic_flag f; + f.clear(); f.test_and_set(); f.clear(std::memory_order_seq_cst); assert(f.test_and_set() == 0); Index: test/std/atomics/atomics.flag/init.pass.cpp =================================================================== --- test/std/atomics/atomics.flag/init.pass.cpp +++ test/std/atomics/atomics.flag/init.pass.cpp @@ -9,6 +9,10 @@ // // UNSUPPORTED: libcpp-has-no-threads +// TODO: ATOMIC_FLAG_INIT is not defined before C++11 because it cannot be +// implemented. +// UNSUPPORTED: c++98, c++03 + // // struct atomic_flag Index: test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp =================================================================== --- test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp +++ test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp @@ -47,6 +47,10 @@ // T operator=(T) noexcept; // }; +// TODO: There is currently no way to check if a type if trivially copyable +// using GCC. +// XFAIL: gcc + #include #include #include Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp @@ -23,6 +23,7 @@ #include #include #include +#include "test_macros.h" template void @@ -58,7 +59,7 @@ { int i; - explicit A(int d = 0) noexcept {i=d;} + explicit A(int d = 0) TEST_NOEXCEPT {i=d;} friend bool operator==(const A& x, const A& y) {return x.i == y.i;} Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp @@ -26,6 +26,7 @@ #include #include #include +#include "test_macros.h" template void @@ -65,7 +66,7 @@ { int i; - explicit A(int d = 0) noexcept {i=d;} + explicit A(int d = 0) TEST_NOEXCEPT {i=d;} friend bool operator==(const A& x, const A& y) {return x.i == y.i;} Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp @@ -26,6 +26,8 @@ #include +#include "test_macros.h" + template void test() @@ -60,7 +62,7 @@ { int i; - explicit A(int d = 0) noexcept {i=d;} + explicit A(int d = 0) TEST_NOEXCEPT {i=d;} friend bool operator==(const A& x, const A& y) {return x.i == y.i;} Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp @@ -29,6 +29,8 @@ #include +#include "test_macros.h" + template void test() @@ -67,7 +69,7 @@ { int i; - explicit A(int d = 0) noexcept {i=d;} + explicit A(int d = 0) TEST_NOEXCEPT {i=d;} friend bool operator==(const A& x, const A& y) {return x.i == y.i;} Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp @@ -24,6 +24,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -43,7 +45,7 @@ { int i; - explicit A(int d = 0) noexcept {i=d;} + explicit A(int d = 0) TEST_NOEXCEPT {i=d;} friend bool operator==(const A& x, const A& y) {return x.i == y.i;} Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp @@ -24,6 +24,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -45,7 +47,7 @@ { int i; - explicit A(int d = 0) noexcept {i=d;} + explicit A(int d = 0) TEST_NOEXCEPT {i=d;} friend bool operator==(const A& x, const A& y) {return x.i == y.i;} Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp @@ -32,6 +32,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -78,7 +80,7 @@ { int i; - explicit A(int d = 0) noexcept {i=d;} + explicit A(int d = 0) TEST_NOEXCEPT {i=d;} A(const A& a) : i(a.i) {} A(const volatile A& a) : i(a.i) {} Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp @@ -32,6 +32,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -82,7 +84,7 @@ { int i; - explicit A(int d = 0) noexcept {i=d;} + explicit A(int d = 0) TEST_NOEXCEPT {i=d;} A(const A& a) : i(a.i) {} A(const volatile A& a) : i(a.i) {} Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp @@ -32,6 +32,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -78,7 +80,7 @@ { int i; - explicit A(int d = 0) noexcept {i=d;} + explicit A(int d = 0) TEST_NOEXCEPT {i=d;} A(const A& a) : i(a.i) {} A(const volatile A& a) : i(a.i) {} Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp @@ -33,6 +33,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -83,7 +85,7 @@ { int i; - explicit A(int d = 0) noexcept {i=d;} + explicit A(int d = 0) TEST_NOEXCEPT {i=d;} A(const A& a) : i(a.i) {} A(const volatile A& a) : i(a.i) {} Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp @@ -24,6 +24,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -41,7 +43,7 @@ { int i; - explicit A(int d = 0) noexcept {i=d;} + explicit A(int d = 0) TEST_NOEXCEPT {i=d;} friend bool operator==(const A& x, const A& y) {return x.i == y.i;} Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp @@ -24,6 +24,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -41,7 +43,7 @@ { int i; - explicit A(int d = 0) noexcept {i=d;} + explicit A(int d = 0) TEST_NOEXCEPT {i=d;} friend bool operator==(const A& x, const A& y) {return x.i == y.i;} Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp @@ -24,6 +24,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -41,7 +43,7 @@ { int i; - explicit A(int d = 0) noexcept {i=d;} + explicit A(int d = 0) TEST_NOEXCEPT {i=d;} friend bool operator==(const A& x, const A& y) {return x.i == y.i;} Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp @@ -24,6 +24,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -41,7 +43,7 @@ { int i; - explicit A(int d = 0) noexcept {i=d;} + explicit A(int d = 0) TEST_NOEXCEPT {i=d;} friend bool operator==(const A& x, const A& y) {return x.i == y.i;} Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp @@ -24,6 +24,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -41,7 +43,7 @@ { int i; - explicit A(int d = 0) noexcept {i=d;} + explicit A(int d = 0) TEST_NOEXCEPT {i=d;} friend bool operator==(const A& x, const A& y) {return x.i == y.i;} Index: test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp =================================================================== --- test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp +++ test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp @@ -9,6 +9,10 @@ // // UNSUPPORTED: libcpp-has-no-threads +// TODO: ATOMIC_VAR_INIT is not defined before C++11 because it cannot be +// implemented. +// UNSUPPORTED: c++98, c++03 + // // #define ATOMIC_VAR_INIT(value) Index: test/std/atomics/libcpp-has-no-threads.fail.cpp =================================================================== --- test/std/atomics/libcpp-has-no-threads.fail.cpp +++ /dev/null @@ -1,23 +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. -// -//===----------------------------------------------------------------------===// - -// - -// Test that including fails to compile when _LIBCPP_HAS_NO_THREADS -// is defined. - -#ifndef _LIBCPP_HAS_NO_THREADS -#define _LIBCPP_HAS_NO_THREADS -#endif - -#include - -int main() -{ -} Index: test/std/atomics/libcpp-has-no-threads.pass.cpp =================================================================== --- test/std/atomics/libcpp-has-no-threads.pass.cpp +++ /dev/null @@ -1,18 +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. -// -//===----------------------------------------------------------------------===// -// XFAIL: libcpp-has-no-threads - -#ifdef _LIBCPP_HAS_NO_THREADS -#error This should be XFAIL'd for the purpose of detecting that the LIT feature\ - 'libcpp-has-no-threads' is available iff _LIBCPP_HAS_NO_THREADS is defined -#endif - -int main() -{ -} Index: test/std/atomics/version.pass.cpp =================================================================== --- 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 - -// - -#include - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp =================================================================== --- test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp +++ test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp @@ -28,7 +28,6 @@ int main() { -#if __has_feature(cxx_atomic) { std::shared_ptr p(new int(4)); std::shared_ptr v(new int(3)); @@ -49,5 +48,4 @@ assert(*v == 4); assert(*w == 2); } -#endif } Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp =================================================================== --- test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp +++ test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp @@ -29,7 +29,6 @@ int main() { -#if __has_feature(cxx_atomic) { std::shared_ptr p(new int(4)); std::shared_ptr v(new int(3)); @@ -54,5 +53,4 @@ assert(*v == 4); assert(*w == 2); } -#endif } Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp =================================================================== --- test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp +++ test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp @@ -28,7 +28,6 @@ int main() { -#if __has_feature(cxx_atomic) { std::shared_ptr p(new int(4)); std::shared_ptr v(new int(3)); @@ -49,5 +48,4 @@ assert(*v == 4); assert(*w == 2); } -#endif } Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp =================================================================== --- test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp +++ test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp @@ -29,7 +29,6 @@ int main() { -#if __has_feature(cxx_atomic) { std::shared_ptr p(new int(4)); std::shared_ptr v(new int(3)); @@ -54,5 +53,4 @@ assert(*v == 4); assert(*w == 2); } -#endif } Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp =================================================================== --- test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp +++ test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp @@ -27,7 +27,6 @@ int main() { -#if __has_feature(cxx_atomic) { std::shared_ptr p(new int(4)); std::shared_ptr r(new int(3)); @@ -35,5 +34,4 @@ assert(*p == 3); assert(*r == 4); } -#endif } Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp =================================================================== --- test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp +++ test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp @@ -27,7 +27,6 @@ int main() { -#if __has_feature(cxx_atomic) { std::shared_ptr p(new int(4)); std::shared_ptr r(new int(3)); @@ -35,5 +34,4 @@ assert(*p == 3); assert(*r == 4); } -#endif } Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp =================================================================== --- test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp +++ test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp @@ -22,10 +22,8 @@ int main() { -#if __has_feature(cxx_atomic) { const std::shared_ptr p(new int(3)); assert(std::atomic_is_lock_free(&p) == false); } -#endif } Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp =================================================================== --- test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp +++ test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp @@ -27,11 +27,9 @@ int main() { -#if __has_feature(cxx_atomic) { std::shared_ptr p(new int(3)); std::shared_ptr q = std::atomic_load(&p); assert(*q == *p); } -#endif } Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp =================================================================== --- test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp +++ test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp @@ -27,11 +27,9 @@ int main() { -#if __has_feature(cxx_atomic) { const std::shared_ptr p(new int(3)); std::shared_ptr q = std::atomic_load_explicit(&p, std::memory_order_relaxed); assert(*q == *p); } -#endif } Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp =================================================================== --- test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp +++ test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp @@ -27,12 +27,10 @@ int main() { -#if __has_feature(cxx_atomic) { std::shared_ptr p; std::shared_ptr r(new int(3)); std::atomic_store(&p, r); assert(*p == *r); } -#endif } Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp =================================================================== --- test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp +++ test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp @@ -27,12 +27,10 @@ int main() { -#if __has_feature(cxx_atomic) { std::shared_ptr p; std::shared_ptr r(new int(3)); std::atomic_store_explicit(&p, r, std::memory_order_seq_cst); assert(*p == *r); } -#endif }