Added FMT_IMPORT_STD feature macro (#3928)

This commit is contained in:
Matthias Moulin 2024-04-10 20:48:32 +02:00 committed by GitHub
parent 5eb68c0ef2
commit 116a9ce488
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 137 additions and 98 deletions

View File

@ -8,9 +8,11 @@
#ifndef FMT_ARGS_H_
#define FMT_ARGS_H_
#ifndef FMT_IMPORT_STD
# include <functional> // std::reference_wrapper
# include <memory> // std::unique_ptr
# include <vector>
#endif
#include "format.h" // std_string_view

View File

@ -12,9 +12,13 @@
#include <stdio.h> // FILE
#include <string.h> // strlen
#ifndef FMT_IMPORT_STD
// <cstddef> is also included transitively from <type_traits>.
# include <cstddef> // std::byte
# include <type_traits> // std::enable_if
#else
import std;
#endif
// The fmt library version in the form major * 10000 + minor * 100 + patch.
#define FMT_VERSION 100202

View File

@ -8,6 +8,7 @@
#ifndef FMT_CHRONO_H_
#define FMT_CHRONO_H_
#ifndef FMT_IMPORT_STD
# include <algorithm>
# include <chrono>
# include <cmath> // std::isfinite
@ -17,6 +18,7 @@
# include <locale>
# include <ostream>
# include <type_traits>
#endif
#include "format.h"

View File

@ -8,7 +8,9 @@
#ifndef FMT_COMPILE_H_
#define FMT_COMPILE_H_
#ifndef FMT_IMPORT_STD
# include <iterator> // std::back_inserter
#endif
#include "format.h"

View File

@ -8,13 +8,15 @@
#ifndef FMT_FORMAT_INL_H_
#define FMT_FORMAT_INL_H_
#ifndef FMT_IMPORT_STD
# include <algorithm>
#include <cerrno> // errno
#include <climits>
# include <cmath>
# include <exception>
#endif
#include <cerrno> // errno
#include <climits>
#ifndef FMT_STATIC_THOUSANDS_SEPARATOR
#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR) && !defined(FMT_IMPORT_STD)
# include <locale>
#endif

View File

@ -38,6 +38,7 @@
# define FMT_REMOVE_TRANSITIVE_INCLUDES
#endif
#ifndef FMT_IMPORT_STD
# include <cmath> // std::signbit
# include <cstdint> // uint32_t
# include <cstring> // std::memcpy
@ -50,18 +51,22 @@
# include <stdexcept> // std::runtime_error
# include <string> // std::string
# include <system_error> // std::system_error
#endif
#include "base.h"
// Checking FMT_CPLUSPLUS for warning suppression in MSVC.
#if FMT_HAS_INCLUDE(<bit>) && FMT_CPLUSPLUS > 201703L
#if FMT_HAS_INCLUDE(<bit>) && FMT_CPLUSPLUS > 201703L && \
!defined(FMT_IMPORT_STD)
# include <bit> // std::bit_cast
#endif
// libc++ supports string_view in pre-c++17.
#if FMT_HAS_INCLUDE(<string_view>) && \
(FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION))
# ifndef FMT_IMPORT_STD
# include <string_view>
# endif
# define FMT_USE_STRING_VIEW
#endif

View File

@ -9,9 +9,11 @@
#define FMT_OS_H_
#include <cerrno>
#ifndef FMT_IMPORT_STD
# include <cstddef>
# include <cstdio>
# include <system_error> // std::system_error
#endif
#include "format.h"

View File

@ -8,7 +8,9 @@
#ifndef FMT_OSTREAM_H_
#define FMT_OSTREAM_H_
#ifndef FMT_IMPORT_STD
# include <fstream> // std::filebuf
#endif
#ifdef _WIN32
# ifdef __GLIBCXX__

View File

@ -8,8 +8,10 @@
#ifndef FMT_PRINTF_H_
#define FMT_PRINTF_H_
#ifndef FMT_IMPORT_STD
# include <algorithm> // std::max
# include <limits> // std::numeric_limits
#endif
#include "format.h"

View File

@ -8,10 +8,12 @@
#ifndef FMT_RANGES_H_
#define FMT_RANGES_H_
#ifndef FMT_IMPORT_STD
# include <initializer_list>
# include <iterator>
# include <tuple>
# include <type_traits>
#endif
#include "format.h"

View File

@ -8,6 +8,7 @@
#ifndef FMT_STD_H_
#define FMT_STD_H_
#ifndef FMT_IMPORT_STD
# include <atomic>
# include <bitset>
# include <complex>
@ -19,6 +20,7 @@
# include <typeinfo>
# include <utility>
# include <vector>
#endif
#include "format.h"
#include "ostream.h"
@ -26,6 +28,8 @@
#if FMT_HAS_INCLUDE(<version>)
# include <version>
#endif
#ifndef FMT_IMPORT_STD
// Checking FMT_CPLUSPLUS for warning suppression in MSVC.
# if FMT_CPLUSPLUS >= 201703L
# if FMT_HAS_INCLUDE(<filesystem>)
@ -46,6 +50,7 @@
# if FMT_CPLUSPLUS > 201703L && FMT_HAS_INCLUDE(<source_location>)
# include <source_location>
# endif
#endif
// GCC 4 does not support FMT_HAS_INCLUDE.
#if FMT_HAS_INCLUDE(<cxxabi.h>) || defined(__GLIBCXX__)

View File

@ -8,13 +8,15 @@
#ifndef FMT_XCHAR_H_
#define FMT_XCHAR_H_
#ifndef FMT_IMPORT_STD
# include <cwchar>
#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 <locale>
#endif

View File

@ -2,10 +2,9 @@ module;
// Put all implementation-provided headers into the global module fragment
// to prevent attachment to this module.
#ifndef FMT_IMPORT_STD
# include <algorithm>
#include <cerrno>
# include <chrono>
#include <climits>
# include <cmath>
# include <cstddef>
# include <cstdint>
@ -33,6 +32,14 @@ module;
# include <utility>
# include <variant>
# include <vector>
#else
# include <limits.h>
# include <stdint.h>
# include <stdio.h>
# include <time.h>
#endif
#include <cerrno>
#include <climits>
#include <version>
#if __has_include(<cxxabi.h>)