-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[libc++] Fix name of is_always_lock_free test which was never being run #106077
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -5,8 +5,9 @@ | |||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||||
// | ||||||
//===----------------------------------------------------------------------===// | ||||||
// | ||||||
|
||||||
// UNSUPPORTED: c++03, c++11, c++14 | ||||||
// XFAIL: LIBCXX-PICOLIBC-FIXME | ||||||
|
||||||
// <atomic> | ||||||
// | ||||||
|
@@ -15,6 +16,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 +32,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 +51,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); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you open a PR to fix this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
assert(is_lock_free); | ||||||
} | ||||||
ASSERT_NOEXCEPT(a.is_lock_free()); | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@domin144 @mplatings I don't quite understand why this fails. There seems to be missing the
__atomic_is_lock_free
intrinsic on the Picolibc setup, but the other atomic tests are working. Could you take a look?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DavidSpickett
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will merge this because we want to cherry-pick onto LLVM 19 and it's better to have this test for most platforms than for none of them, but I would really appreciate if we could address this in a follow-up.