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++26]
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++26"
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++26"
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) || (_LIBCPP_HAS_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) || (_LIBCPP_HAS_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++26"
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) || (_LIBCPP_HAS_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) || (_LIBCPP_HAS_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++26"
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) || (_LIBCPP_HAS_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) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
137 #   endif
138 # endif
139 
140 # ifdef __cpp_lib_format_path
141 #   error "__cpp_lib_format_path should not be defined before c++26"
142 # endif
143 
144 #elif TEST_STD_VER > 23
145 
146 # if defined(__cpp_char8_t)
147 #   ifndef __cpp_lib_char8_t
148 #     error "__cpp_lib_char8_t should be defined in c++26"
149 #   endif
150 #   if __cpp_lib_char8_t != 201907L
151 #     error "__cpp_lib_char8_t should have the value 201907L in c++26"
152 #   endif
153 # else
154 #   ifdef __cpp_lib_char8_t
155 #     error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
156 #   endif
157 # endif
158 
159 # if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
160 #   ifndef __cpp_lib_filesystem
161 #     error "__cpp_lib_filesystem should be defined in c++26"
162 #   endif
163 #   if __cpp_lib_filesystem != 201703L
164 #     error "__cpp_lib_filesystem should have the value 201703L in c++26"
165 #   endif
166 # else
167 #   ifdef __cpp_lib_filesystem
168 #     error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
169 #   endif
170 # endif
171 
172 # if !defined(_LIBCPP_VERSION)
173 #   ifndef __cpp_lib_format_path
174 #     error "__cpp_lib_format_path should be defined in c++26"
175 #   endif
176 #   if __cpp_lib_format_path != 202403L
177 #     error "__cpp_lib_format_path should have the value 202403L in c++26"
178 #   endif
179 # else // _LIBCPP_VERSION
180 #   ifdef __cpp_lib_format_path
181 #     error "__cpp_lib_format_path should not be defined because it is unimplemented in libc++!"
182 #   endif
183 # endif
184 
185 #endif // TEST_STD_VER > 23
186 
187