Skip to content

Commit

Permalink
Cleanup includes
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Jun 16, 2024
1 parent 0434026 commit febd8ed
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 33 deletions.
20 changes: 9 additions & 11 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
# define FMT_REMOVE_TRANSITIVE_INCLUDES
#endif

#include "base.h"

#ifndef FMT_MODULE
# include <cmath> // std::signbit
# include <cstdint> // uint32_t
Expand All @@ -51,23 +53,19 @@
# 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 && !defined(FMT_MODULE)
# include <bit> // std::bit_cast
#endif
# if FMT_HAS_INCLUDE(<bit>) && FMT_CPLUSPLUS > 201703L
# 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))
# if !defined(FMT_MODULE)
# if FMT_HAS_INCLUDE(<string_view>) && \
(FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION))
# include <string_view>
# define FMT_USE_STRING_VIEW
# endif
# define FMT_USE_STRING_VIEW
#endif
#endif // FMT_MODULE

#if defined __cpp_inline_variables && __cpp_inline_variables >= 201606L
# define FMT_INLINE_VARIABLE inline
Expand Down
12 changes: 5 additions & 7 deletions include/fmt/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,18 @@
#ifndef FMT_OS_H_
#define FMT_OS_H_

#include "format.h"

#ifndef FMT_MODULE
# include <cerrno>
# include <cstddef>
# include <cstdio>
# include <system_error> // std::system_error
#endif

#include "format.h"

#if defined __APPLE__ || defined(__FreeBSD__)
# if FMT_HAS_INCLUDE(<xlocale.h>) && !defined(FMT_MODULE)
# include <xlocale.h> // for LC_NUMERIC_MASK on OS X
# if FMT_HAS_INCLUDE(<xlocale.h>)
# include <xlocale.h> // LC_NUMERIC_MASK on macOS
# endif
#endif
#endif // FMT_MODULE

#ifndef FMT_USE_FCNTL
// UWP doesn't provide _pipe.
Expand Down
16 changes: 7 additions & 9 deletions include/fmt/std.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#ifndef FMT_STD_H_
#define FMT_STD_H_

#include "format.h"
#include "ostream.h"

#ifndef FMT_MODULE
# include <atomic>
# include <bitset>
Expand All @@ -20,16 +23,7 @@
# include <typeinfo>
# include <utility>
# include <vector>
#endif

#include "format.h"
#include "ostream.h"

#if FMT_HAS_INCLUDE(<version>)
# include <version>
#endif

#ifndef FMT_MODULE
// Checking FMT_CPLUSPLUS for warning suppression in MSVC.
# if FMT_CPLUSPLUS >= 201703L
# if FMT_HAS_INCLUDE(<filesystem>)
Expand All @@ -50,6 +44,10 @@
# if FMT_CPLUSPLUS > 201703L && FMT_HAS_INCLUDE(<source_location>)
# include <source_location>
# endif
#endif // FMT_MODULE

#if FMT_HAS_INCLUDE(<version>)
# include <version>
#endif

// GCC 4 does not support FMT_HAS_INCLUDE.
Expand Down
11 changes: 5 additions & 6 deletions include/fmt/xchar.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
#ifndef FMT_XCHAR_H_
#define FMT_XCHAR_H_

#ifndef FMT_MODULE
# include <cwchar>
#endif

#include "color.h"
#include "format.h"
#include "ranges.h"

#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR) && !defined(FMT_MODULE)
# include <locale>
#ifndef FMT_MODULE
# include <cwchar>
# if !defined(FMT_STATIC_THOUSANDS_SEPARATOR)
# include <locale>
# endif
#endif

FMT_BEGIN_NAMESPACE
Expand Down

0 comments on commit febd8ed

Please sign in to comment.