mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-25 06:21:00 +00:00
Move FMT_USE_FLOAT and friends to fmt/format.h
This commit is contained in:
parent
d3e668418f
commit
2951169481
@ -284,7 +284,8 @@ FMT_NORETURN FMT_API void assert_fail(const char* file, int line,
|
|||||||
|
|
||||||
#ifndef FMT_ASSERT
|
#ifndef FMT_ASSERT
|
||||||
# ifdef NDEBUG
|
# ifdef NDEBUG
|
||||||
# define FMT_ASSERT(condition, message)
|
// FMT_ASSERT is not empty to avoid -Werror=empty-body.
|
||||||
|
# define FMT_ASSERT(condition, message) ((void)0)
|
||||||
# else
|
# else
|
||||||
# define FMT_ASSERT(condition, message) \
|
# define FMT_ASSERT(condition, message) \
|
||||||
((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \
|
((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \
|
||||||
@ -316,18 +317,6 @@ struct int128_t {};
|
|||||||
struct uint128_t {};
|
struct uint128_t {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FMT_USE_FLOAT
|
|
||||||
# define FMT_USE_FLOAT 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef FMT_USE_DOUBLE
|
|
||||||
# define FMT_USE_DOUBLE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef FMT_USE_LONG_DOUBLE
|
|
||||||
# define FMT_USE_LONG_DOUBLE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Casts a nonnegative integer to unsigned.
|
// Casts a nonnegative integer to unsigned.
|
||||||
template <typename Int>
|
template <typename Int>
|
||||||
FMT_CONSTEXPR typename std::make_unsigned<Int>::type to_unsigned(Int value) {
|
FMT_CONSTEXPR typename std::make_unsigned<Int>::type to_unsigned(Int value) {
|
||||||
|
@ -138,6 +138,18 @@ FMT_END_NAMESPACE
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef FMT_USE_FLOAT
|
||||||
|
# define FMT_USE_FLOAT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FMT_USE_DOUBLE
|
||||||
|
# define FMT_USE_DOUBLE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FMT_USE_LONG_DOUBLE
|
||||||
|
# define FMT_USE_LONG_DOUBLE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
// __builtin_clz is broken in clang with Microsoft CodeGen:
|
// __builtin_clz is broken in clang with Microsoft CodeGen:
|
||||||
// https://github.com/fmtlib/fmt/issues/519
|
// https://github.com/fmtlib/fmt/issues/519
|
||||||
#if (FMT_GCC_VERSION || FMT_HAS_BUILTIN(__builtin_clz)) && !FMT_MSC_VER
|
#if (FMT_GCC_VERSION || FMT_HAS_BUILTIN(__builtin_clz)) && !FMT_MSC_VER
|
||||||
@ -1893,11 +1905,10 @@ class arg_formatter_base {
|
|||||||
|
|
||||||
template <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value)>
|
template <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value)>
|
||||||
iterator operator()(T value) {
|
iterator operator()(T value) {
|
||||||
if (const_check(!is_supported_floating_point(value))) {
|
if (const_check(is_supported_floating_point(value)))
|
||||||
FMT_ASSERT(false, "unsupported float argument type");
|
|
||||||
return out();
|
|
||||||
}
|
|
||||||
writer_.write(value, specs_ ? *specs_ : format_specs());
|
writer_.write(value, specs_ ? *specs_ : format_specs());
|
||||||
|
else
|
||||||
|
FMT_ASSERT(false, "unsupported float argument type");
|
||||||
return out();
|
return out();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user