From 438487e28ef693846b6e89f2dab3144b88b7dfac Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Fri, 16 Feb 2024 10:55:39 -0500 Subject: [PATCH] [libc++] Drop support for the C++20 Synchronization Library before C++20 When we initially implemented the C++20 synchronization library, we reluctantly accepted for the implementation to be backported to C++03 upon request from the person who provided the patch. This was when we were only starting to have experience with the issues this can create, so we flinched. Nowadays, we have a much stricter stance about not backporting features to previous standards. We have recently started fixing several bugs (and near bugs) in our implementation of the synchronization library. A recurring theme during these reviews has been how difficult to undertand the current code is, and upon inspection it becomes clear that being able to use a few recent C++ features (in particular lambdas) would help a great deal. The code would still be pretty intricate, but it would be a lot easier to reason about the flow of callbacks through things like __thread_poll_with_backoff. As a result, this patch drops support for the synchronization library before C++20. This makes us more strictly conforming and opens the door to major simplifications, in particular around atomic_wait which was supported all the way to C++03. This change will probably have some impact on downstream users, however since the C++20 synchronization library was added only in LLVM 10 (~3 years ago) and it's quite a niche feature, the set of people trying to use this part of the library before C++20 should be reasonably small. --- libcxx/.clang-format | 1 - libcxx/docs/ReleaseNotes/20.rst | 4 +- libcxx/include/__atomic/atomic.h | 16 ++-- libcxx/include/__atomic/atomic_base.h | 2 + libcxx/include/__atomic/atomic_flag.h | 38 ++++---- libcxx/include/__config | 8 -- libcxx/include/atomic | 92 +++++++++---------- libcxx/include/barrier | 10 +- libcxx/include/latch | 10 +- libcxx/include/semaphore | 16 ++-- .../general.compile.pass.cpp | 2 + .../pointer.compile.pass.cpp | 2 + .../atomic_notify_all.pass.cpp | 5 +- .../atomic_notify_one.pass.cpp | 5 +- .../atomic_wait.pass.cpp | 5 +- .../atomic_wait_explicit.pass.cpp | 5 +- .../std/thread/thread.barrier/arrive.pass.cpp | 5 +- .../thread.barrier/arrive_and_drop.pass.cpp | 5 +- .../thread.barrier/arrive_and_wait.pass.cpp | 5 +- .../thread/thread.barrier/completion.pass.cpp | 5 +- .../thread.barrier/ctor.compile.pass.cpp | 5 +- .../std/thread/thread.barrier/max.pass.cpp | 5 +- .../thread.latch/arrive_and_wait.pass.cpp | 5 +- .../thread/thread.latch/count_down.pass.cpp | 5 +- .../std/thread/thread.latch/ctor.pass.cpp | 5 +- .../test/std/thread/thread.latch/max.pass.cpp | 5 +- .../std/thread/thread.latch/try_wait.pass.cpp | 5 +- .../thread/thread.semaphore/acquire.pass.cpp | 5 +- .../thread/thread.semaphore/binary.pass.cpp | 5 +- .../thread.semaphore/ctor.compile.pass.cpp | 5 +- .../std/thread/thread.semaphore/max.pass.cpp | 5 +- .../thread/thread.semaphore/release.pass.cpp | 5 +- .../thread/thread.semaphore/timed.pass.cpp | 5 +- .../thread.semaphore/try_acquire.pass.cpp | 5 +- 34 files changed, 120 insertions(+), 191 deletions(-) diff --git a/libcxx/.clang-format b/libcxx/.clang-format index 871920f15b5bc..b2ca452931fec 100644 --- a/libcxx/.clang-format +++ b/libcxx/.clang-format @@ -24,7 +24,6 @@ AttributeMacros: [ '_LIBCPP_CONSTEXPR_SINCE_CXX23', '_LIBCPP_CONSTEXPR', '_LIBCPP_CONSTINIT', - '_LIBCPP_DEPRECATED_ATOMIC_SYNC', '_LIBCPP_DEPRECATED_IN_CXX11', '_LIBCPP_DEPRECATED_IN_CXX14', '_LIBCPP_DEPRECATED_IN_CXX17', diff --git a/libcxx/docs/ReleaseNotes/20.rst b/libcxx/docs/ReleaseNotes/20.rst index f959c8829277e..960fdd7ce0562 100644 --- a/libcxx/docs/ReleaseNotes/20.rst +++ b/libcxx/docs/ReleaseNotes/20.rst @@ -53,7 +53,9 @@ Deprecations and Removals - TODO: The ``LIBCXX_ENABLE_ASSERTIONS`` CMake variable and the ``_LIBCPP_ENABLE_ASSERTIONS`` macro that were used to enable the safe mode will be removed in LLVM 20. -- TODO: The C++20 synchronization library will be removed entirely in language modes prior to C++20 in LLVM 20. +- Support for the C++20 synchronization library (````, ````, ``atomic::wait``, etc.) has been + removed in language modes prior to C++20. If you are using these features prior to C++20, you will need to + update to ``-std=c++20``. - TODO: The relational operators for ``std::chrono::weekday`` will be removed entirely, and the ``_LIBCPP_ENABLE_REMOVED_WEEKDAY_RELATIONAL_OPERATORS`` macro that was used to re-enable this extension will be diff --git a/libcxx/include/__atomic/atomic.h b/libcxx/include/__atomic/atomic.h index bd3f659c22df0..bcea21f5ce2e1 100644 --- a/libcxx/include/__atomic/atomic.h +++ b/libcxx/include/__atomic/atomic.h @@ -429,6 +429,8 @@ _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong_explicit( return __o->compare_exchange_strong(*__e, __d, __s, __f); } +#if _LIBCPP_STD_VER >= 20 + // atomic_wait template @@ -462,29 +464,27 @@ atomic_wait_explicit(const atomic<_Tp>* __o, typename atomic<_Tp>::value_type __ // atomic_notify_one template -_LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void -atomic_notify_one(volatile atomic<_Tp>* __o) _NOEXCEPT { +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_one(volatile atomic<_Tp>* __o) _NOEXCEPT { __o->notify_one(); } template -_LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void -atomic_notify_one(atomic<_Tp>* __o) _NOEXCEPT { +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_one(atomic<_Tp>* __o) _NOEXCEPT { __o->notify_one(); } // atomic_notify_all template -_LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void -atomic_notify_all(volatile atomic<_Tp>* __o) _NOEXCEPT { +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_all(volatile atomic<_Tp>* __o) _NOEXCEPT { __o->notify_all(); } template -_LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void -atomic_notify_all(atomic<_Tp>* __o) _NOEXCEPT { +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_all(atomic<_Tp>* __o) _NOEXCEPT { __o->notify_all(); } +#endif // _LIBCPP_STD_VER >= 20 + // atomic_fetch_add template diff --git a/libcxx/include/__atomic/atomic_base.h b/libcxx/include/__atomic/atomic_base.h index 7e26434c9c3a0..93f5c4cff0d1b 100644 --- a/libcxx/include/__atomic/atomic_base.h +++ b/libcxx/include/__atomic/atomic_base.h @@ -101,6 +101,7 @@ struct __atomic_base // false return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __m, __m); } +#if _LIBCPP_STD_VER >= 20 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT { std::__atomic_wait(*this, __v, __m); @@ -117,6 +118,7 @@ struct __atomic_base // false std::__atomic_notify_all(*this); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { std::__atomic_notify_all(*this); } +#endif // _LIBCPP_STD_VER >= 20 #if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI constexpr __atomic_base() noexcept(is_nothrow_default_constructible_v<_Tp>) : __a_(_Tp()) {} diff --git a/libcxx/include/__atomic/atomic_flag.h b/libcxx/include/__atomic/atomic_flag.h index 00b157cdff78b..abebfc112cb8e 100644 --- a/libcxx/include/__atomic/atomic_flag.h +++ b/libcxx/include/__atomic/atomic_flag.h @@ -48,26 +48,24 @@ struct atomic_flag { __cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m); } - _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void - wait(bool __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT { +#if _LIBCPP_STD_VER >= 20 + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const + volatile _NOEXCEPT { std::__atomic_wait(*this, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m); } - _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT { std::__atomic_wait(*this, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m); } - _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT { - std::__atomic_notify_one(*this); - } - _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT { std::__atomic_notify_one(*this); } + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { std::__atomic_notify_one(*this); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() volatile _NOEXCEPT { std::__atomic_notify_all(*this); } - _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { - std::__atomic_notify_all(*this); - } + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { std::__atomic_notify_all(*this); } +#endif #if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI constexpr atomic_flag() _NOEXCEPT : __a_(false) {} @@ -144,45 +142,45 @@ inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_clear_explicit(atomic_flag* __o, m __o->clear(__m); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void +#if _LIBCPP_STD_VER >= 20 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_wait(const volatile atomic_flag* __o, bool __v) _NOEXCEPT { __o->wait(__v); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_wait(const atomic_flag* __o, bool __v) _NOEXCEPT { __o->wait(__v); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_wait_explicit(const volatile atomic_flag* __o, bool __v, memory_order __m) _NOEXCEPT { __o->wait(__v, __m); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_wait_explicit(const atomic_flag* __o, bool __v, memory_order __m) _NOEXCEPT { __o->wait(__v, __m); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_notify_one(volatile atomic_flag* __o) _NOEXCEPT { __o->notify_one(); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void -atomic_flag_notify_one(atomic_flag* __o) _NOEXCEPT { +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_notify_one(atomic_flag* __o) _NOEXCEPT { __o->notify_one(); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_notify_all(volatile atomic_flag* __o) _NOEXCEPT { __o->notify_all(); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void -atomic_flag_notify_all(atomic_flag* __o) _NOEXCEPT { +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_notify_all(atomic_flag* __o) _NOEXCEPT { __o->notify_all(); } +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__config b/libcxx/include/__config index 0be25a5fd226f..392053a64a8dc 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -699,14 +699,6 @@ typedef __char32_t char32_t; # define _LIBCPP_DEPRECATED_(m) # endif -# if _LIBCPP_STD_VER < 20 -# define _LIBCPP_DEPRECATED_ATOMIC_SYNC \ - _LIBCPP_DEPRECATED_("The C++20 synchronization library has been deprecated prior to C++20. Please update to " \ - "using -std=c++20 if you need to use these facilities.") -# else -# define _LIBCPP_DEPRECATED_ATOMIC_SYNC /* nothing */ -# endif - # if !defined(_LIBCPP_CXX03_LANG) # define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED # else diff --git a/libcxx/include/atomic b/libcxx/include/atomic index 0d13619d6ce45..772ac998615a9 100644 --- a/libcxx/include/atomic +++ b/libcxx/include/atomic @@ -101,12 +101,12 @@ struct atomic bool compare_exchange_strong(T& expc, T desr, memory_order m = memory_order_seq_cst) noexcept; - void wait(T, memory_order = memory_order::seq_cst) const volatile noexcept; - void wait(T, memory_order = memory_order::seq_cst) const noexcept; - void notify_one() volatile noexcept; - void notify_one() noexcept; - void notify_all() volatile noexcept; - void notify_all() noexcept; + void wait(T, memory_order = memory_order::seq_cst) const volatile noexcept; // since C++20 + void wait(T, memory_order = memory_order::seq_cst) const noexcept; // since C++20 + void notify_one() volatile noexcept; // since C++20 + void notify_one() noexcept; // since C++20 + void notify_all() volatile noexcept; // since C++20 + void notify_all() noexcept; // since C++20 }; template <> @@ -184,12 +184,12 @@ struct atomic integral operator^=(integral op) volatile noexcept; integral operator^=(integral op) noexcept; - void wait(integral, memory_order = memory_order::seq_cst) const volatile noexcept; - void wait(integral, memory_order = memory_order::seq_cst) const noexcept; - void notify_one() volatile noexcept; - void notify_one() noexcept; - void notify_all() volatile noexcept; - void notify_all() noexcept; + void wait(integral, memory_order = memory_order::seq_cst) const volatile noexcept; // since C++20 + void wait(integral, memory_order = memory_order::seq_cst) const noexcept; // since C++20 + void notify_one() volatile noexcept; // since C++20 + void notify_one() noexcept; // since C++20 + void notify_all() volatile noexcept; // since C++20 + void notify_all() noexcept; // since C++20 }; template @@ -254,12 +254,12 @@ struct atomic T* operator-=(ptrdiff_t op) volatile noexcept; T* operator-=(ptrdiff_t op) noexcept; - void wait(T*, memory_order = memory_order::seq_cst) const volatile noexcept; - void wait(T*, memory_order = memory_order::seq_cst) const noexcept; - void notify_one() volatile noexcept; - void notify_one() noexcept; - void notify_all() volatile noexcept; - void notify_all() noexcept; + void wait(T*, memory_order = memory_order::seq_cst) const volatile noexcept; // since C++20 + void wait(T*, memory_order = memory_order::seq_cst) const noexcept; // since C++20 + void notify_one() volatile noexcept; // since C++20 + void notify_one() noexcept; // since C++20 + void notify_all() volatile noexcept; // since C++20 + void notify_all() noexcept; // since C++20 }; template<> @@ -321,12 +321,12 @@ struct atomic { // since C++20 floating-point-type operator-=(floating-point-type) volatile noexcept; floating-point-type operator-=(floating-point-type) noexcept; - void wait(floating-point-type, memory_order = memory_order::seq_cst) const volatile noexcept; - void wait(floating-point-type, memory_order = memory_order::seq_cst) const noexcept; - void notify_one() volatile noexcept; - void notify_one() noexcept; - void notify_all() volatile noexcept; - void notify_all() noexcept; + void wait(floating-point-type, memory_order = memory_order::seq_cst) const volatile noexcept; // since C++20 + void wait(floating-point-type, memory_order = memory_order::seq_cst) const noexcept; // since C++20 + void notify_one() volatile noexcept; // since C++20 + void notify_one() noexcept; // since C++20 + void notify_all() volatile noexcept; // since C++20 + void notify_all() noexcept; // since C++20 }; // [atomics.nonmembers], non-member functions @@ -443,23 +443,23 @@ template memory_order) noexcept; template - void atomic_wait(const volatile atomic*, atomic::value_type) noexcept; + void atomic_wait(const volatile atomic*, atomic::value_type) noexcept; // since C++20 template - void atomic_wait(const atomic*, atomic::value_type) noexcept; + void atomic_wait(const atomic*, atomic::value_type) noexcept; // since C++20 template - void atomic_wait_explicit(const volatile atomic*, atomic::value_type, + void atomic_wait_explicit(const volatile atomic*, atomic::value_type, // since C++20 memory_order) noexcept; template - void atomic_wait_explicit(const atomic*, atomic::value_type, + void atomic_wait_explicit(const atomic*, atomic::value_type, // since C++20 memory_order) noexcept; template - void atomic_notify_one(volatile atomic*) noexcept; + void atomic_notify_one(volatile atomic*) noexcept; // since C++20 template - void atomic_notify_one(atomic*) noexcept; + void atomic_notify_one(atomic*) noexcept; // since C++20 template - void atomic_notify_all(volatile atomic*) noexcept; + void atomic_notify_all(volatile atomic*) noexcept; // since C++20 template - void atomic_notify_all(atomic*) noexcept; + void atomic_notify_all(atomic*) noexcept; // since C++20 // Atomics for standard typedef types @@ -534,12 +534,12 @@ typedef struct atomic_flag void clear(memory_order m = memory_order_seq_cst) volatile noexcept; void clear(memory_order m = memory_order_seq_cst) noexcept; - void wait(bool, memory_order = memory_order::seq_cst) const volatile noexcept; - void wait(bool, memory_order = memory_order::seq_cst) const noexcept; - void notify_one() volatile noexcept; - void notify_one() noexcept; - void notify_all() volatile noexcept; - void notify_all() noexcept; + void wait(bool, memory_order = memory_order::seq_cst) const volatile noexcept; // since C++20 + void wait(bool, memory_order = memory_order::seq_cst) const noexcept; // since C++20 + void notify_one() volatile noexcept; // since C++20 + void notify_one() noexcept; // since C++20 + void notify_all() volatile noexcept; // since C++20 + void notify_all() noexcept; // since C++20 } atomic_flag; bool atomic_flag_test(volatile atomic_flag* obj) noexcept; @@ -557,14 +557,14 @@ void atomic_flag_clear(atomic_flag* obj) noexcept; void atomic_flag_clear_explicit(volatile atomic_flag* obj, memory_order m) noexcept; void atomic_flag_clear_explicit(atomic_flag* obj, memory_order m) noexcept; -void atomic_wait(const volatile atomic_flag* obj, T old) noexcept; -void atomic_wait(const atomic_flag* obj, T old) noexcept; -void atomic_wait_explicit(const volatile atomic_flag* obj, T old, memory_order m) noexcept; -void atomic_wait_explicit(const atomic_flag* obj, T old, memory_order m) noexcept; -void atomic_one(volatile atomic_flag* obj) noexcept; -void atomic_one(atomic_flag* obj) noexcept; -void atomic_all(volatile atomic_flag* obj) noexcept; -void atomic_all(atomic_flag* obj) noexcept; +void atomic_wait(const volatile atomic_flag* obj, T old) noexcept; // since C++20 +void atomic_wait(const atomic_flag* obj, T old) noexcept; // since C++20 +void atomic_wait_explicit(const volatile atomic_flag* obj, T old, memory_order m) noexcept; // since C++20 +void atomic_wait_explicit(const atomic_flag* obj, T old, memory_order m) noexcept; // since C++20 +void atomic_one(volatile atomic_flag* obj) noexcept; // since C++20 +void atomic_one(atomic_flag* obj) noexcept; // since C++20 +void atomic_all(volatile atomic_flag* obj) noexcept; // since C++20 +void atomic_all(atomic_flag* obj) noexcept; // since C++20 // fences diff --git a/libcxx/include/barrier b/libcxx/include/barrier index edee181273e24..ba29ebc3212ee 100644 --- a/libcxx/include/barrier +++ b/libcxx/include/barrier @@ -17,7 +17,7 @@ namespace std { template - class barrier + class barrier // since C++20 { public: using arrival_token = see below; @@ -68,7 +68,7 @@ namespace std _LIBCPP_PUSH_MACROS # include <__undef_macros> -# if _LIBCPP_STD_VER >= 14 +# if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -254,7 +254,7 @@ public: # endif // !_LIBCPP_HAS_NO_TREE_BARRIER template -class _LIBCPP_DEPRECATED_ATOMIC_SYNC barrier { +class barrier { __barrier_base<_CompletionF> __b_; public: @@ -290,7 +290,7 @@ public: _LIBCPP_END_NAMESPACE_STD -# endif // _LIBCPP_STD_VER >= 14 +# endif // _LIBCPP_STD_VER >= 20 _LIBCPP_POP_MACROS @@ -305,4 +305,4 @@ _LIBCPP_POP_MACROS # include #endif -#endif //_LIBCPP_BARRIER +#endif // _LIBCPP_BARRIER diff --git a/libcxx/include/latch b/libcxx/include/latch index 81d6028a9c2ce..b56e49bc768bf 100644 --- a/libcxx/include/latch +++ b/libcxx/include/latch @@ -16,7 +16,7 @@ namespace std { - class latch + class latch // since C++20 { public: static constexpr ptrdiff_t max() noexcept; @@ -59,11 +59,11 @@ namespace std _LIBCPP_PUSH_MACROS # include <__undef_macros> -# if _LIBCPP_STD_VER >= 14 +# if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD -class _LIBCPP_DEPRECATED_ATOMIC_SYNC latch { +class latch { __atomic_base __a_; public: @@ -116,7 +116,7 @@ private: _LIBCPP_END_NAMESPACE_STD -# endif // _LIBCPP_STD_VER >= 14 +# endif // _LIBCPP_STD_VER >= 20 _LIBCPP_POP_MACROS @@ -126,4 +126,4 @@ _LIBCPP_POP_MACROS # include #endif -#endif //_LIBCPP_LATCH +#endif // _LIBCPP_LATCH diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore index 95a4375f21c17..bf6317c587e2f 100644 --- a/libcxx/include/semaphore +++ b/libcxx/include/semaphore @@ -16,7 +16,7 @@ namespace std { template -class counting_semaphore +class counting_semaphore // since C++20 { public: static constexpr ptrdiff_t max() noexcept; @@ -39,7 +39,7 @@ private: ptrdiff_t counter; // exposition only }; -using binary_semaphore = counting_semaphore<1>; +using binary_semaphore = counting_semaphore<1>; // since C++20 } @@ -68,7 +68,7 @@ using binary_semaphore = counting_semaphore<1>; _LIBCPP_PUSH_MACROS # include <__undef_macros> -# if _LIBCPP_STD_VER >= 14 +# if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -124,7 +124,7 @@ private: }; template -class _LIBCPP_DEPRECATED_ATOMIC_SYNC counting_semaphore { +class counting_semaphore { __atomic_semaphore_base __semaphore_; public: @@ -169,13 +169,11 @@ public: } }; -_LIBCPP_SUPPRESS_DEPRECATED_PUSH -using binary_semaphore _LIBCPP_DEPRECATED_ATOMIC_SYNC = counting_semaphore<1>; -_LIBCPP_SUPPRESS_DEPRECATED_POP +using binary_semaphore = counting_semaphore<1>; _LIBCPP_END_NAMESPACE_STD -# endif // _LIBCPP_STD_VER >= 14 +# endif // _LIBCPP_STD_VER >= 20 _LIBCPP_POP_MACROS @@ -185,4 +183,4 @@ _LIBCPP_POP_MACROS # include #endif -#endif //_LIBCPP_SEMAPHORE +#endif // _LIBCPP_SEMAPHORE diff --git a/libcxx/test/std/atomics/atomics.types.generic/general.compile.pass.cpp b/libcxx/test/std/atomics/atomics.types.generic/general.compile.pass.cpp index fead6e2e5f6c2..817a70d2ce364 100644 --- a/libcxx/test/std/atomics/atomics.types.generic/general.compile.pass.cpp +++ b/libcxx/test/std/atomics/atomics.types.generic/general.compile.pass.cpp @@ -94,9 +94,11 @@ void test() { TEST_IGNORE_NODISCARD a.compare_exchange_weak(v, v); TEST_IGNORE_NODISCARD a.compare_exchange_strong(v, v, m); +#if TEST_STD_VER >= 20 a.wait(v); a.notify_one(); a.notify_all(); +#endif } void test() { diff --git a/libcxx/test/std/atomics/atomics.types.generic/pointer.compile.pass.cpp b/libcxx/test/std/atomics/atomics.types.generic/pointer.compile.pass.cpp index 961aed3b4fb1a..c62127f3883b0 100644 --- a/libcxx/test/std/atomics/atomics.types.generic/pointer.compile.pass.cpp +++ b/libcxx/test/std/atomics/atomics.types.generic/pointer.compile.pass.cpp @@ -128,9 +128,11 @@ void test() { a += 0; a -= 0; +#if TEST_STD_VER >= 20 a.wait(v); a.notify_one(); a.notify_all(); +#endif } void test() { diff --git a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_notify_all.pass.cpp b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_notify_all.pass.cpp index 0ec530c922e70..fc159b15e78e1 100644 --- a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_notify_all.pass.cpp +++ b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_notify_all.pass.cpp @@ -7,12 +7,9 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: !has-1024-bit-atomics -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS - // XFAIL: availability-synchronization_library-missing // diff --git a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_notify_one.pass.cpp b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_notify_one.pass.cpp index c21b67d479ae2..330d8a44bfc2f 100644 --- a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_notify_one.pass.cpp +++ b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_notify_one.pass.cpp @@ -7,12 +7,9 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: !has-1024-bit-atomics -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS - // XFAIL: availability-synchronization_library-missing // diff --git a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_wait.pass.cpp b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_wait.pass.cpp index af99113f13499..7c5169b64cbe3 100644 --- a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_wait.pass.cpp +++ b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_wait.pass.cpp @@ -7,12 +7,9 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: !has-1024-bit-atomics -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS - // XFAIL: availability-synchronization_library-missing // diff --git a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_wait_explicit.pass.cpp b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_wait_explicit.pass.cpp index bb8c64593b54b..c84eecff3eac4 100644 --- a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_wait_explicit.pass.cpp +++ b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_wait_explicit.pass.cpp @@ -7,12 +7,9 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: !has-1024-bit-atomics -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS - // XFAIL: availability-synchronization_library-missing // diff --git a/libcxx/test/std/thread/thread.barrier/arrive.pass.cpp b/libcxx/test/std/thread/thread.barrier/arrive.pass.cpp index d9d9c1dba6bbb..b1ad6447a9e21 100644 --- a/libcxx/test/std/thread/thread.barrier/arrive.pass.cpp +++ b/libcxx/test/std/thread/thread.barrier/arrive.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: availability-synchronization_library-missing diff --git a/libcxx/test/std/thread/thread.barrier/arrive_and_drop.pass.cpp b/libcxx/test/std/thread/thread.barrier/arrive_and_drop.pass.cpp index aff7b26e16f70..b0d94a8a3f4fe 100644 --- a/libcxx/test/std/thread/thread.barrier/arrive_and_drop.pass.cpp +++ b/libcxx/test/std/thread/thread.barrier/arrive_and_drop.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: availability-synchronization_library-missing diff --git a/libcxx/test/std/thread/thread.barrier/arrive_and_wait.pass.cpp b/libcxx/test/std/thread/thread.barrier/arrive_and_wait.pass.cpp index 8c45ba9278f28..2d747e3c9b9da 100644 --- a/libcxx/test/std/thread/thread.barrier/arrive_and_wait.pass.cpp +++ b/libcxx/test/std/thread/thread.barrier/arrive_and_wait.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: availability-synchronization_library-missing diff --git a/libcxx/test/std/thread/thread.barrier/completion.pass.cpp b/libcxx/test/std/thread/thread.barrier/completion.pass.cpp index 633a0c8bf2366..892e29b9dfa9e 100644 --- a/libcxx/test/std/thread/thread.barrier/completion.pass.cpp +++ b/libcxx/test/std/thread/thread.barrier/completion.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: availability-synchronization_library-missing diff --git a/libcxx/test/std/thread/thread.barrier/ctor.compile.pass.cpp b/libcxx/test/std/thread/thread.barrier/ctor.compile.pass.cpp index fe7068d2a574c..d67cf36c860ea 100644 --- a/libcxx/test/std/thread/thread.barrier/ctor.compile.pass.cpp +++ b/libcxx/test/std/thread/thread.barrier/ctor.compile.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // diff --git a/libcxx/test/std/thread/thread.barrier/max.pass.cpp b/libcxx/test/std/thread/thread.barrier/max.pass.cpp index b09a02e1bdef4..a3ec904897a18 100644 --- a/libcxx/test/std/thread/thread.barrier/max.pass.cpp +++ b/libcxx/test/std/thread/thread.barrier/max.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // diff --git a/libcxx/test/std/thread/thread.latch/arrive_and_wait.pass.cpp b/libcxx/test/std/thread/thread.latch/arrive_and_wait.pass.cpp index 8ca4f37b73b95..23cb2706beb5b 100644 --- a/libcxx/test/std/thread/thread.latch/arrive_and_wait.pass.cpp +++ b/libcxx/test/std/thread/thread.latch/arrive_and_wait.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: availability-synchronization_library-missing diff --git a/libcxx/test/std/thread/thread.latch/count_down.pass.cpp b/libcxx/test/std/thread/thread.latch/count_down.pass.cpp index eb524abd24b98..f33f7b21908d4 100644 --- a/libcxx/test/std/thread/thread.latch/count_down.pass.cpp +++ b/libcxx/test/std/thread/thread.latch/count_down.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: availability-synchronization_library-missing diff --git a/libcxx/test/std/thread/thread.latch/ctor.pass.cpp b/libcxx/test/std/thread/thread.latch/ctor.pass.cpp index bca4561bd2f74..df258b01be33c 100644 --- a/libcxx/test/std/thread/thread.latch/ctor.pass.cpp +++ b/libcxx/test/std/thread/thread.latch/ctor.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // diff --git a/libcxx/test/std/thread/thread.latch/max.pass.cpp b/libcxx/test/std/thread/thread.latch/max.pass.cpp index bcf353ed9712e..4490f94a2dac7 100644 --- a/libcxx/test/std/thread/thread.latch/max.pass.cpp +++ b/libcxx/test/std/thread/thread.latch/max.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // diff --git a/libcxx/test/std/thread/thread.latch/try_wait.pass.cpp b/libcxx/test/std/thread/thread.latch/try_wait.pass.cpp index 8f354463a8697..fa09e5632fbfa 100644 --- a/libcxx/test/std/thread/thread.latch/try_wait.pass.cpp +++ b/libcxx/test/std/thread/thread.latch/try_wait.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: availability-synchronization_library-missing diff --git a/libcxx/test/std/thread/thread.semaphore/acquire.pass.cpp b/libcxx/test/std/thread/thread.semaphore/acquire.pass.cpp index 22eed736c6b75..5a4a0a94b0191 100644 --- a/libcxx/test/std/thread/thread.semaphore/acquire.pass.cpp +++ b/libcxx/test/std/thread/thread.semaphore/acquire.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: availability-synchronization_library-missing diff --git a/libcxx/test/std/thread/thread.semaphore/binary.pass.cpp b/libcxx/test/std/thread/thread.semaphore/binary.pass.cpp index c01c78506587c..b244a9d9eda2a 100644 --- a/libcxx/test/std/thread/thread.semaphore/binary.pass.cpp +++ b/libcxx/test/std/thread/thread.semaphore/binary.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: availability-synchronization_library-missing diff --git a/libcxx/test/std/thread/thread.semaphore/ctor.compile.pass.cpp b/libcxx/test/std/thread/thread.semaphore/ctor.compile.pass.cpp index dcc298ce11ce8..b7c8d5340b982 100644 --- a/libcxx/test/std/thread/thread.semaphore/ctor.compile.pass.cpp +++ b/libcxx/test/std/thread/thread.semaphore/ctor.compile.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // diff --git a/libcxx/test/std/thread/thread.semaphore/max.pass.cpp b/libcxx/test/std/thread/thread.semaphore/max.pass.cpp index 6f3ed5e345e0b..bf6b0f05e64f0 100644 --- a/libcxx/test/std/thread/thread.semaphore/max.pass.cpp +++ b/libcxx/test/std/thread/thread.semaphore/max.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // diff --git a/libcxx/test/std/thread/thread.semaphore/release.pass.cpp b/libcxx/test/std/thread/thread.semaphore/release.pass.cpp index 3c4d179e50433..d068872ea7230 100644 --- a/libcxx/test/std/thread/thread.semaphore/release.pass.cpp +++ b/libcxx/test/std/thread/thread.semaphore/release.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: availability-synchronization_library-missing diff --git a/libcxx/test/std/thread/thread.semaphore/timed.pass.cpp b/libcxx/test/std/thread/thread.semaphore/timed.pass.cpp index 77f15ece221d4..ad3c0fb103790 100644 --- a/libcxx/test/std/thread/thread.semaphore/timed.pass.cpp +++ b/libcxx/test/std/thread/thread.semaphore/timed.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: availability-synchronization_library-missing diff --git a/libcxx/test/std/thread/thread.semaphore/try_acquire.pass.cpp b/libcxx/test/std/thread/thread.semaphore/try_acquire.pass.cpp index ec159daf87a3f..fb6fff3baf4c4 100644 --- a/libcxx/test/std/thread/thread.semaphore/try_acquire.pass.cpp +++ b/libcxx/test/std/thread/thread.semaphore/try_acquire.pass.cpp @@ -7,10 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11 - -// Until we drop support for the synchronization library in C++11/14/17 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// UNSUPPORTED: c++03, c++11, c++14, c++17 // XFAIL: availability-synchronization_library-missing