More cleanup

This commit is contained in:
Victor Zverovich
2018-09-22 16:00:34 -07:00
parent 715f2b4c00
commit ff6e46ed97
3 changed files with 36 additions and 44 deletions

View File

@ -25,7 +25,7 @@
#endif #endif
#if defined(__has_include) && !defined(__INTELLISENSE__) && \ #if defined(__has_include) && !defined(__INTELLISENSE__) && \
(!defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1600) !(defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1600)
# define FMT_HAS_INCLUDE(x) __has_include(x) # define FMT_HAS_INCLUDE(x) __has_include(x)
#else #else
# define FMT_HAS_INCLUDE(x) 0 # define FMT_HAS_INCLUDE(x) 0
@ -72,7 +72,7 @@
#ifndef FMT_USE_CONSTEXPR11 #ifndef FMT_USE_CONSTEXPR11
# define FMT_USE_CONSTEXPR11 \ # define FMT_USE_CONSTEXPR11 \
(FMT_MSC_VER >= 1900 || FMT_GCC_VERSION >= 406 || FMT_USE_CONSTEXPR) (FMT_USE_CONSTEXPR || FMT_GCC_VERSION >= 406 || FMT_MSC_VER >= 1900)
#endif #endif
#if FMT_USE_CONSTEXPR11 #if FMT_USE_CONSTEXPR11
# define FMT_CONSTEXPR11 constexpr # define FMT_CONSTEXPR11 constexpr
@ -104,24 +104,15 @@
# define FMT_NULL NULL # define FMT_NULL NULL
# endif # endif
#endif #endif
#ifndef FMT_USE_NULLPTR #ifndef FMT_USE_NULLPTR
# define FMT_USE_NULLPTR 0 # define FMT_USE_NULLPTR 0
#endif #endif
#if FMT_HAS_CPP_ATTRIBUTE(noreturn)
# define FMT_NORETURN [[noreturn]]
#else
# define FMT_NORETURN
#endif
// Check if exceptions are disabled. // Check if exceptions are disabled.
#if defined(__GNUC__) && !defined(__EXCEPTIONS) #if (defined(__GNUC__) && !defined(__EXCEPTIONS)) || \
FMT_MSC_VER && !_HAS_EXCEPTIONS
# define FMT_EXCEPTIONS 0 # define FMT_EXCEPTIONS 0
#elif FMT_MSC_VER && !_HAS_EXCEPTIONS #else
# define FMT_EXCEPTIONS 0
#endif
#ifndef FMT_EXCEPTIONS
# define FMT_EXCEPTIONS 1 # define FMT_EXCEPTIONS 1
#endif #endif
@ -147,8 +138,7 @@
# endif # endif
#endif #endif
// This is needed because GCC still uses throw() in its headers when exceptions // GCC still uses throw() in its headers when exceptions are disabled.
// are disabled.
#if FMT_GCC_VERSION #if FMT_GCC_VERSION
# define FMT_DTOR_NOEXCEPT FMT_DETECTED_NOEXCEPT # define FMT_DTOR_NOEXCEPT FMT_DETECTED_NOEXCEPT
#else #else
@ -358,11 +348,8 @@ struct formatter {
}; };
template <typename T, typename Char, typename Enable = void> template <typename T, typename Char, typename Enable = void>
struct convert_to_int { struct convert_to_int: std::integral_constant<
enum { bool, !std::is_arithmetic<T>::value && std::is_convertible<T, int>::value> {};
value = !std::is_arithmetic<T>::value && std::is_convertible<T, int>::value
};
};
namespace internal { namespace internal {
@ -1454,8 +1441,7 @@ inline void print(std::FILE *f, string_view format_str, const Args & ... args) {
set via ``fwide(f, 1)`` or ``_setmode(_fileno(f), _O_U8TEXT)`` on Windows. set via ``fwide(f, 1)`` or ``_setmode(_fileno(f), _O_U8TEXT)`` on Windows.
*/ */
template <typename... Args> template <typename... Args>
inline void print(std::FILE *f, wstring_view format_str, inline void print(std::FILE *f, wstring_view format_str, const Args &... args) {
const Args & ... args) {
format_arg_store<wformat_context, Args...> as(args...); format_arg_store<wformat_context, Args...> as(args...);
vprint(f, format_str, as); vprint(f, format_str, as);
} }

View File

@ -24,6 +24,12 @@
#undef min #undef min
#undef max #undef max
#if FMT_HAS_CPP_ATTRIBUTE(noreturn)
# define FMT_NORETURN [[noreturn]]
#else
# define FMT_NORETURN
#endif
using fmt::internal::fp; using fmt::internal::fp;
template <bool is_iec559> template <bool is_iec559>