mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-31 11:17:35 +02:00
Added FMT_IMPORT_STD feature macro (#3928)
This commit is contained in:
@ -8,9 +8,11 @@
|
|||||||
#ifndef FMT_ARGS_H_
|
#ifndef FMT_ARGS_H_
|
||||||
#define FMT_ARGS_H_
|
#define FMT_ARGS_H_
|
||||||
|
|
||||||
|
#ifndef FMT_IMPORT_STD
|
||||||
# include <functional> // std::reference_wrapper
|
# include <functional> // std::reference_wrapper
|
||||||
# include <memory> // std::unique_ptr
|
# include <memory> // std::unique_ptr
|
||||||
# include <vector>
|
# include <vector>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "format.h" // std_string_view
|
#include "format.h" // std_string_view
|
||||||
|
|
||||||
|
@ -12,9 +12,13 @@
|
|||||||
#include <stdio.h> // FILE
|
#include <stdio.h> // FILE
|
||||||
#include <string.h> // strlen
|
#include <string.h> // strlen
|
||||||
|
|
||||||
|
#ifndef FMT_IMPORT_STD
|
||||||
// <cstddef> is also included transitively from <type_traits>.
|
// <cstddef> is also included transitively from <type_traits>.
|
||||||
# include <cstddef> // std::byte
|
# include <cstddef> // std::byte
|
||||||
# include <type_traits> // std::enable_if
|
# include <type_traits> // std::enable_if
|
||||||
|
#else
|
||||||
|
import std;
|
||||||
|
#endif
|
||||||
|
|
||||||
// The fmt library version in the form major * 10000 + minor * 100 + patch.
|
// The fmt library version in the form major * 10000 + minor * 100 + patch.
|
||||||
#define FMT_VERSION 100202
|
#define FMT_VERSION 100202
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#ifndef FMT_CHRONO_H_
|
#ifndef FMT_CHRONO_H_
|
||||||
#define FMT_CHRONO_H_
|
#define FMT_CHRONO_H_
|
||||||
|
|
||||||
|
#ifndef FMT_IMPORT_STD
|
||||||
# include <algorithm>
|
# include <algorithm>
|
||||||
# include <chrono>
|
# include <chrono>
|
||||||
# include <cmath> // std::isfinite
|
# include <cmath> // std::isfinite
|
||||||
@ -17,6 +18,7 @@
|
|||||||
# include <locale>
|
# include <locale>
|
||||||
# include <ostream>
|
# include <ostream>
|
||||||
# include <type_traits>
|
# include <type_traits>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
|
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
#ifndef FMT_COMPILE_H_
|
#ifndef FMT_COMPILE_H_
|
||||||
#define FMT_COMPILE_H_
|
#define FMT_COMPILE_H_
|
||||||
|
|
||||||
|
#ifndef FMT_IMPORT_STD
|
||||||
# include <iterator> // std::back_inserter
|
# include <iterator> // std::back_inserter
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
|
|
||||||
|
@ -8,13 +8,15 @@
|
|||||||
#ifndef FMT_FORMAT_INL_H_
|
#ifndef FMT_FORMAT_INL_H_
|
||||||
#define FMT_FORMAT_INL_H_
|
#define FMT_FORMAT_INL_H_
|
||||||
|
|
||||||
|
#ifndef FMT_IMPORT_STD
|
||||||
# include <algorithm>
|
# include <algorithm>
|
||||||
#include <cerrno> // errno
|
|
||||||
#include <climits>
|
|
||||||
# include <cmath>
|
# include <cmath>
|
||||||
# include <exception>
|
# 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>
|
# include <locale>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
# define FMT_REMOVE_TRANSITIVE_INCLUDES
|
# define FMT_REMOVE_TRANSITIVE_INCLUDES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef FMT_IMPORT_STD
|
||||||
# include <cmath> // std::signbit
|
# include <cmath> // std::signbit
|
||||||
# include <cstdint> // uint32_t
|
# include <cstdint> // uint32_t
|
||||||
# include <cstring> // std::memcpy
|
# include <cstring> // std::memcpy
|
||||||
@ -50,18 +51,22 @@
|
|||||||
# include <stdexcept> // std::runtime_error
|
# include <stdexcept> // std::runtime_error
|
||||||
# include <string> // std::string
|
# include <string> // std::string
|
||||||
# include <system_error> // std::system_error
|
# include <system_error> // std::system_error
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "base.h"
|
#include "base.h"
|
||||||
|
|
||||||
// Checking FMT_CPLUSPLUS for warning suppression in MSVC.
|
// 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
|
# include <bit> // std::bit_cast
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// libc++ supports string_view in pre-c++17.
|
// libc++ supports string_view in pre-c++17.
|
||||||
#if FMT_HAS_INCLUDE(<string_view>) && \
|
#if FMT_HAS_INCLUDE(<string_view>) && \
|
||||||
(FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION))
|
(FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION))
|
||||||
|
# ifndef FMT_IMPORT_STD
|
||||||
# include <string_view>
|
# include <string_view>
|
||||||
|
# endif
|
||||||
# define FMT_USE_STRING_VIEW
|
# define FMT_USE_STRING_VIEW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -9,9 +9,11 @@
|
|||||||
#define FMT_OS_H_
|
#define FMT_OS_H_
|
||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
#ifndef FMT_IMPORT_STD
|
||||||
# include <cstddef>
|
# include <cstddef>
|
||||||
# include <cstdio>
|
# include <cstdio>
|
||||||
# include <system_error> // std::system_error
|
# include <system_error> // std::system_error
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
|
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
#ifndef FMT_OSTREAM_H_
|
#ifndef FMT_OSTREAM_H_
|
||||||
#define FMT_OSTREAM_H_
|
#define FMT_OSTREAM_H_
|
||||||
|
|
||||||
|
#ifndef FMT_IMPORT_STD
|
||||||
# include <fstream> // std::filebuf
|
# include <fstream> // std::filebuf
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# ifdef __GLIBCXX__
|
# ifdef __GLIBCXX__
|
||||||
|
@ -8,8 +8,10 @@
|
|||||||
#ifndef FMT_PRINTF_H_
|
#ifndef FMT_PRINTF_H_
|
||||||
#define FMT_PRINTF_H_
|
#define FMT_PRINTF_H_
|
||||||
|
|
||||||
|
#ifndef FMT_IMPORT_STD
|
||||||
# include <algorithm> // std::max
|
# include <algorithm> // std::max
|
||||||
# include <limits> // std::numeric_limits
|
# include <limits> // std::numeric_limits
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
|
|
||||||
|
@ -8,10 +8,12 @@
|
|||||||
#ifndef FMT_RANGES_H_
|
#ifndef FMT_RANGES_H_
|
||||||
#define FMT_RANGES_H_
|
#define FMT_RANGES_H_
|
||||||
|
|
||||||
|
#ifndef FMT_IMPORT_STD
|
||||||
# include <initializer_list>
|
# include <initializer_list>
|
||||||
# include <iterator>
|
# include <iterator>
|
||||||
# include <tuple>
|
# include <tuple>
|
||||||
# include <type_traits>
|
# include <type_traits>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#ifndef FMT_STD_H_
|
#ifndef FMT_STD_H_
|
||||||
#define FMT_STD_H_
|
#define FMT_STD_H_
|
||||||
|
|
||||||
|
#ifndef FMT_IMPORT_STD
|
||||||
# include <atomic>
|
# include <atomic>
|
||||||
# include <bitset>
|
# include <bitset>
|
||||||
# include <complex>
|
# include <complex>
|
||||||
@ -19,6 +20,7 @@
|
|||||||
# include <typeinfo>
|
# include <typeinfo>
|
||||||
# include <utility>
|
# include <utility>
|
||||||
# include <vector>
|
# include <vector>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
#include "ostream.h"
|
#include "ostream.h"
|
||||||
@ -26,6 +28,8 @@
|
|||||||
#if FMT_HAS_INCLUDE(<version>)
|
#if FMT_HAS_INCLUDE(<version>)
|
||||||
# include <version>
|
# include <version>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef FMT_IMPORT_STD
|
||||||
// Checking FMT_CPLUSPLUS for warning suppression in MSVC.
|
// Checking FMT_CPLUSPLUS for warning suppression in MSVC.
|
||||||
# if FMT_CPLUSPLUS >= 201703L
|
# if FMT_CPLUSPLUS >= 201703L
|
||||||
# if FMT_HAS_INCLUDE(<filesystem>)
|
# if FMT_HAS_INCLUDE(<filesystem>)
|
||||||
@ -46,6 +50,7 @@
|
|||||||
# if FMT_CPLUSPLUS > 201703L && FMT_HAS_INCLUDE(<source_location>)
|
# if FMT_CPLUSPLUS > 201703L && FMT_HAS_INCLUDE(<source_location>)
|
||||||
# include <source_location>
|
# include <source_location>
|
||||||
# endif
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// GCC 4 does not support FMT_HAS_INCLUDE.
|
// GCC 4 does not support FMT_HAS_INCLUDE.
|
||||||
#if FMT_HAS_INCLUDE(<cxxabi.h>) || defined(__GLIBCXX__)
|
#if FMT_HAS_INCLUDE(<cxxabi.h>) || defined(__GLIBCXX__)
|
||||||
|
@ -8,13 +8,15 @@
|
|||||||
#ifndef FMT_XCHAR_H_
|
#ifndef FMT_XCHAR_H_
|
||||||
#define FMT_XCHAR_H_
|
#define FMT_XCHAR_H_
|
||||||
|
|
||||||
|
#ifndef FMT_IMPORT_STD
|
||||||
# include <cwchar>
|
# include <cwchar>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
#include "ranges.h"
|
#include "ranges.h"
|
||||||
|
|
||||||
#ifndef FMT_STATIC_THOUSANDS_SEPARATOR
|
#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR) && !defined(FMT_IMPORT_STD)
|
||||||
# include <locale>
|
# include <locale>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
11
src/fmt.cc
11
src/fmt.cc
@ -2,10 +2,9 @@ module;
|
|||||||
|
|
||||||
// Put all implementation-provided headers into the global module fragment
|
// Put all implementation-provided headers into the global module fragment
|
||||||
// to prevent attachment to this module.
|
// to prevent attachment to this module.
|
||||||
|
#ifndef FMT_IMPORT_STD
|
||||||
# include <algorithm>
|
# include <algorithm>
|
||||||
#include <cerrno>
|
|
||||||
# include <chrono>
|
# include <chrono>
|
||||||
#include <climits>
|
|
||||||
# include <cmath>
|
# include <cmath>
|
||||||
# include <cstddef>
|
# include <cstddef>
|
||||||
# include <cstdint>
|
# include <cstdint>
|
||||||
@ -33,6 +32,14 @@ module;
|
|||||||
# include <utility>
|
# include <utility>
|
||||||
# include <variant>
|
# include <variant>
|
||||||
# include <vector>
|
# include <vector>
|
||||||
|
#else
|
||||||
|
# include <limits.h>
|
||||||
|
# include <stdint.h>
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <time.h>
|
||||||
|
#endif
|
||||||
|
#include <cerrno>
|
||||||
|
#include <climits>
|
||||||
#include <version>
|
#include <version>
|
||||||
|
|
||||||
#if __has_include(<cxxabi.h>)
|
#if __has_include(<cxxabi.h>)
|
||||||
|
Reference in New Issue
Block a user