Fix unreachable code warning when signbit returns bool

This commit is contained in:
Victor Zverovich 2018-02-10 07:21:17 -08:00
parent 403ae0a23b
commit 61065e1a5c

View File

@ -249,10 +249,8 @@ class numeric_limits<fmt::internal::dummy_int> :
using namespace fmt::internal; using namespace fmt::internal;
// The resolution "priority" is: // The resolution "priority" is:
// isinf macro > std::isinf > ::isinf > fmt::internal::isinf // isinf macro > std::isinf > ::isinf > fmt::internal::isinf
if (const_check(sizeof(isinf(x)) == sizeof(bool) || if (const_check(sizeof(isinf(x)) != sizeof(fmt::internal::dummy_int)))
sizeof(isinf(x)) == sizeof(int))) {
return isinf(x) != 0; return isinf(x) != 0;
}
return !_finite(static_cast<double>(x)); return !_finite(static_cast<double>(x));
} }
@ -260,20 +258,16 @@ class numeric_limits<fmt::internal::dummy_int> :
template <typename T> template <typename T>
static bool isnotanumber(T x) { static bool isnotanumber(T x) {
using namespace fmt::internal; using namespace fmt::internal;
if (const_check(sizeof(isnan(x)) == sizeof(bool) || if (const_check(sizeof(isnan(x)) != sizeof(fmt::internal::dummy_int)))
sizeof(isnan(x)) == sizeof(int))) {
return isnan(x) != 0; return isnan(x) != 0;
}
return _isnan(static_cast<double>(x)) != 0; return _isnan(static_cast<double>(x)) != 0;
} }
// Portable version of signbit. // Portable version of signbit.
static bool isnegative(double x) { static bool isnegative(double x) {
using namespace fmt::internal; using namespace fmt::internal;
if (const_check(sizeof(signbit(x)) == sizeof(bool) || if (const_check(sizeof(signbit(x)) != sizeof(fmt::internal::dummy_int)))
sizeof(signbit(x)) == sizeof(int))) {
return signbit(x) != 0; return signbit(x) != 0;
}
if (x < 0) return true; if (x < 0) return true;
if (!isnotanumber(x)) return false; if (!isnotanumber(x)) return false;
int dec = 0, sign = 0; int dec = 0, sign = 0;