diff --git a/include/fmt/args.h b/include/fmt/args.h index b77a2d06..71c3bb90 100644 --- a/include/fmt/args.h +++ b/include/fmt/args.h @@ -8,9 +8,11 @@ #ifndef FMT_ARGS_H_ #define FMT_ARGS_H_ -#include // std::reference_wrapper -#include // std::unique_ptr -#include +#ifndef FMT_IMPORT_STD +# include // std::reference_wrapper +# include // std::unique_ptr +# include +#endif #include "format.h" // std_string_view diff --git a/include/fmt/base.h b/include/fmt/base.h index f46d7e47..50249f2c 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -12,9 +12,13 @@ #include // FILE #include // strlen +#ifndef FMT_IMPORT_STD // is also included transitively from . -#include // std::byte -#include // std::enable_if +# include // std::byte +# include // std::enable_if +#else +import std; +#endif // The fmt library version in the form major * 10000 + minor * 100 + patch. #define FMT_VERSION 100202 diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index d2e10b56..6360d903 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -8,15 +8,17 @@ #ifndef FMT_CHRONO_H_ #define FMT_CHRONO_H_ -#include -#include -#include // std::isfinite -#include // std::memcpy -#include -#include -#include -#include -#include +#ifndef FMT_IMPORT_STD +# include +# include +# include // std::isfinite +# include // std::memcpy +# include +# include +# include +# include +# include +#endif #include "format.h" diff --git a/include/fmt/compile.h b/include/fmt/compile.h index d6278521..65c68a4b 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -8,7 +8,9 @@ #ifndef FMT_COMPILE_H_ #define FMT_COMPILE_H_ -#include // std::back_inserter +#ifndef FMT_IMPORT_STD +# include // std::back_inserter +#endif #include "format.h" diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 5a9afd1f..fca26d47 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -8,13 +8,15 @@ #ifndef FMT_FORMAT_INL_H_ #define FMT_FORMAT_INL_H_ -#include +#ifndef FMT_IMPORT_STD +# include +# include +# include +#endif #include // errno #include -#include -#include -#ifndef FMT_STATIC_THOUSANDS_SEPARATOR +#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR) && !defined(FMT_IMPORT_STD) # include #endif diff --git a/include/fmt/format.h b/include/fmt/format.h index 8ab8f263..884ba3b6 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -38,30 +38,35 @@ # define FMT_REMOVE_TRANSITIVE_INCLUDES #endif -#include // std::signbit -#include // uint32_t -#include // std::memcpy -#include // std::initializer_list -#include // std::numeric_limits -#if defined(__GLIBCXX__) && !defined(_GLIBCXX_USE_DUAL_ABI) +#ifndef FMT_IMPORT_STD +# include // std::signbit +# include // uint32_t +# include // std::memcpy +# include // std::initializer_list +# include // std::numeric_limits +# if defined(__GLIBCXX__) && !defined(_GLIBCXX_USE_DUAL_ABI) // Workaround for pre gcc 5 libstdc++. -# include // std::allocator_traits +# include // std::allocator_traits +# endif +# include // std::runtime_error +# include // std::string +# include // std::system_error #endif -#include // std::runtime_error -#include // std::string -#include // std::system_error #include "base.h" // Checking FMT_CPLUSPLUS for warning suppression in MSVC. -#if FMT_HAS_INCLUDE() && FMT_CPLUSPLUS > 201703L +#if FMT_HAS_INCLUDE() && FMT_CPLUSPLUS > 201703L && \ + !defined(FMT_IMPORT_STD) # include // std::bit_cast #endif // libc++ supports string_view in pre-c++17. #if FMT_HAS_INCLUDE() && \ (FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION)) -# include +# ifndef FMT_IMPORT_STD +# include +# endif # define FMT_USE_STRING_VIEW #endif diff --git a/include/fmt/os.h b/include/fmt/os.h index 3a10c930..728a613b 100644 --- a/include/fmt/os.h +++ b/include/fmt/os.h @@ -9,9 +9,11 @@ #define FMT_OS_H_ #include -#include -#include -#include // std::system_error +#ifndef FMT_IMPORT_STD +# include +# include +# include // std::system_error +#endif #include "format.h" diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index f9ba9d7b..7ab24580 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -8,7 +8,9 @@ #ifndef FMT_OSTREAM_H_ #define FMT_OSTREAM_H_ -#include // std::filebuf +#ifndef FMT_IMPORT_STD +# include // std::filebuf +#endif #ifdef _WIN32 # ifdef __GLIBCXX__ diff --git a/include/fmt/printf.h b/include/fmt/printf.h index c060952d..fb57d235 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -8,8 +8,10 @@ #ifndef FMT_PRINTF_H_ #define FMT_PRINTF_H_ -#include // std::max -#include // std::numeric_limits +#ifndef FMT_IMPORT_STD +# include // std::max +# include // std::numeric_limits +#endif #include "format.h" diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index f2b0f0e9..86f9e01e 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -8,10 +8,12 @@ #ifndef FMT_RANGES_H_ #define FMT_RANGES_H_ -#include -#include -#include -#include +#ifndef FMT_IMPORT_STD +# include +# include +# include +# include +#endif #include "format.h" diff --git a/include/fmt/std.h b/include/fmt/std.h index 7085cae8..5a5026f9 100644 --- a/include/fmt/std.h +++ b/include/fmt/std.h @@ -8,17 +8,19 @@ #ifndef FMT_STD_H_ #define FMT_STD_H_ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#ifndef FMT_IMPORT_STD +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#endif #include "format.h" #include "ostream.h" @@ -26,25 +28,28 @@ #if FMT_HAS_INCLUDE() # include #endif + +#ifndef FMT_IMPORT_STD // Checking FMT_CPLUSPLUS for warning suppression in MSVC. -#if FMT_CPLUSPLUS >= 201703L -# if FMT_HAS_INCLUDE() -# include +# if FMT_CPLUSPLUS >= 201703L +# if FMT_HAS_INCLUDE() +# include +# endif +# if FMT_HAS_INCLUDE() +# include +# endif +# if FMT_HAS_INCLUDE() +# include +# endif # endif -# if FMT_HAS_INCLUDE() -# include -# endif -# if FMT_HAS_INCLUDE() -# include -# endif -#endif -#if FMT_HAS_INCLUDE() && FMT_CPLUSPLUS > 202002L -# include -#endif +# if FMT_HAS_INCLUDE() && FMT_CPLUSPLUS > 202002L +# include +# endif -#if FMT_CPLUSPLUS > 201703L && FMT_HAS_INCLUDE() -# include +# if FMT_CPLUSPLUS > 201703L && FMT_HAS_INCLUDE() +# include +# endif #endif // GCC 4 does not support FMT_HAS_INCLUDE. diff --git a/include/fmt/xchar.h b/include/fmt/xchar.h index 61a4b54f..557dbe1d 100644 --- a/include/fmt/xchar.h +++ b/include/fmt/xchar.h @@ -8,13 +8,15 @@ #ifndef FMT_XCHAR_H_ #define FMT_XCHAR_H_ -#include +#ifndef FMT_IMPORT_STD +# include +#endif #include "color.h" #include "format.h" #include "ranges.h" -#ifndef FMT_STATIC_THOUSANDS_SEPARATOR +#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR) && !defined(FMT_IMPORT_STD) # include #endif diff --git a/src/fmt.cc b/src/fmt.cc index 6cff309d..bb3845f2 100644 --- a/src/fmt.cc +++ b/src/fmt.cc @@ -2,37 +2,44 @@ module; // Put all implementation-provided headers into the global module fragment // to prevent attachment to this module. -#include +#ifndef FMT_IMPORT_STD +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#else +# include +# include +# include +# include +#endif #include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #if __has_include()