Skip to content

Commit 7d742f9

Browse files
authored
[libc++][test] Guard uses of _LIBCPP_HAS_THREADS in FTM tests (llvm#132258)
1 parent 87adafc commit 7d742f9

File tree

3 files changed

+38
-38
lines changed

3 files changed

+38
-38
lines changed

libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.pass.cpp

+18-18
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
# error "__cpp_lib_shared_mutex should not be defined before c++17"
4242
# endif
4343

44-
# if _LIBCPP_HAS_THREADS
44+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
4545
# ifndef __cpp_lib_shared_timed_mutex
4646
# error "__cpp_lib_shared_timed_mutex should be defined in c++14"
4747
# endif
@@ -50,13 +50,13 @@
5050
# endif
5151
# else
5252
# ifdef __cpp_lib_shared_timed_mutex
53-
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
53+
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
5454
# endif
5555
# endif
5656

5757
#elif TEST_STD_VER == 17
5858

59-
# if _LIBCPP_HAS_THREADS
59+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
6060
# ifndef __cpp_lib_shared_mutex
6161
# error "__cpp_lib_shared_mutex should be defined in c++17"
6262
# endif
@@ -65,11 +65,11 @@
6565
# endif
6666
# else
6767
# ifdef __cpp_lib_shared_mutex
68-
# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
68+
# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
6969
# endif
7070
# endif
7171

72-
# if _LIBCPP_HAS_THREADS
72+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
7373
# ifndef __cpp_lib_shared_timed_mutex
7474
# error "__cpp_lib_shared_timed_mutex should be defined in c++17"
7575
# endif
@@ -78,13 +78,13 @@
7878
# endif
7979
# else
8080
# ifdef __cpp_lib_shared_timed_mutex
81-
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
81+
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
8282
# endif
8383
# endif
8484

8585
#elif TEST_STD_VER == 20
8686

87-
# if _LIBCPP_HAS_THREADS
87+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
8888
# ifndef __cpp_lib_shared_mutex
8989
# error "__cpp_lib_shared_mutex should be defined in c++20"
9090
# endif
@@ -93,11 +93,11 @@
9393
# endif
9494
# else
9595
# ifdef __cpp_lib_shared_mutex
96-
# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
96+
# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
9797
# endif
9898
# endif
9999

100-
# if _LIBCPP_HAS_THREADS
100+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
101101
# ifndef __cpp_lib_shared_timed_mutex
102102
# error "__cpp_lib_shared_timed_mutex should be defined in c++20"
103103
# endif
@@ -106,13 +106,13 @@
106106
# endif
107107
# else
108108
# ifdef __cpp_lib_shared_timed_mutex
109-
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
109+
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
110110
# endif
111111
# endif
112112

113113
#elif TEST_STD_VER == 23
114114

115-
# if _LIBCPP_HAS_THREADS
115+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
116116
# ifndef __cpp_lib_shared_mutex
117117
# error "__cpp_lib_shared_mutex should be defined in c++23"
118118
# endif
@@ -121,11 +121,11 @@
121121
# endif
122122
# else
123123
# ifdef __cpp_lib_shared_mutex
124-
# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
124+
# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
125125
# endif
126126
# endif
127127

128-
# if _LIBCPP_HAS_THREADS
128+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
129129
# ifndef __cpp_lib_shared_timed_mutex
130130
# error "__cpp_lib_shared_timed_mutex should be defined in c++23"
131131
# endif
@@ -134,13 +134,13 @@
134134
# endif
135135
# else
136136
# ifdef __cpp_lib_shared_timed_mutex
137-
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
137+
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
138138
# endif
139139
# endif
140140

141141
#elif TEST_STD_VER > 23
142142

143-
# if _LIBCPP_HAS_THREADS
143+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
144144
# ifndef __cpp_lib_shared_mutex
145145
# error "__cpp_lib_shared_mutex should be defined in c++26"
146146
# endif
@@ -149,11 +149,11 @@
149149
# endif
150150
# else
151151
# ifdef __cpp_lib_shared_mutex
152-
# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
152+
# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
153153
# endif
154154
# endif
155155

156-
# if _LIBCPP_HAS_THREADS
156+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
157157
# ifndef __cpp_lib_shared_timed_mutex
158158
# error "__cpp_lib_shared_timed_mutex should be defined in c++26"
159159
# endif
@@ -162,7 +162,7 @@
162162
# endif
163163
# else
164164
# ifdef __cpp_lib_shared_timed_mutex
165-
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
165+
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
166166
# endif
167167
# endif
168168

libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp

+18-18
Original file line numberDiff line numberDiff line change
@@ -1885,7 +1885,7 @@
18851885
# error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17"
18861886
# endif
18871887

1888-
# if _LIBCPP_HAS_THREADS
1888+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
18891889
# ifndef __cpp_lib_shared_timed_mutex
18901890
# error "__cpp_lib_shared_timed_mutex should be defined in c++14"
18911891
# endif
@@ -1894,7 +1894,7 @@
18941894
# endif
18951895
# else
18961896
# ifdef __cpp_lib_shared_timed_mutex
1897-
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
1897+
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
18981898
# endif
18991899
# endif
19001900

@@ -2971,7 +2971,7 @@
29712971
# error "__cpp_lib_senders should not be defined before c++26"
29722972
# endif
29732973

2974-
# if _LIBCPP_HAS_THREADS
2974+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
29752975
# ifndef __cpp_lib_shared_mutex
29762976
# error "__cpp_lib_shared_mutex should be defined in c++17"
29772977
# endif
@@ -2980,7 +2980,7 @@
29802980
# endif
29812981
# else
29822982
# ifdef __cpp_lib_shared_mutex
2983-
# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
2983+
# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
29842984
# endif
29852985
# endif
29862986

@@ -2998,7 +2998,7 @@
29982998
# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++17"
29992999
# endif
30003000

3001-
# if _LIBCPP_HAS_THREADS
3001+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
30023002
# ifndef __cpp_lib_shared_timed_mutex
30033003
# error "__cpp_lib_shared_timed_mutex should be defined in c++17"
30043004
# endif
@@ -3007,7 +3007,7 @@
30073007
# endif
30083008
# else
30093009
# ifdef __cpp_lib_shared_timed_mutex
3010-
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
3010+
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
30113011
# endif
30123012
# endif
30133013

@@ -4333,7 +4333,7 @@
43334333
# error "__cpp_lib_senders should not be defined before c++26"
43344334
# endif
43354335

4336-
# if _LIBCPP_HAS_THREADS
4336+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
43374337
# ifndef __cpp_lib_shared_mutex
43384338
# error "__cpp_lib_shared_mutex should be defined in c++20"
43394339
# endif
@@ -4342,7 +4342,7 @@
43424342
# endif
43434343
# else
43444344
# ifdef __cpp_lib_shared_mutex
4345-
# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
4345+
# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
43464346
# endif
43474347
# endif
43484348

@@ -4360,7 +4360,7 @@
43604360
# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++20"
43614361
# endif
43624362

4363-
# if _LIBCPP_HAS_THREADS
4363+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
43644364
# ifndef __cpp_lib_shared_timed_mutex
43654365
# error "__cpp_lib_shared_timed_mutex should be defined in c++20"
43664366
# endif
@@ -4369,7 +4369,7 @@
43694369
# endif
43704370
# else
43714371
# ifdef __cpp_lib_shared_timed_mutex
4372-
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
4372+
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
43734373
# endif
43744374
# endif
43754375

@@ -5938,7 +5938,7 @@
59385938
# error "__cpp_lib_senders should not be defined before c++26"
59395939
# endif
59405940

5941-
# if _LIBCPP_HAS_THREADS
5941+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
59425942
# ifndef __cpp_lib_shared_mutex
59435943
# error "__cpp_lib_shared_mutex should be defined in c++23"
59445944
# endif
@@ -5947,7 +5947,7 @@
59475947
# endif
59485948
# else
59495949
# ifdef __cpp_lib_shared_mutex
5950-
# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
5950+
# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
59515951
# endif
59525952
# endif
59535953

@@ -5965,7 +5965,7 @@
59655965
# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++23"
59665966
# endif
59675967

5968-
# if _LIBCPP_HAS_THREADS
5968+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
59695969
# ifndef __cpp_lib_shared_timed_mutex
59705970
# error "__cpp_lib_shared_timed_mutex should be defined in c++23"
59715971
# endif
@@ -5974,7 +5974,7 @@
59745974
# endif
59755975
# else
59765976
# ifdef __cpp_lib_shared_timed_mutex
5977-
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
5977+
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
59785978
# endif
59795979
# endif
59805980

@@ -7858,7 +7858,7 @@
78587858
# endif
78597859
# endif
78607860

7861-
# if _LIBCPP_HAS_THREADS
7861+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
78627862
# ifndef __cpp_lib_shared_mutex
78637863
# error "__cpp_lib_shared_mutex should be defined in c++26"
78647864
# endif
@@ -7867,7 +7867,7 @@
78677867
# endif
78687868
# else
78697869
# ifdef __cpp_lib_shared_mutex
7870-
# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
7870+
# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
78717871
# endif
78727872
# endif
78737873

@@ -7885,7 +7885,7 @@
78857885
# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++26"
78867886
# endif
78877887

7888-
# if _LIBCPP_HAS_THREADS
7888+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
78897889
# ifndef __cpp_lib_shared_timed_mutex
78907890
# error "__cpp_lib_shared_timed_mutex should be defined in c++26"
78917891
# endif
@@ -7894,7 +7894,7 @@
78947894
# endif
78957895
# else
78967896
# ifdef __cpp_lib_shared_timed_mutex
7897-
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
7897+
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
78987898
# endif
78997899
# endif
79007900

libcxx/utils/generate_feature_test_macro_components.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ def add_version_header(tc):
11941194
"name": "__cpp_lib_shared_mutex",
11951195
"values": {"c++17": 201505},
11961196
"headers": ["shared_mutex"],
1197-
"test_suite_guard": "_LIBCPP_HAS_THREADS",
1197+
"test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS",
11981198
"libcxx_guard": "_LIBCPP_HAS_THREADS",
11991199
},
12001200
{
@@ -1211,7 +1211,7 @@ def add_version_header(tc):
12111211
"name": "__cpp_lib_shared_timed_mutex",
12121212
"values": {"c++14": 201402},
12131213
"headers": ["shared_mutex"],
1214-
"test_suite_guard": "_LIBCPP_HAS_THREADS",
1214+
"test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS",
12151215
"libcxx_guard": "_LIBCPP_HAS_THREADS",
12161216
},
12171217
{

0 commit comments

Comments
 (0)