Fix "conditional expression is constant" VS2019 warning in more specific way
This commit is contained in:
parent
55b42e8f4a
commit
ee339bcfa3
@ -46,7 +46,6 @@
|
|||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# pragma warning(push)
|
# pragma warning(push)
|
||||||
# pragma warning(disable : 4127) // conditional expression is constant
|
|
||||||
# pragma warning(disable : 4702) // unreachable code
|
# pragma warning(disable : 4702) // unreachable code
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -939,7 +938,11 @@ template <int GRISU_VERSION> struct grisu_shortest_handler {
|
|||||||
uint64_t error, int exp, bool integral) {
|
uint64_t error, int exp, bool integral) {
|
||||||
buf[size++] = digit;
|
buf[size++] = digit;
|
||||||
if (remainder >= error) return digits::more;
|
if (remainder >= error) return digits::more;
|
||||||
|
#ifdef __cpp_if_constexpr
|
||||||
|
if constexpr (GRISU_VERSION != 3) {
|
||||||
|
#else
|
||||||
if (GRISU_VERSION != 3) {
|
if (GRISU_VERSION != 3) {
|
||||||
|
#endif
|
||||||
uint64_t d = integral ? diff : diff * data::powers_of_10_64[-exp];
|
uint64_t d = integral ? diff : diff * data::powers_of_10_64[-exp];
|
||||||
round(d, divisor, remainder, error);
|
round(d, divisor, remainder, error);
|
||||||
return digits::done;
|
return digits::done;
|
||||||
|
|||||||
@ -71,11 +71,6 @@
|
|||||||
# define FMT_HAS_BUILTIN(x) 0
|
# define FMT_HAS_BUILTIN(x) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
# pragma warning(push)
|
|
||||||
# pragma warning(disable : 4127) // conditional expression is constant
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef FMT_THROW
|
#ifndef FMT_THROW
|
||||||
# if FMT_EXCEPTIONS
|
# if FMT_EXCEPTIONS
|
||||||
# if FMT_MSC_VER
|
# if FMT_MSC_VER
|
||||||
@ -2810,7 +2805,11 @@ void internal::basic_writer<Range>::write_fp(T value,
|
|||||||
int precision = specs.precision >= 0 || !specs.type ? specs.precision : 6;
|
int precision = specs.precision >= 0 || !specs.type ? specs.precision : 6;
|
||||||
unsigned options = 0;
|
unsigned options = 0;
|
||||||
if (handler.fixed) options |= grisu_options::fixed;
|
if (handler.fixed) options |= grisu_options::fixed;
|
||||||
|
#ifdef __cpp_if_constexpr
|
||||||
|
if constexpr (sizeof(value) == sizeof(float)) options |= grisu_options::binary32;
|
||||||
|
#else
|
||||||
if (sizeof(value) == sizeof(float)) options |= grisu_options::binary32;
|
if (sizeof(value) == sizeof(float)) options |= grisu_options::binary32;
|
||||||
|
#endif
|
||||||
bool use_grisu =
|
bool use_grisu =
|
||||||
USE_GRISU &&
|
USE_GRISU &&
|
||||||
(specs.type != 'a' && specs.type != 'A' && specs.type != 'e' &&
|
(specs.type != 'a' && specs.type != 'A' && specs.type != 'e' &&
|
||||||
@ -3582,10 +3581,6 @@ FMT_CONSTEXPR internal::udl_arg<wchar_t> operator"" _a(const wchar_t* s,
|
|||||||
#endif // FMT_USE_USER_DEFINED_LITERALS
|
#endif // FMT_USE_USER_DEFINED_LITERALS
|
||||||
FMT_END_NAMESPACE
|
FMT_END_NAMESPACE
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
# pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\rst
|
\rst
|
||||||
Constructs a compile-time format string.
|
Constructs a compile-time format string.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user