Implent C++20 std::atomic_flag::test
* include/bits/atomic_base.h (atomic_flag): Implement test member function. * include/std/version: Define __cpp_lib_atomic_flag_test. * testsuite/29_atomics/atomic_flag/test/explicit.cc: New file. * testsuite/29_atomics/atomic_flag/test/implicit.cc: New file.
This commit is contained in:
parent
3ebd168b44
commit
491ba663e0
|
@ -1,3 +1,11 @@
|
|||
2020-05-08 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* include/bits/atomic_base.h (atomic_flag): Implement test member
|
||||
function.
|
||||
* include/std/version: Define __cpp_lib_atomic_flag_test.
|
||||
* testsuite/29_atomics/atomic_flag/test/explicit.cc: New file.
|
||||
* testsuite/29_atomics/atomic_flag/test/implicit.cc: New file.
|
||||
|
||||
2020-05-07 Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
PR libstdc++/94971 (partial)
|
||||
|
|
|
@ -208,6 +208,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
return __atomic_test_and_set (&_M_i, int(__m));
|
||||
}
|
||||
|
||||
#if __cplusplus > 201703L
|
||||
#define __cpp_lib_atomic_flag_test 201907L
|
||||
|
||||
_GLIBCXX_ALWAYS_INLINE bool
|
||||
test(memory_order __m = memory_order_seq_cst) noexcept
|
||||
{
|
||||
__atomic_flag_data_type __v;
|
||||
__atomic_load(&_M_i, &__v, int(__m));
|
||||
return __v == __GCC_ATOMIC_TEST_AND_SET_TRUEVAL;
|
||||
}
|
||||
|
||||
_GLIBCXX_ALWAYS_INLINE bool
|
||||
test(memory_order __m = memory_order_seq_cst) volatile noexcept
|
||||
{
|
||||
__atomic_flag_data_type __v;
|
||||
__atomic_load(&_M_i, &__v, int(__m));
|
||||
return __v == __GCC_ATOMIC_TEST_AND_SET_TRUEVAL;
|
||||
}
|
||||
#endif // C++20
|
||||
|
||||
_GLIBCXX_ALWAYS_INLINE void
|
||||
clear(memory_order __m = memory_order_seq_cst) noexcept
|
||||
{
|
||||
|
|
|
@ -164,6 +164,7 @@
|
|||
|
||||
#if __cplusplus > 201703L
|
||||
// c++2a
|
||||
#define __cpp_lib_atomic_flag_test 201907L
|
||||
#define __cpp_lib_atomic_float 201711L
|
||||
#define __cpp_lib_atomic_ref 201806L
|
||||
#define __cpp_lib_atomic_value_initialization 201911L
|
||||
|
|
Loading…
Reference in New Issue