diff --git a/include/fmt/args.h b/include/fmt/args.h index 10c1eb8f44c1..d45b965bc51a 100644 --- a/include/fmt/args.h +++ b/include/fmt/args.h @@ -8,7 +8,7 @@ #ifndef FMT_ARGS_H_ #define FMT_ARGS_H_ -#ifndef FMT_IMPORT_STD +#if !defined(FMT_IMPORT_STD) && !defined(FMT_MODULE) # include // std::reference_wrapper # include // std::unique_ptr # include diff --git a/include/fmt/base.h b/include/fmt/base.h index a1af876f06b7..396d268faaab 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -15,11 +15,11 @@ # include // strlen #endif -#ifndef FMT_IMPORT_STD +#if !defined(FMT_IMPORT_STD) && !defined(FMT_MODULE) // is also included transitively from . # include // std::byte # include // std::enable_if -#else +#elif !defined(FMT_MODULE) import std; #endif diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index 77d0403246ac..3406a4a673f2 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -8,7 +8,7 @@ #ifndef FMT_CHRONO_H_ #define FMT_CHRONO_H_ -#ifndef FMT_IMPORT_STD +#if !defined(FMT_IMPORT_STD) && !defined(FMT_MODULE) # include # include # include // std::isfinite diff --git a/include/fmt/compile.h b/include/fmt/compile.h index d77de3581839..a98e1bc0531b 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -8,7 +8,7 @@ #ifndef FMT_COMPILE_H_ #define FMT_COMPILE_H_ -#ifndef FMT_IMPORT_STD +#if !defined(FMT_IMPORT_STD) && !defined(FMT_MODULE) # include // std::back_inserter #endif diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 73f40f3d6bfe..db6d74d4c95f 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -8,16 +8,19 @@ #ifndef FMT_FORMAT_INL_H_ #define FMT_FORMAT_INL_H_ -#ifndef FMT_IMPORT_STD +#if !defined(FMT_IMPORT_STD) && !defined(FMT_MODULE) # include # include # include #endif -#include // errno -#include -#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR) && !defined(FMT_IMPORT_STD) -# include +#ifndef FMT_MODULE +# include // errno +# include + +# if !defined(FMT_STATIC_THOUSANDS_SEPARATOR) && !defined(FMT_IMPORT_STD) +# include +# endif #endif #if defined(_WIN32) && !defined(FMT_USE_WRITE_CONSOLE) diff --git a/include/fmt/format.h b/include/fmt/format.h index fa8debc13b71..bfdb2e0e3fe8 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -38,7 +38,7 @@ # define FMT_REMOVE_TRANSITIVE_INCLUDES #endif -#ifndef FMT_IMPORT_STD +#if !defined(FMT_IMPORT_STD) && !defined(FMT_MODULE) # include // std::signbit # include // uint32_t # include // std::memcpy @@ -57,14 +57,14 @@ // Checking FMT_CPLUSPLUS for warning suppression in MSVC. #if FMT_HAS_INCLUDE() && FMT_CPLUSPLUS > 201703L && \ - !defined(FMT_IMPORT_STD) + !defined(FMT_IMPORT_STD) && !defined(FMT_MODULE) # include // std::bit_cast #endif // libc++ supports string_view in pre-c++17. #if FMT_HAS_INCLUDE() && \ (FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION)) -# ifndef FMT_IMPORT_STD +# if !defined(FMT_IMPORT_STD) && !defined(FMT_MODULE) # include # endif # define FMT_USE_STRING_VIEW diff --git a/include/fmt/os.h b/include/fmt/os.h index fae18f166fb9..5462661a026a 100644 --- a/include/fmt/os.h +++ b/include/fmt/os.h @@ -8,17 +8,19 @@ #ifndef FMT_OS_H_ #define FMT_OS_H_ -#include -#ifndef FMT_IMPORT_STD -# include -# include -# include // std::system_error +#ifndef FMT_MODULE +# include +# ifndef FMT_IMPORT_STD +# include +# include +# include // std::system_error +# endif #endif #include "format.h" #if defined __APPLE__ || defined(__FreeBSD__) -# if FMT_HAS_INCLUDE() +# if FMT_HAS_INCLUDE() && !defined(FMT_MODULE) # include // for LC_NUMERIC_MASK on OS X # endif #endif diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index f05e0dcde035..0be26709dcd0 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -8,7 +8,7 @@ #ifndef FMT_OSTREAM_H_ #define FMT_OSTREAM_H_ -#ifndef FMT_IMPORT_STD +#if !defined(FMT_IMPORT_STD) && !defined(FMT_MODULE) # include // std::filebuf #endif diff --git a/include/fmt/printf.h b/include/fmt/printf.h index e6cd5c3d5d22..3b2b9b4be8b3 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -8,7 +8,7 @@ #ifndef FMT_PRINTF_H_ #define FMT_PRINTF_H_ -#ifndef FMT_IMPORT_STD +#if !defined(FMT_IMPORT_STD) && !defined(FMT_MODULE) # include // std::max # include // std::numeric_limits #endif diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index 2cd5d37faf52..f3377ab5c312 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -8,7 +8,7 @@ #ifndef FMT_RANGES_H_ #define FMT_RANGES_H_ -#ifndef FMT_IMPORT_STD +#if !defined(FMT_IMPORT_STD) && !defined(FMT_MODULE) # include # include # include diff --git a/include/fmt/std.h b/include/fmt/std.h index 99528514ebd1..5f1f403c41ee 100644 --- a/include/fmt/std.h +++ b/include/fmt/std.h @@ -8,7 +8,7 @@ #ifndef FMT_STD_H_ #define FMT_STD_H_ -#ifndef FMT_IMPORT_STD +#if !defined(FMT_IMPORT_STD) && !defined(FMT_MODULE) # include # include # include @@ -29,7 +29,7 @@ # include #endif -#ifndef FMT_IMPORT_STD +#if !defined(FMT_IMPORT_STD) && !defined(FMT_MODULE) // Checking FMT_CPLUSPLUS for warning suppression in MSVC. # if FMT_CPLUSPLUS >= 201703L # if FMT_HAS_INCLUDE() diff --git a/include/fmt/xchar.h b/include/fmt/xchar.h index b8bb1359c0e3..31bdccdb97ee 100644 --- a/include/fmt/xchar.h +++ b/include/fmt/xchar.h @@ -8,7 +8,7 @@ #ifndef FMT_XCHAR_H_ #define FMT_XCHAR_H_ -#ifndef FMT_IMPORT_STD +#if !defined(FMT_IMPORT_STD) && !defined(FMT_MODULE) # include #endif @@ -16,7 +16,8 @@ #include "format.h" #include "ranges.h" -#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR) && !defined(FMT_IMPORT_STD) +#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR) && !defined(FMT_IMPORT_STD) && \ + !defined(FMT_MODULE) # include #endif diff --git a/src/fmt.cc b/src/fmt.cc index 364f4fa1290b..108f15312b3b 100644 --- a/src/fmt.cc +++ b/src/fmt.cc @@ -4,6 +4,7 @@ module; // to prevent attachment to this module. #ifndef FMT_IMPORT_STD # include +# include # include # include # include