-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc++] Simplify features for detecting atomics' support. #75553
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 |
---|---|---|
|
@@ -183,25 +183,26 @@ def _getAndroidDeviceApi(cfg): | |
actions=[AddLinkFlag("-latomic")], | ||
), | ||
Feature( | ||
name="non-lockfree-atomics", | ||
name="has-64-bit-atomics", | ||
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. I think this name is both an improvement (because it calls out the size being the factor here), but also gets worse because locking atomics are still atomic. I wouldn't understand the meaning of this feature check if I were just reading it in the test. 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. I think the realization here is that the previous name 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. What does it mean to have I guess I still don't understand the fundamental underlying property we're trying to observe. |
||
when=lambda cfg: sourceBuilds( | ||
cfg, | ||
""" | ||
#include <atomic> | ||
struct Large { int storage[100]; }; | ||
struct Large { char storage[64/8]; }; | ||
var-const marked this conversation as resolved.
Show resolved
Hide resolved
|
||
std::atomic<Large> x; | ||
int main(int, char**) { (void)x.load(); return 0; } | ||
int main(int, char**) { (void)x.load(); (void)x.is_lock_free(); return 0; } | ||
""", | ||
), | ||
), | ||
Feature( | ||
name="has-64-bit-atomics", | ||
name="has-128-bit-atomics", | ||
when=lambda cfg: sourceBuilds( | ||
cfg, | ||
""" | ||
#include <atomic> | ||
std::atomic_uint64_t x; | ||
int main(int, char**) { (void)x.load(); return 0; } | ||
struct Large { char storage[128/8]; }; | ||
std::atomic<Large> x; | ||
int main(int, char**) { (void)x.load(); (void)x.is_lock_free(); return 0; } | ||
""", | ||
), | ||
), | ||
|
@@ -217,20 +218,6 @@ def _getAndroidDeviceApi(cfg): | |
""", | ||
), | ||
), | ||
# TODO: Remove this feature once compiler-rt includes __atomic_is_lockfree() | ||
# on all supported platforms. | ||
Feature( | ||
name="is-lockfree-runtime-function", | ||
when=lambda cfg: sourceBuilds( | ||
cfg, | ||
""" | ||
#include <atomic> | ||
struct Large { int storage[100]; }; | ||
std::atomic<Large> x; | ||
int main(int, char**) { return x.is_lock_free(); } | ||
""", | ||
), | ||
), | ||
# Check for a Windows UCRT bug (fixed in UCRT/Windows 10.0.20348.0): | ||
# https://developercommunity.visualstudio.com/t/utf-8-locales-break-ctype-functions-for-wchar-type/1653678 | ||
Feature( | ||
|
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.
Do these tests start passing if we simply start linking libatomic?
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 think we already automatically link
libatomic
: #67799, or does the feature not cover these tests? (if I'm reading it correctly, it's applied to all tests unconditionally, but I could well be missing something)