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 */
24 
25 #include <filesystem>
26 #include "test_macros.h"
27 
28 #if TEST_STD_VER < 14
29 
30 # ifdef __cpp_lib_char8_t
31 #   error "__cpp_lib_char8_t should not be defined before c++20"
32 # endif
33 
34 # ifdef __cpp_lib_filesystem
35 #   error "__cpp_lib_filesystem should not be defined before c++17"
36 # endif
37 
38 #elif TEST_STD_VER == 14
39 
40 # ifdef __cpp_lib_char8_t
41 #   error "__cpp_lib_char8_t should not be defined before c++20"
42 # endif
43 
44 # ifdef __cpp_lib_filesystem
45 #   error "__cpp_lib_filesystem should not be defined before c++17"
46 # endif
47 
48 #elif TEST_STD_VER == 17
49 
50 # ifdef __cpp_lib_char8_t
51 #   error "__cpp_lib_char8_t should not be defined before c++20"
52 # endif
53 
54 # if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
55 #   ifndef __cpp_lib_filesystem
56 #     error "__cpp_lib_filesystem should be defined in c++17"
57 #   endif
58 #   if __cpp_lib_filesystem != 201703L
59 #     error "__cpp_lib_filesystem should have the value 201703L in c++17"
60 #   endif
61 # else
62 #   ifdef __cpp_lib_filesystem
63 #     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!"
64 #   endif
65 # endif
66 
67 #elif TEST_STD_VER == 20
68 
69 # if defined(__cpp_char8_t)
70 #   ifndef __cpp_lib_char8_t
71 #     error "__cpp_lib_char8_t should be defined in c++20"
72 #   endif
73 #   if __cpp_lib_char8_t != 201907L
74 #     error "__cpp_lib_char8_t should have the value 201907L in c++20"
75 #   endif
76 # else
77 #   ifdef __cpp_lib_char8_t
78 #     error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
79 #   endif
80 # endif
81 
82 # if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
83 #   ifndef __cpp_lib_filesystem
84 #     error "__cpp_lib_filesystem should be defined in c++20"
85 #   endif
86 #   if __cpp_lib_filesystem != 201703L
87 #     error "__cpp_lib_filesystem should have the value 201703L in c++20"
88 #   endif
89 # else
90 #   ifdef __cpp_lib_filesystem
91 #     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!"
92 #   endif
93 # endif
94 
95 #elif TEST_STD_VER == 23
96 
97 # if defined(__cpp_char8_t)
98 #   ifndef __cpp_lib_char8_t
99 #     error "__cpp_lib_char8_t should be defined in c++23"
100 #   endif
101 #   if __cpp_lib_char8_t != 201907L
102 #     error "__cpp_lib_char8_t should have the value 201907L in c++23"
103 #   endif
104 # else
105 #   ifdef __cpp_lib_char8_t
106 #     error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
107 #   endif
108 # endif
109 
110 # if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
111 #   ifndef __cpp_lib_filesystem
112 #     error "__cpp_lib_filesystem should be defined in c++23"
113 #   endif
114 #   if __cpp_lib_filesystem != 201703L
115 #     error "__cpp_lib_filesystem should have the value 201703L in c++23"
116 #   endif
117 # else
118 #   ifdef __cpp_lib_filesystem
119 #     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!"
120 #   endif
121 # endif
122 
123 #elif TEST_STD_VER > 23
124 
125 # if defined(__cpp_char8_t)
126 #   ifndef __cpp_lib_char8_t
127 #     error "__cpp_lib_char8_t should be defined in c++26"
128 #   endif
129 #   if __cpp_lib_char8_t != 201907L
130 #     error "__cpp_lib_char8_t should have the value 201907L in c++26"
131 #   endif
132 # else
133 #   ifdef __cpp_lib_char8_t
134 #     error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
135 #   endif
136 # endif
137 
138 # if !defined(_LIBCPP_VERSION) || (!defined(_LIBCPP_HAS_NO_FILESYSTEM) && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
139 #   ifndef __cpp_lib_filesystem
140 #     error "__cpp_lib_filesystem should be defined in c++26"
141 #   endif
142 #   if __cpp_lib_filesystem != 201703L
143 #     error "__cpp_lib_filesystem should have the value 201703L in c++26"
144 #   endif
145 # else
146 #   ifdef __cpp_lib_filesystem
147 #     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!"
148 #   endif
149 # endif
150 
151 #endif // TEST_STD_VER > 23
152 
153