diff --git a/stl/inc/__msvc_filebuf.hpp b/stl/inc/__msvc_filebuf.hpp index f64c923339..9f6738be1b 100644 --- a/stl/inc/__msvc_filebuf.hpp +++ b/stl/inc/__msvc_filebuf.hpp @@ -383,7 +383,7 @@ class basic_filebuf : public basic_streambuf<_Elem, _Traits> { // stream buffer } } -#if defined(__cpp_lib_print) && defined(_CPPRTTI) +#if _HAS_CXX23 && defined(_CPPRTTI) template friend ios_base::iostate _Print_noformat_unicode(ostream&, string_view); #endif diff --git a/stl/inc/ostream b/stl/inc/ostream index 1276eb0dc1..df2dd3f6b4 100644 --- a/stl/inc/ostream +++ b/stl/inc/ostream @@ -9,11 +9,11 @@ #if _STL_COMPILER_PREPROCESSOR #include -#ifdef __cpp_lib_print +#if _HAS_CXX23 #include <__msvc_filebuf.hpp> #include <__msvc_print.hpp> #include -#endif // ^^^ defined(__cpp_lib_print) ^^^ +#endif // ^^^ _HAS_CXX23 ^^^ #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) @@ -1088,7 +1088,7 @@ basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Ostr, return _Ostr << _Errcode.category().name() << ':' << _Errcode.value(); } -#ifdef __cpp_lib_print +#if _HAS_CXX23 #ifdef _CPPRTTI template ios_base::iostate _Print_noformat_nonunicode(ostream& _Ostr, const string_view _Str) { @@ -1289,7 +1289,7 @@ void println(ostream&, format_string<_Types...>, _Types&&...) = delete; // requi _EXPORT_STD void vprint_unicode(ostream&, string_view, format_args) = delete; // requires /GR option _EXPORT_STD void vprint_nonunicode(ostream&, string_view, format_args) = delete; // requires /GR option #endif // ^^^ !defined(_CPPRTTI) ^^^ -#endif // defined(__cpp_lib_print) +#endif // _HAS_CXX23 _STD_END diff --git a/stl/inc/print b/stl/inc/print index 312962f2f6..3d19c7aa4f 100644 --- a/stl/inc/print +++ b/stl/inc/print @@ -7,9 +7,9 @@ #define _PRINT_ #include #if _STL_COMPILER_PREPROCESSOR -#ifndef __cpp_lib_print +#if !_HAS_CXX23 _EMIT_STL_WARNING(STL4038, "The contents of are available only with C++23 or later."); -#else // ^^^ !defined(__cpp_lib_print) / defined(__cpp_lib_print) vvv +#else // ^^^ !_HAS_CXX23 / _HAS_CXX23 vvv #include <__msvc_print.hpp> #include @@ -163,6 +163,6 @@ _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) #pragma pack(pop) -#endif // ^^^ defined(__cpp_lib_print) ^^^ +#endif // ^^^ _HAS_CXX23 ^^^ #endif // _STL_COMPILER_PREPROCESSOR #endif // _PRINT_ diff --git a/stl/inc/ranges b/stl/inc/ranges index 73b5324dad..3b22786a0b 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -7,9 +7,9 @@ #define _RANGES_ #include #if _STL_COMPILER_PREPROCESSOR -#ifndef __cpp_lib_ranges +#if !_HAS_CXX20 _EMIT_STL_WARNING(STL4038, "The contents of are available only with C++20 or later."); -#else // ^^^ !defined(__cpp_lib_ranges) / defined(__cpp_lib_ranges) vvv +#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv #include <__msvc_int128.hpp> #include #include @@ -10261,7 +10261,6 @@ namespace ranges { _EXPORT_STD inline constexpr _Cartesian_product_fn cartesian_product; } // namespace views -#ifdef __cpp_lib_ranges_to_container template concept _Sized_and_reservable = sized_range<_Range> && sized_range<_Container> && requires(_Container& _Cont, const range_size_t<_Container> _Count) { @@ -10415,7 +10414,6 @@ namespace ranges { _NODISCARD constexpr auto to(_Types&&... _Args) { return _Range_closure<_To_template_fn<_Container>, decay_t<_Types>...>{_STD forward<_Types>(_Args)...}; } -#endif // defined(__cpp_lib_ranges_to_container) #endif // _HAS_CXX23 } // namespace ranges @@ -10427,6 +10425,6 @@ _STD_END _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) #pragma pack(pop) -#endif // ^^^ defined(__cpp_lib_ranges) ^^^ +#endif // ^^^ _HAS_CXX20 ^^^ #endif // _STL_COMPILER_PREPROCESSOR #endif // _RANGES_ diff --git a/tests/std/tests/Dev11_0000000_tuple_cat/test.cpp b/tests/std/tests/Dev11_0000000_tuple_cat/test.cpp index 4258b875f6..78a2377586 100644 --- a/tests/std/tests/Dev11_0000000_tuple_cat/test.cpp +++ b/tests/std/tests/Dev11_0000000_tuple_cat/test.cpp @@ -10,12 +10,12 @@ #include #include -#ifdef __cpp_lib_ranges +#if _HAS_CXX20 #include #include #include #include -#endif // __cpp_lib_ranges +#endif // _HAS_CXX20 using namespace std; @@ -231,7 +231,7 @@ int main() { } } -#ifdef __cpp_lib_ranges +#if _HAS_CXX20 { using ranges::subrange, ranges::subrange_kind; @@ -252,7 +252,7 @@ int main() { STATIC_ASSERT(is_same_v>); assert(cat7 == make_tuple(next(lst.begin()), prev(lst.end()), vec.begin() + 1, vec.cend() - 1)); } -#endif // __cpp_lib_ranges +#endif // _HAS_CXX20 // Also test C++17 apply() and make_from_tuple(). #if _HAS_CXX17 diff --git a/tests/std/tests/GH_000545_include_compare/test_stacktrace.cpp b/tests/std/tests/GH_000545_include_compare/test_stacktrace.cpp index 3439aa43c4..c6088a978c 100644 --- a/tests/std/tests/GH_000545_include_compare/test_stacktrace.cpp +++ b/tests/std/tests/GH_000545_include_compare/test_stacktrace.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#ifdef __cpp_lib_stacktrace +#if _HAS_CXX23 #include @@ -10,6 +10,6 @@ static_assert(std::is_eq(std::partial_ordering::equivalent)); -#endif // __cpp_lib_stacktrace +#endif // _HAS_CXX23 void test_stacktrace() {} diff --git a/tests/std/tests/GH_000690_overaligned_function/test.cpp b/tests/std/tests/GH_000690_overaligned_function/test.cpp index 573c14cf76..c94cd1b878 100644 --- a/tests/std/tests/GH_000690_overaligned_function/test.cpp +++ b/tests/std/tests/GH_000690_overaligned_function/test.cpp @@ -64,7 +64,7 @@ void test() { int main() { test>(); -#ifdef __cpp_lib_move_only_function +#if _HAS_CXX23 test>(); #endif } diff --git a/tests/std/tests/GH_001411_core_headers/test.cpp b/tests/std/tests/GH_001411_core_headers/test.cpp index 1bf1d87f6c..86e65268e6 100644 --- a/tests/std/tests/GH_001411_core_headers/test.cpp +++ b/tests/std/tests/GH_001411_core_headers/test.cpp @@ -51,11 +51,11 @@ void test_gh_2699() { assert(cats[1] == 50); assert(dogs[1] == 20); -#ifdef __cpp_lib_ranges +#if _HAS_CXX20 std::ranges::swap(cats, dogs); assert(cats[1] == 20); assert(dogs[1] == 50); -#endif // __cpp_lib_ranges +#endif // _HAS_CXX20 } int main() { diff --git a/tests/std/tests/P0769R2_shift_left_shift_right/test.cpp b/tests/std/tests/P0769R2_shift_left_shift_right/test.cpp index 96b62982c8..9adfed3e17 100644 --- a/tests/std/tests/P0769R2_shift_left_shift_right/test.cpp +++ b/tests/std/tests/P0769R2_shift_left_shift_right/test.cpp @@ -105,7 +105,7 @@ void test_case_shift_left(const ptrdiff_t tmpSize) { fill_iota(tmp, tmpSize); test_iota(tmp.begin(), shift_left(tmp.begin(), tmp.end(), pos_to_shift), pos_to_shift + 1, tmpSize); -#if __cpp_lib_shift >= 202202L +#if _HAS_CXX23 { fill_iota(tmp, tmpSize); auto [first, last] = ranges::shift_left(tmp.begin(), tmp.end(), pos_to_shift); @@ -119,7 +119,7 @@ void test_case_shift_left(const ptrdiff_t tmpSize) { assert(first == tmp.begin()); test_iota(first, last, pos_to_shift + 1, tmpSize); } -#endif // __cpp_lib_shift >= 202202L +#endif // _HAS_CXX23 } fill_iota(tmp, tmpSize); @@ -127,7 +127,7 @@ void test_case_shift_left(const ptrdiff_t tmpSize) { test_iota(shift_left(tmp.begin(), tmp.end(), tmpSize + i), tmp.end(), 1, tmpSize); } -#if __cpp_lib_shift >= 202202L +#if _HAS_CXX23 fill_iota(tmp, tmpSize); for (int i = 0; i < 3; ++i) { auto [first, last] = ranges::shift_left(tmp.begin(), tmp.end(), tmpSize + i); @@ -141,7 +141,7 @@ void test_case_shift_left(const ptrdiff_t tmpSize) { assert(first == tmp.begin()); test_iota(last, tmp.end(), 1, tmpSize); } -#endif // __cpp_lib_shift >= 202202L +#endif // _HAS_CXX23 } template @@ -153,7 +153,7 @@ void test_case_shift_right(const ptrdiff_t tmpSize) { fill_iota(tmp, tmpSize); test_iota(shift_right(tmp.begin(), tmp.end(), pos_to_shift), tmp.end(), 1, tmpSize - pos_to_shift); -#if __cpp_lib_shift >= 202202L +#if _HAS_CXX23 { fill_iota(tmp, tmpSize); auto [first, last] = ranges::shift_right(tmp.begin(), tmp.end(), pos_to_shift); @@ -167,7 +167,7 @@ void test_case_shift_right(const ptrdiff_t tmpSize) { assert(last == tmp.end()); test_iota(first, last, 1, tmpSize - pos_to_shift); } -#endif // __cpp_lib_shift >= 202202L +#endif // _HAS_CXX23 } fill_iota(tmp, tmpSize); @@ -175,7 +175,7 @@ void test_case_shift_right(const ptrdiff_t tmpSize) { test_iota(tmp.begin(), shift_right(tmp.begin(), tmp.end(), tmpSize + i), 1, tmpSize); } -#if __cpp_lib_shift >= 202202L +#if _HAS_CXX23 fill_iota(tmp, tmpSize); for (int i = 0; i < 3; ++i) { auto [first, last] = ranges::shift_right(tmp.begin(), tmp.end(), tmpSize + i); @@ -189,7 +189,7 @@ void test_case_shift_right(const ptrdiff_t tmpSize) { assert(last == tmp.end()); test_iota(tmp.begin(), first, 1, tmpSize); } -#endif // __cpp_lib_shift >= 202202L +#endif // _HAS_CXX23 } int main() {