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