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 // UNSUPPORTED: no-filesystem
15 
16 // <filesystem>
17 
18 // Test the feature test macros defined by <filesystem>
19 
20 /*  Constant                 Value
21     __cpp_lib_char8_t        201907L [C++20]
22     __cpp_lib_filesystem     201703L [C++17]
23     __cpp_lib_format_path    202403L [C++23]
24 */
25 
26 #include <filesystem>
27 #include "test_macros.h"
28 
29 #if TEST_STD_VER < 14
30 
31 # ifdef __cpp_lib_char8_t
32 #   error "__cpp_lib_char8_t should not be defined before c++20"
33 # endif
34 
35 # ifdef __cpp_lib_filesystem
36 #   error "__cpp_lib_filesystem should not be defined before c++17"
37 # endif
38 
39 # ifdef __cpp_lib_format_path
40 #   error "__cpp_lib_format_path should not be defined before c++23"
41 # endif
42 
43 #elif TEST_STD_VER == 14
44 
45 # ifdef __cpp_lib_char8_t
46 #   error "__cpp_lib_char8_t should not be defined before c++20"
47 # endif
48 
49 # ifdef __cpp_lib_filesystem
50 #   error "__cpp_lib_filesystem should not be defined before c++17"
51 # endif
52 
53 # ifdef __cpp_lib_format_path
54 #   error "__cpp_lib_format_path should not be defined before c++23"
55 # endif
56 
57 #elif TEST_STD_VER == 17
58 
59 # ifdef __cpp_lib_char8_t
60 #   error "__cpp_lib_char8_t should not be defined before c++20"
61 # endif
62 
63 # if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
64 #   ifndef __cpp_lib_filesystem
65 #     error "__cpp_lib_filesystem should be defined in c++17"
66 #   endif
67 #   if __cpp_lib_filesystem != 201703L
68 #     error "__cpp_lib_filesystem should have the value 201703L in c++17"
69 #   endif
70 # else
71 #   ifdef __cpp_lib_filesystem
72 #     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
73 #   endif
74 # endif
75 
76 # ifdef __cpp_lib_format_path
77 #   error "__cpp_lib_format_path should not be defined before c++23"
78 # endif
79 
80 #elif TEST_STD_VER == 20
81 
82 # if defined(__cpp_char8_t)
83 #   ifndef __cpp_lib_char8_t
84 #     error "__cpp_lib_char8_t should be defined in c++20"
85 #   endif
86 #   if __cpp_lib_char8_t != 201907L
87 #     error "__cpp_lib_char8_t should have the value 201907L in c++20"
88 #   endif
89 # else
90 #   ifdef __cpp_lib_char8_t
91 #     error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
92 #   endif
93 # endif
94 
95 # if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
96 #   ifndef __cpp_lib_filesystem
97 #     error "__cpp_lib_filesystem should be defined in c++20"
98 #   endif
99 #   if __cpp_lib_filesystem != 201703L
100 #     error "__cpp_lib_filesystem should have the value 201703L in c++20"
101 #   endif
102 # else
103 #   ifdef __cpp_lib_filesystem
104 #     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
105 #   endif
106 # endif
107 
108 # ifdef __cpp_lib_format_path
109 #   error "__cpp_lib_format_path should not be defined before c++23"
110 # endif
111 
112 #elif TEST_STD_VER == 23
113 
114 # if defined(__cpp_char8_t)
115 #   ifndef __cpp_lib_char8_t
116 #     error "__cpp_lib_char8_t should be defined in c++23"
117 #   endif
118 #   if __cpp_lib_char8_t != 201907L
119 #     error "__cpp_lib_char8_t should have the value 201907L in c++23"
120 #   endif
121 # else
122 #   ifdef __cpp_lib_char8_t
123 #     error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
124 #   endif
125 # endif
126 
127 # if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
128 #   ifndef __cpp_lib_filesystem
129 #     error "__cpp_lib_filesystem should be defined in c++23"
130 #   endif
131 #   if __cpp_lib_filesystem != 201703L
132 #     error "__cpp_lib_filesystem should have the value 201703L in c++23"
133 #   endif
134 # else
135 #   ifdef __cpp_lib_filesystem
136 #     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
137 #   endif
138 # endif
139 
140 # if !defined(_LIBCPP_VERSION)
141 #   ifndef __cpp_lib_format_path
142 #     error "__cpp_lib_format_path should be defined in c++23"
143 #   endif
144 #   if __cpp_lib_format_path != 202403L
145 #     error "__cpp_lib_format_path should have the value 202403L in c++23"
146 #   endif
147 # else // _LIBCPP_VERSION
148 #   ifdef __cpp_lib_format_path
149 #     error "__cpp_lib_format_path should not be defined because it is unimplemented in libc++!"
150 #   endif
151 # endif
152 
153 #elif TEST_STD_VER > 23
154 
155 # if defined(__cpp_char8_t)
156 #   ifndef __cpp_lib_char8_t
157 #     error "__cpp_lib_char8_t should be defined in c++26"
158 #   endif
159 #   if __cpp_lib_char8_t != 201907L
160 #     error "__cpp_lib_char8_t should have the value 201907L in c++26"
161 #   endif
162 # else
163 #   ifdef __cpp_lib_char8_t
164 #     error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
165 #   endif
166 # endif
167 
168 # if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
169 #   ifndef __cpp_lib_filesystem
170 #     error "__cpp_lib_filesystem should be defined in c++26"
171 #   endif
172 #   if __cpp_lib_filesystem != 201703L
173 #     error "__cpp_lib_filesystem should have the value 201703L in c++26"
174 #   endif
175 # else
176 #   ifdef __cpp_lib_filesystem
177 #     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
178 #   endif
179 # endif
180 
181 # if !defined(_LIBCPP_VERSION)
182 #   ifndef __cpp_lib_format_path
183 #     error "__cpp_lib_format_path should be defined in c++26"
184 #   endif
185 #   if __cpp_lib_format_path != 202403L
186 #     error "__cpp_lib_format_path should have the value 202403L in c++26"
187 #   endif
188 # else // _LIBCPP_VERSION
189 #   ifdef __cpp_lib_format_path
190 #     error "__cpp_lib_format_path should not be defined because it is unimplemented in libc++!"
191 #   endif
192 # endif
193 
194 #endif // TEST_STD_VER > 23
195 
196