| 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 | // UNSUPPORTED: no-localization |
| 13 | |
| 14 | // <ostream> |
| 15 | |
| 16 | // Test the feature test macros defined by <ostream> |
| 17 | |
| 18 | // clang-format off |
| 19 | |
| 20 | #include <ostream> |
| 21 | #include "test_macros.h" |
| 22 | |
| 23 | #if TEST_STD_VER < 14 |
| 24 | |
| 25 | # ifdef __cpp_lib_char8_t |
| 26 | # error "__cpp_lib_char8_t should not be defined before c++20" |
| 27 | # endif |
| 28 | |
| 29 | # ifdef __cpp_lib_print |
| 30 | # error "__cpp_lib_print should not be defined before c++23" |
| 31 | # endif |
| 32 | |
| 33 | #elif TEST_STD_VER == 14 |
| 34 | |
| 35 | # ifdef __cpp_lib_char8_t |
| 36 | # error "__cpp_lib_char8_t should not be defined before c++20" |
| 37 | # endif |
| 38 | |
| 39 | # ifdef __cpp_lib_print |
| 40 | # error "__cpp_lib_print should not be defined before c++23" |
| 41 | # endif |
| 42 | |
| 43 | #elif TEST_STD_VER == 17 |
| 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_print |
| 50 | # error "__cpp_lib_print should not be defined before c++23" |
| 51 | # endif |
| 52 | |
| 53 | #elif TEST_STD_VER == 20 |
| 54 | |
| 55 | # if defined(__cpp_char8_t) |
| 56 | # ifndef __cpp_lib_char8_t |
| 57 | # error "__cpp_lib_char8_t should be defined in c++20" |
| 58 | # endif |
| 59 | # if __cpp_lib_char8_t != 201907L |
| 60 | # error "__cpp_lib_char8_t should have the value 201907L in c++20" |
| 61 | # endif |
| 62 | # else |
| 63 | # ifdef __cpp_lib_char8_t |
| 64 | # error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!" |
| 65 | # endif |
| 66 | # endif |
| 67 | |
| 68 | # ifdef __cpp_lib_print |
| 69 | # error "__cpp_lib_print should not be defined before c++23" |
| 70 | # endif |
| 71 | |
| 72 | #elif TEST_STD_VER == 23 |
| 73 | |
| 74 | # if defined(__cpp_char8_t) |
| 75 | # ifndef __cpp_lib_char8_t |
| 76 | # error "__cpp_lib_char8_t should be defined in c++23" |
| 77 | # endif |
| 78 | # if __cpp_lib_char8_t != 201907L |
| 79 | # error "__cpp_lib_char8_t should have the value 201907L in c++23" |
| 80 | # endif |
| 81 | # else |
| 82 | # ifdef __cpp_lib_char8_t |
| 83 | # error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!" |
| 84 | # endif |
| 85 | # endif |
| 86 | |
| 87 | # if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT |
| 88 | # ifndef __cpp_lib_print |
| 89 | # error "__cpp_lib_print should be defined in c++23" |
| 90 | # endif |
| 91 | # if __cpp_lib_print != 202207L |
| 92 | # error "__cpp_lib_print should have the value 202207L in c++23" |
| 93 | # endif |
| 94 | # else |
| 95 | # ifdef __cpp_lib_print |
| 96 | # error "__cpp_lib_print should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT' is not met!" |
| 97 | # endif |
| 98 | # endif |
| 99 | |
| 100 | #elif TEST_STD_VER > 23 |
| 101 | |
| 102 | # if defined(__cpp_char8_t) |
| 103 | # ifndef __cpp_lib_char8_t |
| 104 | # error "__cpp_lib_char8_t should be defined in c++26" |
| 105 | # endif |
| 106 | # if __cpp_lib_char8_t != 201907L |
| 107 | # error "__cpp_lib_char8_t should have the value 201907L in c++26" |
| 108 | # endif |
| 109 | # else |
| 110 | # ifdef __cpp_lib_char8_t |
| 111 | # error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!" |
| 112 | # endif |
| 113 | # endif |
| 114 | |
| 115 | # if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT |
| 116 | # ifndef __cpp_lib_print |
| 117 | # error "__cpp_lib_print should be defined in c++26" |
| 118 | # endif |
| 119 | # if __cpp_lib_print != 202207L |
| 120 | # error "__cpp_lib_print should have the value 202207L in c++26" |
| 121 | # endif |
| 122 | # else |
| 123 | # ifdef __cpp_lib_print |
| 124 | # error "__cpp_lib_print should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT' is not met!" |
| 125 | # endif |
| 126 | # endif |
| 127 | |
| 128 | #endif // TEST_STD_VER > 23 |
| 129 | |
| 130 | // clang-format on |
| 131 | |
| 132 | |