• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 */
22 
23 #include <format>
24 #include "test_macros.h"
25 
26 #if TEST_STD_VER < 14
27 
28 # ifdef __cpp_lib_format
29 #   error "__cpp_lib_format should not be defined before c++20"
30 # endif
31 
32 # ifdef __cpp_lib_format_ranges
33 #   error "__cpp_lib_format_ranges should not be defined before c++23"
34 # endif
35 
36 #elif TEST_STD_VER == 14
37 
38 # ifdef __cpp_lib_format
39 #   error "__cpp_lib_format should not be defined before c++20"
40 # endif
41 
42 # ifdef __cpp_lib_format_ranges
43 #   error "__cpp_lib_format_ranges should not be defined before c++23"
44 # endif
45 
46 #elif TEST_STD_VER == 17
47 
48 # ifdef __cpp_lib_format
49 #   error "__cpp_lib_format should not be defined before c++20"
50 # endif
51 
52 # ifdef __cpp_lib_format_ranges
53 #   error "__cpp_lib_format_ranges should not be defined before c++23"
54 # endif
55 
56 #elif TEST_STD_VER == 20
57 
58 # if !defined(_LIBCPP_VERSION)
59 #   ifndef __cpp_lib_format
60 #     error "__cpp_lib_format should be defined in c++20"
61 #   endif
62 #   if __cpp_lib_format != 202106L
63 #     error "__cpp_lib_format should have the value 202106L in c++20"
64 #   endif
65 # else // _LIBCPP_VERSION
66 #   ifdef __cpp_lib_format
67 #     error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
68 #   endif
69 # endif
70 
71 # ifdef __cpp_lib_format_ranges
72 #   error "__cpp_lib_format_ranges should not be defined before c++23"
73 # endif
74 
75 #elif TEST_STD_VER == 23
76 
77 # if !defined(_LIBCPP_VERSION)
78 #   ifndef __cpp_lib_format
79 #     error "__cpp_lib_format should be defined in c++23"
80 #   endif
81 #   if __cpp_lib_format != 202106L
82 #     error "__cpp_lib_format should have the value 202106L in c++23"
83 #   endif
84 # else // _LIBCPP_VERSION
85 #   ifdef __cpp_lib_format
86 #     error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
87 #   endif
88 # endif
89 
90 # ifndef __cpp_lib_format_ranges
91 #   error "__cpp_lib_format_ranges should be defined in c++23"
92 # endif
93 # if __cpp_lib_format_ranges != 202207L
94 #   error "__cpp_lib_format_ranges should have the value 202207L in c++23"
95 # endif
96 
97 #elif TEST_STD_VER > 23
98 
99 # if !defined(_LIBCPP_VERSION)
100 #   ifndef __cpp_lib_format
101 #     error "__cpp_lib_format should be defined in c++26"
102 #   endif
103 #   if __cpp_lib_format != 202106L
104 #     error "__cpp_lib_format should have the value 202106L in c++26"
105 #   endif
106 # else // _LIBCPP_VERSION
107 #   ifdef __cpp_lib_format
108 #     error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
109 #   endif
110 # endif
111 
112 # ifndef __cpp_lib_format_ranges
113 #   error "__cpp_lib_format_ranges should be defined in c++26"
114 # endif
115 # if __cpp_lib_format_ranges != 202207L
116 #   error "__cpp_lib_format_ranges should have the value 202207L in c++26"
117 # endif
118 
119 #endif // TEST_STD_VER > 23
120 
121