diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -50,20 +50,38 @@ Feature(name='verify-support', when=lambda cfg: hasCompileFlag(cfg, '-Xclang -verify-ignore-unexpected')), Feature(name='non-lockfree-atomics', - when=lambda cfg: sourceBuilds(cfg, """ - #include - struct Large { int storage[100]; }; - std::atomic x; - int main(int, char**) { (void)x.load(); return 0; } + when=lambda cfg: programSucceeds(cfg, """ + #include + #if defined(_LIBCPP_HAS_NO_THREADS) + int main(int, char**) { return 1; } + #else + #include + struct Large { int storage[100]; }; + int main(int, char**) { + Large l; + std::atomic x(l); + (void)x.load(); + return 0; + } + #endif """)), # 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 - struct Large { int storage[100]; }; - std::atomic x; - int main(int, char**) { return x.is_lock_free(); } + when=lambda cfg: programSucceeds(cfg, """ + #include + #if defined(_LIBCPP_HAS_NO_THREADS) + int main(int, char**) { return 1; } + #else + #include + struct Large { int storage[100]; }; + int main(int, char**) { + Large l; + std::atomic x(l); + (void)x.is_lock_free(); + return 0; + } + #endif """)), # Some tests rely on creating shared libraries which link in the C++ Standard Library. In some