[libcxx-commits] [libcxx] [libc++] Fix copy/pasta error in atomic tests for `atomic_compare_exchange_{weak, strong}` (PR #87135)
Damien L-G via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Mar 29 18:42:24 PDT 2024
https://github.com/dalg24 created https://github.com/llvm/llvm-project/pull/87135
Spotted this minor mistake in the tests as I was looking into testing for thoroughly `atomic_ref`.
The two argument overloads are tested just above. The names of the lambda clearly indicates that the intent was to test the one argument overload.
>From e7f96901391d010033358345d3522b6cc633bbe0 Mon Sep 17 00:00:00 2001
From: Damien L-G <dalg24 at gmail.com>
Date: Fri, 29 Mar 2024 21:38:12 -0400
Subject: [PATCH] [libc++] Fixup floating point atomic compare exchange weak
and strong test overload with one argument
---
.../atomics.types.float/compare_exchange_strong.pass.cpp | 4 ++--
.../atomics.types.float/compare_exchange_weak.pass.cpp | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/compare_exchange_strong.pass.cpp b/libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/compare_exchange_strong.pass.cpp
index 0b09a7331fd1e2..2f84f26b9f7d27 100644
--- a/libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/compare_exchange_strong.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/compare_exchange_strong.pass.cpp
@@ -150,12 +150,12 @@ void test_impl() {
test_seq_cst<T, MaybeVolatile>(store, load);
auto store_one_arg = [](MaybeVolatile<std::atomic<T>>& x, T old_val, T new_val) {
- auto r = x.compare_exchange_strong(old_val, new_val, std::memory_order::seq_cst, std::memory_order_relaxed);
+ auto r = x.compare_exchange_strong(old_val, new_val, std::memory_order::seq_cst);
assert(r);
};
auto load_one_arg = [](MaybeVolatile<std::atomic<T>>& x) {
auto val = x.load(std::memory_order::relaxed);
- while (!x.compare_exchange_strong(val, val, std::memory_order::seq_cst, std::memory_order_relaxed)) {
+ while (!x.compare_exchange_strong(val, val, std::memory_order::seq_cst)) {
}
return val;
};
diff --git a/libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/compare_exchange_weak.pass.cpp b/libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/compare_exchange_weak.pass.cpp
index f8a2f196c55a83..5a39ec761f3458 100644
--- a/libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/compare_exchange_weak.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/compare_exchange_weak.pass.cpp
@@ -165,12 +165,12 @@ void test_impl() {
auto store_one_arg = [](MaybeVolatile<std::atomic<T>>& x, T old_val, T new_val) {
// could fail spuriously, so put it in a loop
- while (!x.compare_exchange_weak(old_val, new_val, std::memory_order::seq_cst, std::memory_order_relaxed)) {
+ while (!x.compare_exchange_weak(old_val, new_val, std::memory_order::seq_cst)) {
}
};
auto load_one_arg = [](MaybeVolatile<std::atomic<T>>& x) {
auto val = x.load(std::memory_order::relaxed);
- while (!x.compare_exchange_weak(val, val, std::memory_order::seq_cst, std::memory_order_relaxed)) {
+ while (!x.compare_exchange_weak(val, val, std::memory_order::seq_cst)) {
}
return val;
};
More information about the libcxx-commits
mailing list