[libcxx-commits] [libcxx] 4078763 - [libc++] Fix copy/pasta error in atomic tests for `atomic_compare_exchange_{weak, strong}` (#87135)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Apr 3 14:51:49 PDT 2024
Author: Damien L-G
Date: 2024-04-03T17:51:46-04:00
New Revision: 4078763e2e73b4ef3f9e728f66cdf9e429d3f7a4
URL: https://github.com/llvm/llvm-project/commit/4078763e2e73b4ef3f9e728f66cdf9e429d3f7a4
DIFF: https://github.com/llvm/llvm-project/commit/4078763e2e73b4ef3f9e728f66cdf9e429d3f7a4.diff
LOG: [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.
Added:
Modified:
libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/compare_exchange_strong.pass.cpp
libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/compare_exchange_weak.pass.cpp
Removed:
################################################################################
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