[libcxx-commits] [libcxx] [libc++][NFC] Simplify features for detecting atomics' support. (PR #75553)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 19 13:36:55 PST 2023


================
@@ -183,25 +183,26 @@ def _getAndroidDeviceApi(cfg):
         actions=[AddLinkFlag("-latomic")],
     ),
     Feature(
-        name="non-lockfree-atomics",
+        name="has-64-bit-atomics",
         when=lambda cfg: sourceBuilds(
             cfg,
             """
             #include <atomic>
-            struct Large { int storage[100]; };
+            struct Large { char storage[64/8]; };
             std::atomic<Large> x;
-            int main(int, char**) { (void)x.load(); return 0; }
+            int main(int, char**) { (void)x.load(); x.is_lockfree(); return 0; }
----------------
EricWF wrote:

Can we validate how this test fails when it fails? 

This really scares me. It's exactly the kind of thing which could silently break.

Also, what's the underlying system property which defines if atomics are lock free? The target arch?
Can we validate that this test passes or fails appropriately for different architectures. 


https://github.com/llvm/llvm-project/pull/75553


More information about the libcxx-commits mailing list