Skip to content
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

[libc++][test] Guard uses of _LIBCPP_HAS_THREADS in FTM tests #132258

Merged
merged 1 commit into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions libcxx/utils/generate_feature_test_macro_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
{
Expand All @@ -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",
},
{
Expand Down