Tested x86_64-pc-linux-gnu, committed to trunk. Jonathan Wakely writes:
> On 30/11/20 10:17 -0800, Thomas Rodgers wrote: >>From: Thomas Rodgers <trodg...@redhat.com> >> >>Adds __cpp_lib_atomic_wait feature test macro which was overlooked in >>the initial commit of this feature. Replaces uses of >>_GLIBCXX_HAVE_ATOMIC_WAIT. >> >>libstdc++-v3/ChangeLog: >> >> * include/bits/atomic_base.h: Replace usage of >> _GLIBCXX_HAVE_ATOMIC_WAIT with __cpp_lib_atomic_wait. >> * include/bits/atomic_timed_wait.h: Likewise. >> * include/bits/atomic_wait.h: Define __cpp_lib_atomic_wait >> feature test macro. >> * include/bits/semaphore_base: Replace usage of >> _GLIBCXX_HAVE_ATOMIC_WAIT with __cpp_lib_atomic_wait. >> * include/std/atomic: Likewise. >> * include/std/latch: Likewise. >> * include/std/semaphore: Likewise. >> * include/std/version: Define __cpp_lib_atomic wait >> feature test macro and replace usage of >> _GLIBCXX_HAVE_ATOMIC_WAIT. >> * testsuite/29_atomics/atomic/wait_notify/1.cc: New test. >> * testsuite/29_atomics/atomic/wait_notify/2.cc: Likewise. >> >>--- >> libstdc++-v3/include/bits/atomic_base.h | 36 +++++++++---------- >> libstdc++-v3/include/bits/atomic_timed_wait.h | 5 +-- >> libstdc++-v3/include/bits/atomic_wait.h | 3 +- >> libstdc++-v3/include/bits/semaphore_base.h | 4 +-- >> libstdc++-v3/include/std/atomic | 16 ++++----- >> libstdc++-v3/include/std/latch | 4 +-- >> libstdc++-v3/include/std/semaphore | 4 +-- >> libstdc++-v3/include/std/version | 7 ++-- >> .../29_atomics/atomic/wait_notify/1.cc | 28 +++++++++++++++ >> .../29_atomics/atomic/wait_notify/2.cc | 29 +++++++++++++++ >> 10 files changed, 98 insertions(+), 38 deletions(-) >> create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic/wait_notify/1.cc >> create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic/wait_notify/2.cc >> >>diff --git a/libstdc++-v3/include/bits/atomic_base.h >>b/libstdc++-v3/include/bits/atomic_base.h >>index d0d962d3047..ad4e24b4d20 100644 >>--- a/libstdc++-v3/include/bits/atomic_base.h >>+++ b/libstdc++-v3/include/bits/atomic_base.h >>@@ -230,7 +230,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> return __v == __GCC_ATOMIC_TEST_AND_SET_TRUEVAL; >> } >> >>-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT >>+#ifdef __cpp_lib_atomic_wait > > I've not always been consistent about using #if or #ifdef for > __cpp_lib macros, but let's not make that worse in a single patch. I > think we should just use #if for __cpp_lib macros. That affects > several places in the patch. > >> _GLIBCXX_ALWAYS_INLINE void >> wait(bool __old, >> memory_order __m = memory_order_seq_cst) const noexcept >>@@ -253,7 +253,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> { std::__atomic_notify(&_M_i, true); } >> >> // TODO add const volatile overload >>-#endif // HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> #endif // C++20 >> >> _GLIBCXX_ALWAYS_INLINE void >>@@ -604,7 +604,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> __cmpexch_failure_order(__m)); >> } >> >>-#if __cplusplus > 201703L && defined _GLIBCXX_HAVE_ATOMIC_WAIT >>+#if __cpp_lib_atomic_wait >> _GLIBCXX_ALWAYS_INLINE void >> wait(__int_type __old, >> memory_order __m = memory_order_seq_cst) const noexcept >>@@ -627,7 +627,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> { std::__atomic_notify(&_M_i, true); } >> >> // TODO add const volatile overload >>-#endif // C++20 && HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> >> _GLIBCXX_ALWAYS_INLINE __int_type >> fetch_add(__int_type __i, >>@@ -898,7 +898,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> int(__m1), int(__m2)); >> } >> >>-#if __cplusplus > 201703L && defined _GLIBCXX_HAVE_ATOMIC_WAIT >>+#if __cpp_lib_atomic_wait >> _GLIBCXX_ALWAYS_INLINE void >> wait(__pointer_type __old, >> memory_order __m = memory_order_seq_cst) noexcept >>@@ -921,7 +921,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> { std::__atomic_notify(&_M_p, true); } >> >> // TODO add const volatile overload >>-#endif // C++20 && HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> >> _GLIBCXX_ALWAYS_INLINE __pointer_type >> fetch_add(ptrdiff_t __d, >>@@ -1011,7 +1011,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> int(__success), int(__failure)); >> } >> >>-#if __cplusplus > 201703L && defined _GLIBCXX_HAVE_ATOMIC_WAIT >>+#if __cpp_lib_atomic_wait >> template<typename _Tp> >> _GLIBCXX_ALWAYS_INLINE void >> wait(const _Tp* __ptr, _Val<_Tp> __old, >>@@ -1036,7 +1036,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> { std::__atomic_notify(__ptr, true); } >> >> // TODO add const volatile overload >>-#endif // C++20 && HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> >> template<typename _Tp> >> _GLIBCXX_ALWAYS_INLINE _Tp >>@@ -1291,7 +1291,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> __cmpexch_failure_order(__order)); >> } >> >>-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT >>+#ifdef __cpp_lib_atomic_wait >> _GLIBCXX_ALWAYS_INLINE void >> wait(_Fp __old, memory_order __m = memory_order_seq_cst) const noexcept >> { __atomic_impl::wait(&_M_fp, __old, __m); } >>@@ -1309,7 +1309,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> { __atomic_impl::notify_all(&_M_fp); } >> >> // TODO add const volatile overload >>-#endif // HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> >> value_type >> fetch_add(value_type __i, >>@@ -1448,7 +1448,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> __cmpexch_failure_order(__order)); >> } >> >>-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT >>+#ifdef __cpp_lib_atomic_wait >> _GLIBCXX_ALWAYS_INLINE void >> wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept >> { __atomic_impl::wait(_M_ptr, __old, __m); } >>@@ -1466,7 +1466,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> { __atomic_impl::notify_all(_M_ptr); } >> >> // TODO add const volatile overload >>-#endif // HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> >> private: >> _Tp* _M_ptr; >>@@ -1563,7 +1563,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> __cmpexch_failure_order(__order)); >> } >> >>-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT >>+#ifdef __cpp_lib_atomic_wait >> _GLIBCXX_ALWAYS_INLINE void >> wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept >> { __atomic_impl::wait(_M_ptr, __old, __m); } >>@@ -1581,7 +1581,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> { __atomic_impl::notify_all(_M_ptr); } >> >> // TODO add const volatile overload >>-#endif // HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> >> value_type >> fetch_add(value_type __i, >>@@ -1738,7 +1738,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> __cmpexch_failure_order(__order)); >> } >> >>-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT >>+#ifdef __cpp_lib_atomic_wait >> _GLIBCXX_ALWAYS_INLINE void >> wait(_Fp __old, memory_order __m = memory_order_seq_cst) const noexcept >> { __atomic_impl::wait(_M_ptr, __old, __m); } >>@@ -1756,7 +1756,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> { __atomic_impl::notify_all(_M_ptr); } >> >> // TODO add const volatile overload >>-#endif // HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> >> value_type >> fetch_add(value_type __i, >>@@ -1867,7 +1867,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> __cmpexch_failure_order(__order)); >> } >> >>-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT >>+#ifdef __cpp_lib_atomic_wait >> _GLIBCXX_ALWAYS_INLINE void >> wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept >> { __atomic_impl::wait(_M_ptr, __old, __m); } >>@@ -1885,7 +1885,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> { __atomic_impl::notify_all(_M_ptr); } >> >> // TODO add const volatile overload >>-#endif // HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> >> _GLIBCXX_ALWAYS_INLINE value_type >> fetch_add(difference_type __d, >>diff --git a/libstdc++-v3/include/bits/atomic_timed_wait.h >>b/libstdc++-v3/include/bits/atomic_timed_wait.h >>index f3a07a36722..6dd1a145e69 100644 >>--- a/libstdc++-v3/include/bits/atomic_timed_wait.h >>+++ b/libstdc++-v3/include/bits/atomic_timed_wait.h >>@@ -33,7 +33,8 @@ >> #pragma GCC system_header >> >> #include <bits/atomic_wait.h> >>-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT >>+ >>+#ifdef __cpp_lib_atomic_wait >> #include <bits/functional_hash.h> >> >> #include <chrono> >>@@ -292,5 +293,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> } >> _GLIBCXX_END_NAMESPACE_VERSION >> } // namespace std >>-#endif // HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> #endif // _GLIBCXX_ATOMIC_TIMED_WAIT_H >>diff --git a/libstdc++-v3/include/bits/atomic_wait.h >>b/libstdc++-v3/include/bits/atomic_wait.h >>index a59ed8cb418..5efd96d22a1 100644 >>--- a/libstdc++-v3/include/bits/atomic_wait.h >>+++ b/libstdc++-v3/include/bits/atomic_wait.h >>@@ -50,8 +50,7 @@ >> # include <bits/std_mutex.h> // std::mutex, std::__condvar >> #endif >> >>-// Other headers use this to check for the facilities defined in this header. >>-#define _GLIBCXX_HAVE_ATOMIC_WAIT 1 >>+#define __cpp_lib_atomic_wait 201907L >> >> namespace std _GLIBCXX_VISIBILITY(default) >> { >>diff --git a/libstdc++-v3/include/bits/semaphore_base.h >>b/libstdc++-v3/include/bits/semaphore_base.h >>index f2984236e03..0ed1f5895af 100644 >>--- a/libstdc++-v3/include/bits/semaphore_base.h >>+++ b/libstdc++-v3/include/bits/semaphore_base.h >>@@ -33,7 +33,7 @@ >> #pragma GCC system_header >> >> #include <bits/atomic_base.h> >>-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT >>+#ifdef __cpp_lib_atomic_wait >> #include <bits/atomic_timed_wait.h> >> >> #include <ext/numeric_traits.h> >>@@ -297,5 +297,5 @@ template<ptrdiff_t __least_max_value> >> _GLIBCXX_END_NAMESPACE_VERSION >> } // namespace std >> >>-#endif // HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> #endif // _GLIBCXX_SEMAPHORE_BASE_H >>diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic >>index 664af023d77..4a9b00182a3 100644 >>--- a/libstdc++-v3/include/std/atomic >>+++ b/libstdc++-v3/include/std/atomic >>@@ -164,7 +164,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> memory_order __m = memory_order_seq_cst) volatile noexcept >> { return _M_base.compare_exchange_strong(__i1, __i2, __m); } >> >>-#if __cplusplus > 201703L && defined _GLIBCXX_HAVE_ATOMIC_WAIT >>+#if __cpp_lib_atomic_wait >> void >> wait(bool __old, memory_order __m = memory_order_seq_cst) const noexcept >> { _M_base.wait(__old, __m); } >>@@ -178,7 +178,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> void >> notify_all() const noexcept >> { _M_base.notify_all(); } >>-#endif // C++20 && HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> }; >> >> #if __cplusplus <= 201703L >>@@ -380,7 +380,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> { return compare_exchange_strong(__e, __i, __m, >> __cmpexch_failure_order(__m)); } >> >>-#if __cplusplus > 201703L && defined _GLIBCXX_HAVE_ATOMIC_WAIT >>+#if __cpp_lib_atomic_wait >> void >> wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept >> { >>@@ -404,7 +404,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> void >> notify_all() const noexcept >> { std::__atomic_notify(&_M_i, true); } >>-#endif // C++20 && HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> >> }; >> #undef _GLIBCXX20_INIT >>@@ -644,7 +644,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> __cmpexch_failure_order(__m)); >> } >> >>-#if __cplusplus > 201703L && _GLIBCXX_HAVE_ATOMIC_WAIT >>+#if __cpp_lib_atomic_wait >> void >> wait(__pointer_type __old, memory_order __m = memory_order_seq_cst) >> noexcept >> { _M_b.wait(__old, __m); } >>@@ -658,7 +658,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> void >> notify_all() const noexcept >> { _M_b.notify_all(); } >>-#endif // C++20 && HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> __pointer_type >> fetch_add(ptrdiff_t __d, >> memory_order __m = memory_order_seq_cst) noexcept >>@@ -1412,7 +1412,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> } >> >> >>-#if __cplusplus > 201703L && _GLIBCXX_HAVE_ATOMIC_WAIT >>+#if __cpp_lib_atomic_wait >> template<typename _Tp> >> inline void >> atomic_wait(const atomic<_Tp>* __a, >>@@ -1435,7 +1435,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> inline void >> atomic_notify_all(atomic<_Tp>* __a) noexcept >> { __a->notify_all(); } >>-#endif // C++20 && HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> >> // Function templates for atomic_integral and atomic_pointer operations >> only. >> // Some operations (and, or, xor) are only available for atomic integrals, >>diff --git a/libstdc++-v3/include/std/latch b/libstdc++-v3/include/std/latch >>index 2684b72288f..3ae77cb1cd2 100644 >>--- a/libstdc++-v3/include/std/latch >>+++ b/libstdc++-v3/include/std/latch >>@@ -36,7 +36,7 @@ >> #include <bits/atomic_base.h> >> #include <ext/numeric_traits.h> >> >>-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT >>+#ifdef __cpp_lib_atomic_wait > > Just #if not #ifdef > >> namespace std _GLIBCXX_VISIBILITY(default) >> { >> _GLIBCXX_BEGIN_NAMESPACE_VERSION >>@@ -89,6 +89,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> }; >> _GLIBCXX_END_NAMESPACE_VERSION >> } // namespace >>-#endif // HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> #endif // __cplusplus > 201703L >> #endif // _GLIBCXX_LATCH >>diff --git a/libstdc++-v3/include/std/semaphore >>b/libstdc++-v3/include/std/semaphore >>index 184c7c2867c..0ecf3bf2fa0 100644 >>--- a/libstdc++-v3/include/std/semaphore >>+++ b/libstdc++-v3/include/std/semaphore >>@@ -33,7 +33,7 @@ >> >> #if __cplusplus > 201703L >> #include <bits/semaphore_base.h> >>-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT >>+#ifdef __cpp_lib_atomic_wait > > #if > >> #include <ext/numeric_traits.h> >> >> namespace std _GLIBCXX_VISIBILITY(default) >>@@ -90,6 +90,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> using binary_semaphore = std::counting_semaphore<1>; >> _GLIBCXX_END_NAMESPACE_VERSION >> } // namespace >>-#endif // HAVE_ATOMIC_WAIT >>+#endif // __cpp_lib_atomic_wait >> #endif // C++20 >> #endif // _GLIBCXX_SEMAPHORE >>diff --git a/libstdc++-v3/include/std/version >>b/libstdc++-v3/include/std/version >>index 0f2da8a5ddd..e5502c9e84b 100644 >>--- a/libstdc++-v3/include/std/version >>+++ b/libstdc++-v3/include/std/version >>@@ -197,6 +197,9 @@ >> #if _GLIBCXX_HOSTED >> #define __cpp_lib_array_constexpr 201811L >> #define __cpp_lib_assume_aligned 201811L >>+#if defined _GLIBCXX_HAS_GTHREADS || defined _GLIBCXX_HAVE_LINUX_FUTEX >>+#define __cpp_lib_atomic_wait 201907L > > A single space after the # please. > >>+#endif >> #define __cpp_lib_bind_front 201907L >> // FIXME: #define __cpp_lib_execution 201902L >> #define __cpp_lib_integer_comparison_functions 202002L >>@@ -216,7 +219,7 @@ >> #ifdef _GLIBCXX_HAS_GTHREADS >> # define __cpp_lib_jthread 201911L >> #endif >>-#if defined _GLIBCXX_HAS_GTHREADS || defined _GLIBCXX_HAVE_LINUX_FUTEX >>+#if defined __cpp_lib_atomic_wait > > Remove the "defined". > >> # define __cpp_lib_latch 201907L >> #endif >> #define __cpp_lib_list_remove_return_type 201806L >>@@ -228,7 +231,7 @@ >> #if __cpp_lib_concepts >> # define __cpp_lib_ranges 201911L >> #endif >>-#if defined _GLIBCXX_HAS_GTHREADS || defined _GLIBCXX_HAVE_LINUX_FUTEX >>+#if defined __cpp_lib_atomic_wait > > Remove the "defined". > >> # define __cpp_lib_semaphore 201907L >> #endif >> #define __cpp_lib_shift 201806L >>diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/wait_notify/1.cc >>b/libstdc++-v3/testsuite/29_atomics/atomic/wait_notify/1.cc >>new file mode 100644 >>index 00000000000..5a08d64c1f0 >>--- /dev/null >>+++ b/libstdc++-v3/testsuite/29_atomics/atomic/wait_notify/1.cc >>@@ -0,0 +1,28 @@ >>+// Copyright (C) 2020 Free Software Foundation, Inc. >>+// >>+// This file is part of the GNU ISO C++ Library. This library is free >>+// software; you can redistribute it and/or modify it under the >>+// terms of the GNU General Public License as published by the >>+// Free Software Foundation; either version 3, or (at your option) >>+// any later version. >>+ >>+// This library is distributed in the hope that it will be useful, >>+// but WITHOUT ANY WARRANTY; without even the implied warranty of >>+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >>+// GNU General Public License for more details. >>+ >>+// You should have received a copy of the GNU General Public License along >>+// with this library; see the file COPYING3. If not see >>+// <http://www.gnu.org/licenses/>. >>+ >>+// { dg-options "-std=gnu++2a" } >>+// { dg-do compile { target c++2a } } > > This will fail on targets that don't support the feature. > > It needs to be: > > // { dg-options "-std=gnu++2a" } > // { dg-do compile { target c++2a } } > // { dg-require-effective-target gthreads } > > The last line there works since last week when I added "gthreads" as > an effective target keyword, which replaces: > > // { dg-require-gthreads "" } > > If we wanted to be really correct it would be: > > // { dg-require-effective-target gthreads { target { ! futex } } } > > Which requires gthreads only for target { ! futex } i.e. if futexes > are supported, then gthreads is not needed (which exactly matches the > code). But it's good enough to just require gthreads, since in > practice the combination of futex && ! gthreads is probably > non-existent. Keeping the directive more readable is more important > than verifying the feature test macro is defined on non-existent > targets. > >>+#include <atomic> >>+ >>+#ifndef __cpp_lib_atomic_wait >>+# error "Feature-test macro for atomic wait missing in <atomic>" >>+#elif __cpp_lib_atomic_wait != 201907L >>+# error "Feature-test macro for atomic wait has wrong value in <atomic>" >>+#endif >>+ >>diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/wait_notify/2.cc >>b/libstdc++-v3/testsuite/29_atomics/atomic/wait_notify/2.cc >>new file mode 100644 >>index 00000000000..5031a369e79 >>--- /dev/null >>+++ b/libstdc++-v3/testsuite/29_atomics/atomic/wait_notify/2.cc >>@@ -0,0 +1,29 @@ >>+// Copyright (C) 2020 Free Software Foundation, Inc. >>+// >>+// This file is part of the GNU ISO C++ Library. This library is free >>+// software; you can redistribute it and/or modify it under the >>+// terms of the GNU General Public License as published by the >>+// Free Software Foundation; either version 3, or (at your option) >>+// any later version. >>+ >>+// This library is distributed in the hope that it will be useful, >>+// but WITHOUT ANY WARRANTY; without even the implied warranty of >>+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >>+// GNU General Public License for more details. >>+ >>+// You should have received a copy of the GNU General Public License along >>+// with this library; see the file COPYING3. If not see >>+// <http://www.gnu.org/licenses/>. >>+ >>+// { dg-options "-std=gnu++2a" } >>+// { dg-do compile { target c++2a } } > > This will fail on non-gthreads targets too. As above. > >>+#include <version> >>+ >>+#ifndef __cpp_lib_atomic_wait >>+# error "Feature-test macro for atomic wait missing in <version>" >>+#elif __cpp_lib_atomic_wait != 201907L >>+# error "Feature-test macro for atomic wait has wrong value in <version>" >>+#endif > > > OK with those changes, thanks.