1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // WARNING: This test was generated by generate_feature_test_macro_components.py
10 // and should not be edited manually.
11 //
12 // clang-format off
13 
14 // <string_view>
15 
16 // Test the feature test macros defined by <string_view>
17 
18 /*  Constant                              Value
19     __cpp_lib_char8_t                     201907L [C++20]
20     __cpp_lib_constexpr_string_view       201811L [C++20]
21     __cpp_lib_freestanding_string_view    202311L [C++26]
22     __cpp_lib_starts_ends_with            201711L [C++20]
23     __cpp_lib_string_contains             202011L [C++23]
24     __cpp_lib_string_view                 201606L [C++17]
25                                           201803L [C++20]
26                                           202403L [C++26]
27 */
28 
29 #include <string_view>
30 #include "test_macros.h"
31 
32 #if TEST_STD_VER < 14
33 
34 # ifdef __cpp_lib_char8_t
35 #   error "__cpp_lib_char8_t should not be defined before c++20"
36 # endif
37 
38 # ifdef __cpp_lib_constexpr_string_view
39 #   error "__cpp_lib_constexpr_string_view should not be defined before c++20"
40 # endif
41 
42 # ifdef __cpp_lib_freestanding_string_view
43 #   error "__cpp_lib_freestanding_string_view should not be defined before c++26"
44 # endif
45 
46 # ifdef __cpp_lib_starts_ends_with
47 #   error "__cpp_lib_starts_ends_with should not be defined before c++20"
48 # endif
49 
50 # ifdef __cpp_lib_string_contains
51 #   error "__cpp_lib_string_contains should not be defined before c++23"
52 # endif
53 
54 # ifdef __cpp_lib_string_view
55 #   error "__cpp_lib_string_view should not be defined before c++17"
56 # endif
57 
58 #elif TEST_STD_VER == 14
59 
60 # ifdef __cpp_lib_char8_t
61 #   error "__cpp_lib_char8_t should not be defined before c++20"
62 # endif
63 
64 # ifdef __cpp_lib_constexpr_string_view
65 #   error "__cpp_lib_constexpr_string_view should not be defined before c++20"
66 # endif
67 
68 # ifdef __cpp_lib_freestanding_string_view
69 #   error "__cpp_lib_freestanding_string_view should not be defined before c++26"
70 # endif
71 
72 # ifdef __cpp_lib_starts_ends_with
73 #   error "__cpp_lib_starts_ends_with should not be defined before c++20"
74 # endif
75 
76 # ifdef __cpp_lib_string_contains
77 #   error "__cpp_lib_string_contains should not be defined before c++23"
78 # endif
79 
80 # ifdef __cpp_lib_string_view
81 #   error "__cpp_lib_string_view should not be defined before c++17"
82 # endif
83 
84 #elif TEST_STD_VER == 17
85 
86 # ifdef __cpp_lib_char8_t
87 #   error "__cpp_lib_char8_t should not be defined before c++20"
88 # endif
89 
90 # ifdef __cpp_lib_constexpr_string_view
91 #   error "__cpp_lib_constexpr_string_view should not be defined before c++20"
92 # endif
93 
94 # ifdef __cpp_lib_freestanding_string_view
95 #   error "__cpp_lib_freestanding_string_view should not be defined before c++26"
96 # endif
97 
98 # ifdef __cpp_lib_starts_ends_with
99 #   error "__cpp_lib_starts_ends_with should not be defined before c++20"
100 # endif
101 
102 # ifdef __cpp_lib_string_contains
103 #   error "__cpp_lib_string_contains should not be defined before c++23"
104 # endif
105 
106 # ifndef __cpp_lib_string_view
107 #   error "__cpp_lib_string_view should be defined in c++17"
108 # endif
109 # if __cpp_lib_string_view != 201606L
110 #   error "__cpp_lib_string_view should have the value 201606L in c++17"
111 # endif
112 
113 #elif TEST_STD_VER == 20
114 
115 # if defined(__cpp_char8_t)
116 #   ifndef __cpp_lib_char8_t
117 #     error "__cpp_lib_char8_t should be defined in c++20"
118 #   endif
119 #   if __cpp_lib_char8_t != 201907L
120 #     error "__cpp_lib_char8_t should have the value 201907L in c++20"
121 #   endif
122 # else
123 #   ifdef __cpp_lib_char8_t
124 #     error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
125 #   endif
126 # endif
127 
128 # ifndef __cpp_lib_constexpr_string_view
129 #   error "__cpp_lib_constexpr_string_view should be defined in c++20"
130 # endif
131 # if __cpp_lib_constexpr_string_view != 201811L
132 #   error "__cpp_lib_constexpr_string_view should have the value 201811L in c++20"
133 # endif
134 
135 # ifdef __cpp_lib_freestanding_string_view
136 #   error "__cpp_lib_freestanding_string_view should not be defined before c++26"
137 # endif
138 
139 # ifndef __cpp_lib_starts_ends_with
140 #   error "__cpp_lib_starts_ends_with should be defined in c++20"
141 # endif
142 # if __cpp_lib_starts_ends_with != 201711L
143 #   error "__cpp_lib_starts_ends_with should have the value 201711L in c++20"
144 # endif
145 
146 # ifdef __cpp_lib_string_contains
147 #   error "__cpp_lib_string_contains should not be defined before c++23"
148 # endif
149 
150 # ifndef __cpp_lib_string_view
151 #   error "__cpp_lib_string_view should be defined in c++20"
152 # endif
153 # if __cpp_lib_string_view != 201803L
154 #   error "__cpp_lib_string_view should have the value 201803L in c++20"
155 # endif
156 
157 #elif TEST_STD_VER == 23
158 
159 # if defined(__cpp_char8_t)
160 #   ifndef __cpp_lib_char8_t
161 #     error "__cpp_lib_char8_t should be defined in c++23"
162 #   endif
163 #   if __cpp_lib_char8_t != 201907L
164 #     error "__cpp_lib_char8_t should have the value 201907L in c++23"
165 #   endif
166 # else
167 #   ifdef __cpp_lib_char8_t
168 #     error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
169 #   endif
170 # endif
171 
172 # ifndef __cpp_lib_constexpr_string_view
173 #   error "__cpp_lib_constexpr_string_view should be defined in c++23"
174 # endif
175 # if __cpp_lib_constexpr_string_view != 201811L
176 #   error "__cpp_lib_constexpr_string_view should have the value 201811L in c++23"
177 # endif
178 
179 # ifdef __cpp_lib_freestanding_string_view
180 #   error "__cpp_lib_freestanding_string_view should not be defined before c++26"
181 # endif
182 
183 # ifndef __cpp_lib_starts_ends_with
184 #   error "__cpp_lib_starts_ends_with should be defined in c++23"
185 # endif
186 # if __cpp_lib_starts_ends_with != 201711L
187 #   error "__cpp_lib_starts_ends_with should have the value 201711L in c++23"
188 # endif
189 
190 # ifndef __cpp_lib_string_contains
191 #   error "__cpp_lib_string_contains should be defined in c++23"
192 # endif
193 # if __cpp_lib_string_contains != 202011L
194 #   error "__cpp_lib_string_contains should have the value 202011L in c++23"
195 # endif
196 
197 # ifndef __cpp_lib_string_view
198 #   error "__cpp_lib_string_view should be defined in c++23"
199 # endif
200 # if __cpp_lib_string_view != 201803L
201 #   error "__cpp_lib_string_view should have the value 201803L in c++23"
202 # endif
203 
204 #elif TEST_STD_VER > 23
205 
206 # if defined(__cpp_char8_t)
207 #   ifndef __cpp_lib_char8_t
208 #     error "__cpp_lib_char8_t should be defined in c++26"
209 #   endif
210 #   if __cpp_lib_char8_t != 201907L
211 #     error "__cpp_lib_char8_t should have the value 201907L in c++26"
212 #   endif
213 # else
214 #   ifdef __cpp_lib_char8_t
215 #     error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
216 #   endif
217 # endif
218 
219 # ifndef __cpp_lib_constexpr_string_view
220 #   error "__cpp_lib_constexpr_string_view should be defined in c++26"
221 # endif
222 # if __cpp_lib_constexpr_string_view != 201811L
223 #   error "__cpp_lib_constexpr_string_view should have the value 201811L in c++26"
224 # endif
225 
226 # if !defined(_LIBCPP_VERSION)
227 #   ifndef __cpp_lib_freestanding_string_view
228 #     error "__cpp_lib_freestanding_string_view should be defined in c++26"
229 #   endif
230 #   if __cpp_lib_freestanding_string_view != 202311L
231 #     error "__cpp_lib_freestanding_string_view should have the value 202311L in c++26"
232 #   endif
233 # else // _LIBCPP_VERSION
234 #   ifdef __cpp_lib_freestanding_string_view
235 #     error "__cpp_lib_freestanding_string_view should not be defined because it is unimplemented in libc++!"
236 #   endif
237 # endif
238 
239 # ifndef __cpp_lib_starts_ends_with
240 #   error "__cpp_lib_starts_ends_with should be defined in c++26"
241 # endif
242 # if __cpp_lib_starts_ends_with != 201711L
243 #   error "__cpp_lib_starts_ends_with should have the value 201711L in c++26"
244 # endif
245 
246 # ifndef __cpp_lib_string_contains
247 #   error "__cpp_lib_string_contains should be defined in c++26"
248 # endif
249 # if __cpp_lib_string_contains != 202011L
250 #   error "__cpp_lib_string_contains should have the value 202011L in c++26"
251 # endif
252 
253 # ifndef __cpp_lib_string_view
254 #   error "__cpp_lib_string_view should be defined in c++26"
255 # endif
256 # if __cpp_lib_string_view != 202403L
257 #   error "__cpp_lib_string_view should have the value 202403L in c++26"
258 # endif
259 
260 #endif // TEST_STD_VER > 23
261 
262