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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 20 10:39:27 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; }
----------------
ldionne wrote:

More generally speaking, I think what we'd want is a test where we:

1. Test that we have the expected Lit features defined on various common platforms
2. Maybe validate that we have exactly the expected set of `UNSUPPORTED` tests in various common configurations

This would catch a mistake like this, and more. It's a bit hard to implement, though, cause we can't use the test suite for that (or it would be very brittle).

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


More information about the libcxx-commits mailing list