diff --git a/libcxx/docs/Status/Cxx2bIssues.csv b/libcxx/docs/Status/Cxx2bIssues.csv --- a/libcxx/docs/Status/Cxx2bIssues.csv +++ b/libcxx/docs/Status/Cxx2bIssues.csv @@ -205,7 +205,7 @@ "`3737 `__","``take_view::sentinel`` should provide ``operator-``", "November 2022","","","|ranges|" "`3738 `__","Missing preconditions for ``take_view`` constructor", "November 2022","","","|ranges|" "`3743 `__","``ranges::to``'s reserve may be ill-formed", "November 2022","","","|ranges|" -"`3745 `__","``std::atomic_wait`` and its friends lack ``noexcept``", "November 2022","","","" +"`3745 `__","``std::atomic_wait`` and its friends lack ``noexcept``", "November 2022","|Complete|","16.0","" "`3746 `__","``optional``'s spaceship with ``U`` with a type derived from optional causes infinite constraint meta-recursion", "November 2022","","","|spaceship|" "`3747 `__","``ranges::uninitialized_copy_n``, ``ranges::uninitialized_move_n``, and ``ranges::destroy_n`` should use ``std::move``", "November 2022","","","|ranges|" "`3750 `__","Too many papers bump ``__cpp_lib_format``", "November 2022","","","|format|" diff --git a/libcxx/include/atomic b/libcxx/include/atomic --- a/libcxx/include/atomic +++ b/libcxx/include/atomic @@ -377,23 +377,23 @@ memory_order) noexcept; template - void atomic_wait(const volatile atomic*, atomic::value_type); + void atomic_wait(const volatile atomic*, atomic::value_type) noexcept; template - void atomic_wait(const atomic*, atomic::value_type); + void atomic_wait(const atomic*, atomic::value_type) noexcept; template void atomic_wait_explicit(const volatile atomic*, atomic::value_type, - memory_order); + memory_order) noexcept; template void atomic_wait_explicit(const atomic*, atomic::value_type, - memory_order); + memory_order) noexcept; template - void atomic_notify_one(volatile atomic*); + void atomic_notify_one(volatile atomic*) noexcept; template - void atomic_notify_one(atomic*); + void atomic_notify_one(atomic*) noexcept; template - void atomic_notify_all(volatile atomic*); + void atomic_notify_all(volatile atomic*) noexcept; template - void atomic_notify_all(atomic*); + void atomic_notify_all(atomic*) noexcept; // Atomics for standard typedef types @@ -2099,7 +2099,7 @@ __o->notify_one(); } -// atomic_notify_one +// atomic_notify_all template _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY 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 --- 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 @@ -17,11 +17,11 @@ // template // void -// atomic_notify_all(volatile atomic*); +// atomic_notify_all(volatile atomic*) noexcept; // // template // void -// atomic_notify_all(atomic*); +// atomic_notify_all(atomic*) noexcept; #include #include @@ -39,6 +39,7 @@ { A a(T(1)); + static_assert(noexcept(std::atomic_notify_all(&a)), ""); auto f = [&]() { assert(std::atomic_load(&a) == T(1)); std::atomic_wait(&a, T(1)); @@ -55,6 +56,7 @@ } { volatile A a(T(2)); + static_assert(noexcept(std::atomic_notify_all(&a)), ""); auto f = [&]() { assert(std::atomic_load(&a) == T(2)); std::atomic_wait(&a, T(2)); 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 --- 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 @@ -17,11 +17,11 @@ // template // void -// atomic_notify_one(volatile atomic*); +// atomic_notify_one(volatile atomic*) noexcept; // // template // void -// atomic_notify_one(atomic*); +// atomic_notify_one(atomic*) noexcept; #include #include @@ -39,6 +39,7 @@ { A a(T(1)); + static_assert(noexcept(std::atomic_notify_one(&a)), ""); std::thread t = support::make_test_thread([&]() { std::atomic_store(&a, T(3)); std::atomic_notify_one(&a); @@ -49,6 +50,7 @@ } { volatile A a(T(2)); + static_assert(noexcept(std::atomic_notify_one(&a)), ""); std::thread t = support::make_test_thread([&]() { std::atomic_store(&a, T(4)); std::atomic_notify_one(&a); 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 --- 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 @@ -17,11 +17,11 @@ // template // void -// atomic_wait(const volatile atomic*, atomic::value_type); +// atomic_wait(const volatile atomic*, atomic::value_type) noexcept; // // template // void -// atomic_wait(const atomic*, atomic::value_type); +// atomic_wait(const atomic*, atomic::value_type) noexcept; #include #include @@ -38,6 +38,7 @@ typedef std::atomic A; { A t(T(1)); + static_assert(noexcept(std::atomic_wait(&t, T(0))), ""); assert(std::atomic_load(&t) == T(1)); std::atomic_wait(&t, T(0)); std::thread t1 = support::make_test_thread([&]() { @@ -50,6 +51,7 @@ } { volatile A vt(T(2)); + static_assert(noexcept(std::atomic_wait(&vt, T(0))), ""); assert(std::atomic_load(&vt) == T(2)); std::atomic_wait(&vt, T(1)); std::thread t2 = support::make_test_thread([&]() { 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 --- 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 @@ -18,12 +18,12 @@ // template // void // atomic_wait_explicit(const volatile atomic*, atomic::value_type, -// memory_order); +// memory_order) noexcept; // // template // void // atomic_wait_explicit(const volatile atomic*, atomic::value_type, -// memory_order); +// memory_order) noexcept; #include #include @@ -40,6 +40,7 @@ typedef std::atomic A; { A t(T(1)); + static_assert(noexcept(std::atomic_wait_explicit(&t, T(0), std::memory_order_seq_cst)), ""); assert(std::atomic_load(&t) == T(1)); std::atomic_wait_explicit(&t, T(0), std::memory_order_seq_cst); std::thread t1 = support::make_test_thread([&]() { @@ -52,6 +53,7 @@ } { volatile A vt(T(2)); + static_assert(noexcept(std::atomic_wait_explicit(&vt, T(0), std::memory_order_seq_cst)), ""); assert(std::atomic_load(&vt) == T(2)); std::atomic_wait_explicit(&vt, T(1), std::memory_order_seq_cst); std::thread t2 = support::make_test_thread([&]() {