summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien L-G <dalg24+github@gmail.com>2024-04-03 17:51:46 -0400
committerGitHub <noreply@github.com>2024-04-03 17:51:46 -0400
commit4078763e2e73b4ef3f9e728f66cdf9e429d3f7a4 (patch)
treefd670cea62d2f013c26cd2a359497f2e1c23c06f
parent718638d44d3f1033c1ea395244c07d971ec33a90 (diff)
[libc++] Fix copy/pasta error in atomic tests for `atomic_compare_exchange_{weak,strong}` (#87135)
Spotted this minor mistake in the tests as I was looking into testing more 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.
-rw-r--r--libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/compare_exchange_strong.pass.cpp4
-rw-r--r--libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/compare_exchange_weak.pass.cpp4
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 0b09a7331fd1..2f84f26b9f7d 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 f8a2f196c55a..5a39ec761f34 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;
};