• 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 // UNSUPPORTED: libcpp-has-no-incomplete-format
15 
16 // <format>
17 
18 // Test the feature test macros defined by <format>
19 
20 /*  Constant                   Value
21     __cpp_lib_format           202106L [C++20]
22     __cpp_lib_format_ranges    202207L [C++2b]
23 */
24 
25 #include <format>
26 #include "test_macros.h"
27 
28 #if TEST_STD_VER < 14
29 
30 # ifdef __cpp_lib_format
31 #   error "__cpp_lib_format should not be defined before c++20"
32 # endif
33 
34 # ifdef __cpp_lib_format_ranges
35 #   error "__cpp_lib_format_ranges should not be defined before c++2b"
36 # endif
37 
38 #elif TEST_STD_VER == 14
39 
40 # ifdef __cpp_lib_format
41 #   error "__cpp_lib_format should not be defined before c++20"
42 # endif
43 
44 # ifdef __cpp_lib_format_ranges
45 #   error "__cpp_lib_format_ranges should not be defined before c++2b"
46 # endif
47 
48 #elif TEST_STD_VER == 17
49 
50 # ifdef __cpp_lib_format
51 #   error "__cpp_lib_format should not be defined before c++20"
52 # endif
53 
54 # ifdef __cpp_lib_format_ranges
55 #   error "__cpp_lib_format_ranges should not be defined before c++2b"
56 # endif
57 
58 #elif TEST_STD_VER == 20
59 
60 # if !defined(_LIBCPP_VERSION)
61 #   ifndef __cpp_lib_format
62 #     error "__cpp_lib_format should be defined in c++20"
63 #   endif
64 #   if __cpp_lib_format != 202106L
65 #     error "__cpp_lib_format should have the value 202106L in c++20"
66 #   endif
67 # else // _LIBCPP_VERSION
68 #   ifdef __cpp_lib_format
69 #     error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
70 #   endif
71 # endif
72 
73 # ifdef __cpp_lib_format_ranges
74 #   error "__cpp_lib_format_ranges should not be defined before c++2b"
75 # endif
76 
77 #elif TEST_STD_VER > 20
78 
79 # if !defined(_LIBCPP_VERSION)
80 #   ifndef __cpp_lib_format
81 #     error "__cpp_lib_format should be defined in c++2b"
82 #   endif
83 #   if __cpp_lib_format != 202106L
84 #     error "__cpp_lib_format should have the value 202106L in c++2b"
85 #   endif
86 # else // _LIBCPP_VERSION
87 #   ifdef __cpp_lib_format
88 #     error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
89 #   endif
90 # endif
91 
92 # if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
93 #   ifndef __cpp_lib_format_ranges
94 #     error "__cpp_lib_format_ranges should be defined in c++2b"
95 #   endif
96 #   if __cpp_lib_format_ranges != 202207L
97 #     error "__cpp_lib_format_ranges should have the value 202207L in c++2b"
98 #   endif
99 # else
100 #   ifdef __cpp_lib_format_ranges
101 #     error "__cpp_lib_format_ranges should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)' is not met!"
102 #   endif
103 # endif
104 
105 #endif // TEST_STD_VER > 20
106 
107