Skip to content

Commit 22ccc54

Browse files
committed
[libc++][test] Guard uses of _LIBCPP_HAS_THREADS in FTM tests
1 parent 1e6ba3c commit 22ccc54

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

Lines changed: 18 additions & 18 deletions
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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,7 +1884,7 @@
18841884
# error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17"
18851885
# endif
18861886

1887-
# if _LIBCPP_HAS_THREADS
1887+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
18881888
# ifndef __cpp_lib_shared_timed_mutex
18891889
# error "__cpp_lib_shared_timed_mutex should be defined in c++14"
18901890
# endif
@@ -1893,7 +1893,7 @@
18931893
# endif
18941894
# else
18951895
# ifdef __cpp_lib_shared_timed_mutex
1896-
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
1896+
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
18971897
# endif
18981898
# endif
18991899

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

2973-
# if _LIBCPP_HAS_THREADS
2973+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
29742974
# ifndef __cpp_lib_shared_mutex
29752975
# error "__cpp_lib_shared_mutex should be defined in c++17"
29762976
# endif
@@ -2979,7 +2979,7 @@
29792979
# endif
29802980
# else
29812981
# ifdef __cpp_lib_shared_mutex
2982-
# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
2982+
# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
29832983
# endif
29842984
# endif
29852985

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

3000-
# if _LIBCPP_HAS_THREADS
3000+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
30013001
# ifndef __cpp_lib_shared_timed_mutex
30023002
# error "__cpp_lib_shared_timed_mutex should be defined in c++17"
30033003
# endif
@@ -3006,7 +3006,7 @@
30063006
# endif
30073007
# else
30083008
# ifdef __cpp_lib_shared_timed_mutex
3009-
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
3009+
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
30103010
# endif
30113011
# endif
30123012

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

4335-
# if _LIBCPP_HAS_THREADS
4335+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
43364336
# ifndef __cpp_lib_shared_mutex
43374337
# error "__cpp_lib_shared_mutex should be defined in c++20"
43384338
# endif
@@ -4341,7 +4341,7 @@
43414341
# endif
43424342
# else
43434343
# ifdef __cpp_lib_shared_mutex
4344-
# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
4344+
# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
43454345
# endif
43464346
# endif
43474347

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

4362-
# if _LIBCPP_HAS_THREADS
4362+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
43634363
# ifndef __cpp_lib_shared_timed_mutex
43644364
# error "__cpp_lib_shared_timed_mutex should be defined in c++20"
43654365
# endif
@@ -4368,7 +4368,7 @@
43684368
# endif
43694369
# else
43704370
# ifdef __cpp_lib_shared_timed_mutex
4371-
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
4371+
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
43724372
# endif
43734373
# endif
43744374

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

5940-
# if _LIBCPP_HAS_THREADS
5940+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
59415941
# ifndef __cpp_lib_shared_mutex
59425942
# error "__cpp_lib_shared_mutex should be defined in c++23"
59435943
# endif
@@ -5946,7 +5946,7 @@
59465946
# endif
59475947
# else
59485948
# ifdef __cpp_lib_shared_mutex
5949-
# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
5949+
# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
59505950
# endif
59515951
# endif
59525952

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

5967-
# if _LIBCPP_HAS_THREADS
5967+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
59685968
# ifndef __cpp_lib_shared_timed_mutex
59695969
# error "__cpp_lib_shared_timed_mutex should be defined in c++23"
59705970
# endif
@@ -5973,7 +5973,7 @@
59735973
# endif
59745974
# else
59755975
# ifdef __cpp_lib_shared_timed_mutex
5976-
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
5976+
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
59775977
# endif
59785978
# endif
59795979

@@ -7857,7 +7857,7 @@
78577857
# endif
78587858
# endif
78597859

7860-
# if _LIBCPP_HAS_THREADS
7860+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
78617861
# ifndef __cpp_lib_shared_mutex
78627862
# error "__cpp_lib_shared_mutex should be defined in c++26"
78637863
# endif
@@ -7866,7 +7866,7 @@
78667866
# endif
78677867
# else
78687868
# ifdef __cpp_lib_shared_mutex
7869-
# error "__cpp_lib_shared_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
7869+
# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
78707870
# endif
78717871
# endif
78727872

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

7887-
# if _LIBCPP_HAS_THREADS
7887+
# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
78887888
# ifndef __cpp_lib_shared_timed_mutex
78897889
# error "__cpp_lib_shared_timed_mutex should be defined in c++26"
78907890
# endif
@@ -7893,7 +7893,7 @@
78937893
# endif
78947894
# else
78957895
# ifdef __cpp_lib_shared_timed_mutex
7896-
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '_LIBCPP_HAS_THREADS' is not met!"
7896+
# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
78977897
# endif
78987898
# endif
78997899

libcxx/utils/generate_feature_test_macro_components.py

Lines changed: 2 additions & 2 deletions
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)