diff --git a/libcxx/docs/ReleaseNotes/20.rst b/libcxx/docs/ReleaseNotes/20.rst index 93d6027291ad9..a52b074fe4367 100644 --- a/libcxx/docs/ReleaseNotes/20.rst +++ b/libcxx/docs/ReleaseNotes/20.rst @@ -41,6 +41,7 @@ Implemented Papers - P2747R2: ``constexpr`` placement new (`Github `__) - P2609R3: Relaxing Ranges Just A Smidge (`Github `__) - P2985R0: A type trait for detecting virtual base classes (`Github `__) +- ``std::jthread`` and ```` are not guarded behind ``-fexperimental-library`` anymore Improvements and New Features diff --git a/libcxx/docs/Status/Cxx20Papers.csv b/libcxx/docs/Status/Cxx20Papers.csv index ad788d7416fda..b3c26933a9c2a 100644 --- a/libcxx/docs/Status/Cxx20Papers.csv +++ b/libcxx/docs/Status/Cxx20Papers.csv @@ -105,7 +105,7 @@ "`P0553R4 `__","Bit operations","2019-07 (Cologne)","|Complete|","9.0","" "`P0631R8 `__","Math Constants","2019-07 (Cologne)","|Complete|","11.0","" "`P0645R10 `__","Text Formatting","2019-07 (Cologne)","|Complete|","14.0","The implementation was complete since LLVM 14, but the feature-test macro was not set until LLVM 19" -"`P0660R10 `__","Stop Token and Joining Thread, Rev 10.","2019-07 (Cologne)","|Complete|","18.0","The paper is implemented but the features are experimental and can be enabled via ``-fexperimental-library``." +"`P0660R10 `__","Stop Token and Joining Thread, Rev 10.","2019-07 (Cologne)","|Complete|","20.0","The feature was implemented since LLVM 18 but was guarded behind ``-fexperimental-library``." "`P0784R7 `__","More constexpr containers","2019-07 (Cologne)","|Complete|","12.0","" "`P0980R1 `__","Making std::string constexpr","2019-07 (Cologne)","|Complete|","15.0","" "`P1004R2 `__","Making std::vector constexpr","2019-07 (Cologne)","|Complete|","15.0","" diff --git a/libcxx/docs/UserDocumentation.rst b/libcxx/docs/UserDocumentation.rst index 273ca8c09a93e..3651e52ed77a7 100644 --- a/libcxx/docs/UserDocumentation.rst +++ b/libcxx/docs/UserDocumentation.rst @@ -69,9 +69,8 @@ The following features are currently considered experimental and are only provid when ``-fexperimental-library`` is passed: * The parallel algorithms library (```` and the associated algorithms) -* ``std::stop_token``, ``std::stop_source`` and ``std::stop_callback`` -* ``std::jthread`` * ``std::chrono::tzdb`` and related time zone functionality +* ```` .. note:: Experimental libraries are experimental. diff --git a/libcxx/include/__config b/libcxx/include/__config index bccf90d1dbacd..b57a775ad6a4e 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -224,7 +224,6 @@ _LIBCPP_HARDENING_MODE_DEBUG // easier to grep for target specific flags once the feature is complete. # if !defined(_LIBCPP_ENABLE_EXPERIMENTAL) && !defined(_LIBCPP_BUILDING_LIBRARY) # define _LIBCPP_HAS_NO_INCOMPLETE_PSTL -# define _LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN # define _LIBCPP_HAS_NO_EXPERIMENTAL_TZDB # define _LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM # endif diff --git a/libcxx/include/__stop_token/atomic_unique_lock.h b/libcxx/include/__stop_token/atomic_unique_lock.h index 13e59f9f0dce0..8fb70a4bfb510 100644 --- a/libcxx/include/__stop_token/atomic_unique_lock.h +++ b/libcxx/include/__stop_token/atomic_unique_lock.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_GUARD_H -#define _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_GUARD_H +#ifndef _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_LOCK_H +#define _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_LOCK_H #include <__bit/popcount.h> #include <__config> @@ -133,8 +133,8 @@ class _LIBCPP_AVAILABILITY_SYNC __atomic_unique_lock { _LIBCPP_HIDE_FROM_ABI static constexpr auto __set_locked_bit = [](_State __state) { return __state | _LockedBit; }; }; -#endif // _LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_GUARD_H +#endif // _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_LOCK_H diff --git a/libcxx/include/__stop_token/stop_callback.h b/libcxx/include/__stop_token/stop_callback.h index 760cf2bb55b0c..8d7167a5f0346 100644 --- a/libcxx/include/__stop_token/stop_callback.h +++ b/libcxx/include/__stop_token/stop_callback.h @@ -31,7 +31,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS) +#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) template class _LIBCPP_AVAILABILITY_SYNC stop_callback : private __stop_callback_base { @@ -93,10 +93,10 @@ class _LIBCPP_AVAILABILITY_SYNC stop_callback : private __stop_callback_base { template _LIBCPP_AVAILABILITY_SYNC stop_callback(stop_token, _Callback) -> stop_callback<_Callback>; -#endif // _LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS -#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS) +#endif // _LIBCPP___STOP_TOKEN_STOP_CALLBACK_H diff --git a/libcxx/include/__stop_token/stop_source.h b/libcxx/include/__stop_token/stop_source.h index 70697462784ab..7243856ecdd08 100644 --- a/libcxx/include/__stop_token/stop_source.h +++ b/libcxx/include/__stop_token/stop_source.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS) +#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) struct nostopstate_t { explicit nostopstate_t() = default; @@ -84,8 +84,8 @@ class _LIBCPP_AVAILABILITY_SYNC stop_source { __intrusive_shared_ptr<__stop_state> __state_; }; -#endif // _LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS) +#endif // _LIBCPP___STOP_TOKEN_STOP_SOURCE_H diff --git a/libcxx/include/__stop_token/stop_token.h b/libcxx/include/__stop_token/stop_token.h index 1bd75cbbf6f8d..b2569738896a6 100644 --- a/libcxx/include/__stop_token/stop_token.h +++ b/libcxx/include/__stop_token/stop_token.h @@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS) +#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) class _LIBCPP_AVAILABILITY_SYNC stop_token { public: @@ -56,7 +56,7 @@ class _LIBCPP_AVAILABILITY_SYNC stop_token { _LIBCPP_HIDE_FROM_ABI explicit stop_token(const __intrusive_shared_ptr<__stop_state>& __state) : __state_(__state) {} }; -#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS) +#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__thread/jthread.h b/libcxx/include/__thread/jthread.h index b3d5c25fb71c7..d85ad3b9061b8 100644 --- a/libcxx/include/__thread/jthread.h +++ b/libcxx/include/__thread/jthread.h @@ -30,7 +30,7 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> -#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -127,7 +127,7 @@ class _LIBCPP_AVAILABILITY_SYNC jthread { _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_POP_MACROS diff --git a/libcxx/include/condition_variable b/libcxx/include/condition_variable index 5195cd6057dd3..229a2ce103b5e 100644 --- a/libcxx/include/condition_variable +++ b/libcxx/include/condition_variable @@ -173,7 +173,7 @@ public: template bool _LIBCPP_HIDE_FROM_ABI wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __d, _Predicate __pred); -# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) +# if _LIBCPP_STD_VER >= 20 template _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait(_Lock& __lock, stop_token __stoken, _Predicate __pred); @@ -186,7 +186,7 @@ public: _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait_for(_Lock& __lock, stop_token __stoken, const chrono::duration<_Rep, _Period>& __rel_time, _Predicate __pred); -# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) +# endif // _LIBCPP_STD_VER >= 20 }; inline condition_variable_any::condition_variable_any() : __mut_(make_shared()) {} @@ -260,7 +260,7 @@ condition_variable_any::wait_for(_Lock& __lock, const chrono::duration<_Rep, _Pe return wait_until(__lock, chrono::steady_clock::now() + __d, std::move(__pred)); } -# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) +# if _LIBCPP_STD_VER >= 20 template bool condition_variable_any::wait(_Lock& __user_lock, stop_token __stoken, _Predicate __pred) { @@ -341,7 +341,7 @@ bool condition_variable_any::wait_for( return wait_until(__lock, std::move(__stoken), chrono::steady_clock::now() + __rel_time, std::move(__pred)); } -# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) +# endif // _LIBCPP_STD_VER >= 20 _LIBCPP_EXPORTED_FROM_ABI void notify_all_at_thread_exit(condition_variable&, unique_lock); diff --git a/libcxx/include/version b/libcxx/include/version index dc1d3fd268ce8..5d679caac0b3b 100644 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -417,7 +417,7 @@ __cpp_lib_void_t 201411L // # define __cpp_lib_is_layout_compatible 201907L # define __cpp_lib_is_nothrow_convertible 201806L // # define __cpp_lib_is_pointer_interconvertible 201907L -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && _LIBCPP_AVAILABILITY_HAS_SYNC +# if !defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC # define __cpp_lib_jthread 201911L # endif # if !defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC diff --git a/libcxx/modules/std/stop_token.inc b/libcxx/modules/std/stop_token.inc index ad2401747d61c..5daf4609611f8 100644 --- a/libcxx/modules/std/stop_token.inc +++ b/libcxx/modules/std/stop_token.inc @@ -9,7 +9,6 @@ export namespace std { #ifndef _LIBCPP_HAS_NO_THREADS -# ifdef _LIBCPP_ENABLE_EXPERIMENTAL // [stoptoken], class stop_­token using std::stop_token; @@ -22,6 +21,5 @@ export namespace std { // [stopcallback], class template stop_­callback using std::stop_callback; -# endif // _LIBCPP_ENABLE_EXPERIMENTAL -#endif // _LIBCPP_HAS_NO_THREADS +#endif // _LIBCPP_HAS_NO_THREADS } // namespace std diff --git a/libcxx/modules/std/thread.inc b/libcxx/modules/std/thread.inc index 6504a39a7aeae..61e3191f3197b 100644 --- a/libcxx/modules/std/thread.inc +++ b/libcxx/modules/std/thread.inc @@ -15,9 +15,7 @@ export namespace std { using std::swap; // [thread.jthread.class], class jthread -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) using std::jthread; -# endif // [thread.thread.this], namespace this_thread namespace this_thread { diff --git a/libcxx/test/libcxx/experimental/fexperimental-library.compile.pass.cpp b/libcxx/test/libcxx/experimental/fexperimental-library.compile.pass.cpp index 3d50d2347d6bb..fd06886bf2e53 100644 --- a/libcxx/test/libcxx/experimental/fexperimental-library.compile.pass.cpp +++ b/libcxx/test/libcxx/experimental/fexperimental-library.compile.pass.cpp @@ -20,10 +20,6 @@ # error "-fexperimental-library should enable the PSTL" #endif -#ifdef _LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN -# error "-fexperimental-library should enable the stop_token" -#endif - #ifdef _LIBCPP_HAS_NO_EXPERIMENTAL_TZDB # error "-fexperimental-library should enable the chrono TZDB" #endif diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/stop_token.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/stop_token.version.compile.pass.cpp index 0d7811eff907e..49233cda2bd9e 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/stop_token.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/stop_token.version.compile.pass.cpp @@ -44,7 +44,7 @@ #elif TEST_STD_VER == 20 -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) +# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) # ifndef __cpp_lib_jthread # error "__cpp_lib_jthread should be defined in c++20" # endif @@ -53,13 +53,13 @@ # endif # else # ifdef __cpp_lib_jthread -# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" +# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" # endif # endif #elif TEST_STD_VER == 23 -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) +# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) # ifndef __cpp_lib_jthread # error "__cpp_lib_jthread should be defined in c++23" # endif @@ -68,13 +68,13 @@ # endif # else # ifdef __cpp_lib_jthread -# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" +# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" # endif # endif #elif TEST_STD_VER > 23 -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) +# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) # ifndef __cpp_lib_jthread # error "__cpp_lib_jthread should be defined in c++26" # endif @@ -83,7 +83,7 @@ # endif # else # ifdef __cpp_lib_jthread -# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" +# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" # endif # endif diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/thread.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/thread.version.compile.pass.cpp index 1735abb9bdb65..97700235ca21a 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/thread.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/thread.version.compile.pass.cpp @@ -61,7 +61,7 @@ # error "__cpp_lib_formatters should not be defined before c++23" # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) +# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) # ifndef __cpp_lib_jthread # error "__cpp_lib_jthread should be defined in c++20" # endif @@ -70,7 +70,7 @@ # endif # else # ifdef __cpp_lib_jthread -# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" +# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" # endif # endif @@ -89,7 +89,7 @@ # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) +# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) # ifndef __cpp_lib_jthread # error "__cpp_lib_jthread should be defined in c++23" # endif @@ -98,7 +98,7 @@ # endif # else # ifdef __cpp_lib_jthread -# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" +# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" # endif # endif @@ -117,7 +117,7 @@ # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) +# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) # ifndef __cpp_lib_jthread # error "__cpp_lib_jthread should be defined in c++26" # endif @@ -126,7 +126,7 @@ # endif # else # ifdef __cpp_lib_jthread -# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" +# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" # endif # endif diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp index a022c90e166c8..985ffeffab96d 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp @@ -3908,7 +3908,7 @@ # error "__cpp_lib_is_within_lifetime should not be defined before c++26" # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) +# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) # ifndef __cpp_lib_jthread # error "__cpp_lib_jthread should be defined in c++20" # endif @@ -3917,7 +3917,7 @@ # endif # else # ifdef __cpp_lib_jthread -# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" +# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" # endif # endif @@ -5375,7 +5375,7 @@ # error "__cpp_lib_is_within_lifetime should not be defined before c++26" # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) +# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) # ifndef __cpp_lib_jthread # error "__cpp_lib_jthread should be defined in c++23" # endif @@ -5384,7 +5384,7 @@ # endif # else # ifdef __cpp_lib_jthread -# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" +# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" # endif # endif @@ -7199,7 +7199,7 @@ # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) +# if !defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC) # ifndef __cpp_lib_jthread # error "__cpp_lib_jthread should be defined in c++26" # endif @@ -7208,7 +7208,7 @@ # endif # else # ifdef __cpp_lib_jthread -# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" +# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" # endif # endif diff --git a/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp b/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp index 2a73203bde550..eab7a4fb2e51e 100644 --- a/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp +++ b/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp @@ -137,7 +137,7 @@ int main(int argc, char **argv) { case 4: cv.wait_for(mut, wait, pred_function); break; case 5: cv.wait_until(mut, Clock::now() + wait); break; case 6: cv.wait_until(mut, Clock::now() + wait, pred_function); break; -#if TEST_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && _LIBCPP_AVAILABILITY_HAS_SYNC +#if TEST_STD_VER >= 20 && !(defined(_LIBCPP_VERSION) && !_LIBCPP_AVAILABILITY_HAS_SYNC) case 7: cv.wait(mut, std::stop_source{}.get_token(), pred_function); break; case 8: cv.wait_for(mut, std::stop_source{}.get_token(), wait, pred_function); break; case 9: cv.wait_until(mut, std::stop_source{}.get_token(), Clock::now() + wait, pred_function); break; @@ -146,7 +146,7 @@ int main(int argc, char **argv) { case 8: case 9: return 0; -#endif //TEST_STD_VER >=20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) +#endif default: assert(false); } } catch (...) {} diff --git a/libcxx/test/support/make_test_thread.h b/libcxx/test/support/make_test_thread.h index 00190a8a69ce1..7b44b647ac38a 100644 --- a/libcxx/test/support/make_test_thread.h +++ b/libcxx/test/support/make_test_thread.h @@ -28,12 +28,12 @@ namespace support { // but any other test that only creates threads as a side effect of testing should // work if they use the utilities in this file. -template -std::thread make_test_thread(F&& f, Args&& ...args) { - return std::thread(std::forward(f), std::forward(args)...); +template +std::thread make_test_thread(F&& f, Args&&... args) { + return std::thread(std::forward(f), std::forward(args)...); } -#if TEST_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) +#if TEST_STD_VER >= 20 # ifdef _LIBCPP_VERSION # define TEST_AVAILABILITY_SYNC _LIBCPP_AVAILABILITY_SYNC # else diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py index 3bdd3adad15b4..cb5ff770b1196 100755 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -802,8 +802,8 @@ def add_version_header(tc): "name": "__cpp_lib_jthread", "values": {"c++20": 201911}, "headers": ["stop_token", "thread"], - "test_suite_guard": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)", - "libcxx_guard": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && _LIBCPP_AVAILABILITY_HAS_SYNC", + "test_suite_guard": "!defined(_LIBCPP_HAS_NO_THREADS) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)", + "libcxx_guard": "!defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC", }, { "name": "__cpp_lib_latch",