fix: silence warning: [-Wfloat-equal] (#2848)
This commit is contained in:
parent
288c3b928b
commit
f3dcc52e5b
@ -2299,6 +2299,13 @@ FMT_CONSTEXPR20 bool isfinite(T value) {
|
|||||||
if (is_constant_evaluated()) return value - value == 0;
|
if (is_constant_evaluated()) return value - value == 0;
|
||||||
return std::isfinite(value);
|
return std::isfinite(value);
|
||||||
}
|
}
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wfloat-equal"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
|
#endif
|
||||||
template <typename T, FMT_ENABLE_IF(is_float128<T>::value)>
|
template <typename T, FMT_ENABLE_IF(is_float128<T>::value)>
|
||||||
constexpr bool isfinite(T value) {
|
constexpr bool isfinite(T value) {
|
||||||
return value - value == 0; // std::isfinite doesn't support __float128.
|
return value - value == 0; // std::isfinite doesn't support __float128.
|
||||||
@ -2307,6 +2314,11 @@ constexpr bool isfinite(T value) {
|
|||||||
template <typename T> constexpr bool isnan(T value) {
|
template <typename T> constexpr bool isnan(T value) {
|
||||||
return value != value; // std::isnan doesn't support __float128.
|
return value != value; // std::isnan doesn't support __float128.
|
||||||
}
|
}
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
template <typename T, FMT_ENABLE_IF(is_floating_point<T>::value)>
|
template <typename T, FMT_ENABLE_IF(is_floating_point<T>::value)>
|
||||||
FMT_INLINE FMT_CONSTEXPR bool signbit(T value) {
|
FMT_INLINE FMT_CONSTEXPR bool signbit(T value) {
|
||||||
|
|||||||
@ -479,9 +479,21 @@ template <class charT> struct formatter<std::complex<double>, charT> {
|
|||||||
fmt::runtime("{:" + specs + "}"), c.imag());
|
fmt::runtime("{:" + specs + "}"), c.imag());
|
||||||
auto fill_align_width = std::string();
|
auto fill_align_width = std::string();
|
||||||
if (specs_.width > 0) fill_align_width = fmt::format(">{}", specs_.width);
|
if (specs_.width > 0) fill_align_width = fmt::format(">{}", specs_.width);
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wfloat-equal"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
|
#endif
|
||||||
return format_to(ctx.out(), runtime("{:" + fill_align_width + "}"),
|
return format_to(ctx.out(), runtime("{:" + fill_align_width + "}"),
|
||||||
c.real() != 0 ? fmt::format("({}+{}i)", real, imag)
|
c.real() != 0 ? fmt::format("({}+{}i)", real, imag)
|
||||||
: fmt::format("{}i", imag));
|
: fmt::format("{}i", imag));
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
FMT_END_NAMESPACE
|
FMT_END_NAMESPACE
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user