[libcxx-commits] [libcxx] [libc++] Fix name of is_always_lock_free test which was never being run (PR #106077)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Sep 30 11:29:56 PDT 2024
https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/106077
>From 8225a05a3b4d79137dbbd3f53e2210f240f1663b Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Mon, 26 Aug 2024 11:54:51 -0400
Subject: [PATCH] [libc++] Fix name of is_always_lock_free test which was never
being run
---
...ways_lock_free.cpp => is_always_lock_free.pass.cpp} | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
rename libcxx/test/std/atomics/atomics.lockfree/{is_always_lock_free.cpp => is_always_lock_free.pass.cpp} (95%)
diff --git a/libcxx/test/std/atomics/atomics.lockfree/is_always_lock_free.cpp b/libcxx/test/std/atomics/atomics.lockfree/is_always_lock_free.pass.cpp
similarity index 95%
rename from libcxx/test/std/atomics/atomics.lockfree/is_always_lock_free.cpp
rename to libcxx/test/std/atomics/atomics.lockfree/is_always_lock_free.pass.cpp
index db17221e515d3a..108a25dc2591b8 100644
--- a/libcxx/test/std/atomics/atomics.lockfree/is_always_lock_free.cpp
+++ b/libcxx/test/std/atomics/atomics.lockfree/is_always_lock_free.pass.cpp
@@ -15,6 +15,10 @@
//
// static constexpr bool is_always_lock_free;
+// Ignore diagnostic about vector types changing the ABI on some targets, since
+// that is irrelevant for this test.
+// ADDITIONAL_COMPILE_FLAGS: -Wno-psabi
+
#include <atomic>
#include <cassert>
#include <concepts>
@@ -27,7 +31,8 @@ template <typename T>
void check_always_lock_free(std::atomic<T> const& a) {
using InfoT = LockFreeStatusInfo<T>;
- constexpr std::same_as<const bool> decltype(auto) is_always_lock_free = std::atomic<T>::is_always_lock_free;
+ constexpr auto is_always_lock_free = std::atomic<T>::is_always_lock_free;
+ ASSERT_SAME_TYPE(decltype(is_always_lock_free), bool const);
// If we know the status of T for sure, validate the exact result of the function.
if constexpr (InfoT::status_known) {
@@ -45,7 +50,8 @@ void check_always_lock_free(std::atomic<T> const& a) {
// In all cases, also sanity-check it based on the implication always-lock-free => lock-free.
if (is_always_lock_free) {
- std::same_as<bool> decltype(auto) is_lock_free = a.is_lock_free();
+ auto is_lock_free = a.is_lock_free();
+ ASSERT_SAME_TYPE(decltype(is_always_lock_free), bool const);
assert(is_lock_free);
}
ASSERT_NOEXCEPT(a.is_lock_free());
More information about the libcxx-commits
mailing list