Skip to content

Commit

Permalink
Add a Standard mode check to <__msvc_print.hpp> (#4111)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanTLavavej authored Oct 25, 2023
1 parent 0b9ec10 commit 43fd331
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 15 deletions.
4 changes: 4 additions & 0 deletions stl/inc/__msvc_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR

#ifndef __cpp_lib_concepts // note: <format> includes this header in C++20 mode
#error The contents of <print> are available only with C++23. (Also, you should not include this internal header.)
#endif // ^^^ !defined(__cpp_lib_concepts) ^^^

#include <cstdio>
#include <xfilesystem_abi.h>

Expand Down
4 changes: 2 additions & 2 deletions stl/inc/ostream
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#if _STL_COMPILER_PREPROCESSOR
#include <ios>

#if _HAS_CXX23
#ifdef __cpp_lib_print
#include <__msvc_filebuf.hpp>
#include <__msvc_print.hpp>
#include <format>
#endif // _HAS_CXX23
#endif // ^^^ defined(__cpp_lib_print) ^^^

#pragma pack(push, _CRT_PACKING)
#pragma warning(push, _STL_WARNING_LEVEL)
Expand Down
8 changes: 4 additions & 4 deletions stl/inc/xcharconv.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR

#include <cstdint>
#include <type_traits>
#include <xerrc.h>

#if !_HAS_CXX17
#error The contents of <charconv> are only available with C++17. (Also, you should not include this internal header.)
#endif // !_HAS_CXX17

#include <cstdint>
#include <type_traits>
#include <xerrc.h>

#pragma pack(push, _CRT_PACKING)
#pragma warning(push, _STL_WARNING_LEVEL)
#pragma warning(disable : _STL_DISABLED_WARNINGS)
Expand Down
8 changes: 4 additions & 4 deletions stl/inc/xcharconv_ryu.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR

#if !_HAS_CXX17
#error The contents of <charconv> are only available with C++17. (Also, you should not include this internal header.)
#endif // !_HAS_CXX17

#include <cstring>
#include <type_traits>
#include <utility>
Expand All @@ -54,10 +58,6 @@
#include _STL_INTRIN_HEADER // for _umul128() and __shiftright128()
#endif // ^^^ intrinsics available ^^^

#if !_HAS_CXX17
#error The contents of <charconv> are only available with C++17. (Also, you should not include this internal header.)
#endif // !_HAS_CXX17

#pragma pack(push, _CRT_PACKING)
#pragma warning(push, _STL_WARNING_LEVEL)
#pragma warning(disable : _STL_DISABLED_WARNINGS)
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/xcharconv_ryu_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR

#include <cstdint>

#if !_HAS_CXX17
#error The contents of <charconv> are only available with C++17. (Also, you should not include this internal header.)
#endif // !_HAS_CXX17

#include <cstdint>

#pragma pack(push, _CRT_PACKING)
#pragma warning(push, _STL_WARNING_LEVEL)
#pragma warning(disable : _STL_DISABLED_WARNINGS)
Expand Down
3 changes: 2 additions & 1 deletion stl/inc/xnode_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
#define _XNODE_HANDLE_H
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR
#include <xmemory>

#if !_HAS_CXX17
#error Node handles are only available with C++17. (Also, you should not include this internal header.)
#endif // _HAS_CXX17

#include <xmemory>

#pragma pack(push, _CRT_PACKING)
#pragma warning(push, _STL_WARNING_LEVEL)
#pragma warning(disable : _STL_DISABLED_WARNINGS)
Expand Down
4 changes: 2 additions & 2 deletions tests/std/tests/GH_001411_core_headers/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include <xfilesystem_abi.h>
#endif // _HAS_CXX17

#if _HAS_CXX23
#ifdef __cpp_lib_concepts
#include <__msvc_print.hpp>
#endif // _HAS_CXX23
#endif // ^^^ defined(__cpp_lib_concepts) ^^^

// <__msvc_bit_utils.hpp> is included by <bit> and <limits>
// <__msvc_iter_core.hpp> is included by <tuple>
Expand Down

0 comments on commit 43fd331

Please sign in to comment.