[libcxx-commits] [libcxx] [libc++][test] Guard uses of `_LIBCPP_HAS_THREADS` in FTM tests (PR #132258)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 20 10:39:30 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: S. B. Tam (cpplearner)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/132258.diff
3 Files Affected:
- (modified) libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.pass.cpp (+18-18)
- (modified) libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp (+18-18)
- (modified) libcxx/utils/generate_feature_test_macro_components.py (+2-2)
``````````diff
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.pass.cpp
index 7302d0b95ffc1..0dd6303cbfd04 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.pass.cpp
@@ -41,7 +41,7 @@
# error "__cpp_lib_shared_mutex should not be defined before c++17"
# endif
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++14"
# endif
@@ -50,13 +50,13 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
#elif TEST_STD_VER == 17
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_mutex
# error "__cpp_lib_shared_mutex should be defined in c++17"
# endif
@@ -65,11 +65,11 @@
# endif
# else
# ifdef __cpp_lib_shared_mutex
-# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++17"
# endif
@@ -78,13 +78,13 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
#elif TEST_STD_VER == 20
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_mutex
# error "__cpp_lib_shared_mutex should be defined in c++20"
# endif
@@ -93,11 +93,11 @@
# endif
# else
# ifdef __cpp_lib_shared_mutex
-# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++20"
# endif
@@ -106,13 +106,13 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
#elif TEST_STD_VER == 23
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_mutex
# error "__cpp_lib_shared_mutex should be defined in c++23"
# endif
@@ -121,11 +121,11 @@
# endif
# else
# ifdef __cpp_lib_shared_mutex
-# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++23"
# endif
@@ -134,13 +134,13 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
#elif TEST_STD_VER > 23
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_mutex
# error "__cpp_lib_shared_mutex should be defined in c++26"
# endif
@@ -149,11 +149,11 @@
# endif
# else
# ifdef __cpp_lib_shared_mutex
-# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++26"
# endif
@@ -162,7 +162,7 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index 1e4465d515e6b..57148b52cc276 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -1884,7 +1884,7 @@
# error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17"
# endif
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++14"
# endif
@@ -1893,7 +1893,7 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
@@ -2970,7 +2970,7 @@
# error "__cpp_lib_senders should not be defined before c++26"
# endif
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_mutex
# error "__cpp_lib_shared_mutex should be defined in c++17"
# endif
@@ -2979,7 +2979,7 @@
# endif
# else
# ifdef __cpp_lib_shared_mutex
-# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
@@ -2997,7 +2997,7 @@
# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++17"
# endif
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++17"
# endif
@@ -3006,7 +3006,7 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
@@ -4332,7 +4332,7 @@
# error "__cpp_lib_senders should not be defined before c++26"
# endif
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_mutex
# error "__cpp_lib_shared_mutex should be defined in c++20"
# endif
@@ -4341,7 +4341,7 @@
# endif
# else
# ifdef __cpp_lib_shared_mutex
-# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
@@ -4359,7 +4359,7 @@
# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++20"
# endif
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++20"
# endif
@@ -4368,7 +4368,7 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
@@ -5937,7 +5937,7 @@
# error "__cpp_lib_senders should not be defined before c++26"
# endif
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_mutex
# error "__cpp_lib_shared_mutex should be defined in c++23"
# endif
@@ -5946,7 +5946,7 @@
# endif
# else
# ifdef __cpp_lib_shared_mutex
-# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
@@ -5964,7 +5964,7 @@
# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++23"
# endif
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++23"
# endif
@@ -5973,7 +5973,7 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
@@ -7857,7 +7857,7 @@
# endif
# endif
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_mutex
# error "__cpp_lib_shared_mutex should be defined in c++26"
# endif
@@ -7866,7 +7866,7 @@
# endif
# else
# ifdef __cpp_lib_shared_mutex
-# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
@@ -7884,7 +7884,7 @@
# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++26"
# endif
-# if _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
# ifndef __cpp_lib_shared_timed_mutex
# error "__cpp_lib_shared_timed_mutex should be defined in c++26"
# endif
@@ -7893,7 +7893,7 @@
# endif
# else
# ifdef __cpp_lib_shared_timed_mutex
-# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
# endif
# endif
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 8bf7633e985d5..90b4c9f0fd40a 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -1194,7 +1194,7 @@ def add_version_header(tc):
"name": "__cpp_lib_shared_mutex",
"values": {"c++17": 201505},
"headers": ["shared_mutex"],
- "test_suite_guard": "_LIBCPP_HAS_THREADS",
+ "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS",
"libcxx_guard": "_LIBCPP_HAS_THREADS",
},
{
@@ -1211,7 +1211,7 @@ def add_version_header(tc):
"name": "__cpp_lib_shared_timed_mutex",
"values": {"c++14": 201402},
"headers": ["shared_mutex"],
- "test_suite_guard": "_LIBCPP_HAS_THREADS",
+ "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS",
"libcxx_guard": "_LIBCPP_HAS_THREADS",
},
{
``````````
</details>
https://github.com/llvm/llvm-project/pull/132258
More information about the libcxx-commits
mailing list