[committed] libstdc++: Check feature test macro for jthread in <stop_token>

Jonathan Wakely jwakely@redhat.com
Tue Jun 3 10:27:28 GMT 2025


Check the appropriate feature test macro instead of checking that
__cplusplus >= 201703L.

libstdc++-v3/ChangeLog:

	* include/std/stop_token: Check __glibcxx_jthread instead of
	__cplusplus.
---

Tested x86_64-linux. Pushed to trunk.

 libstdc++-v3/include/std/stop_token | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libstdc++-v3/include/std/stop_token b/libstdc++-v3/include/std/stop_token
index 1225b3afd275..775ec6aa207d 100644
--- a/libstdc++-v3/include/std/stop_token
+++ b/libstdc++-v3/include/std/stop_token
@@ -34,8 +34,7 @@
 #define __glibcxx_want_jthread
 #include <bits/version.h>
 
-#if __cplusplus > 201703L
-
+#ifdef __glibcxx_jthread // C++ >= 20
 #include <atomic>
 #include <bits/std_thread.h>
 
@@ -650,6 +649,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     stop_callback(stop_token, _Callback) -> stop_callback<_Callback>;
 
 _GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
-#endif // __cplusplus > 201703L
+} // namespace std
+#endif // __glibcxx_jthread
 #endif // _GLIBCXX_STOP_TOKEN
-- 
2.49.0



More information about the Libstdc++ mailing list