[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master c633e17 3/4: Resolve more '-Wconversion' issu
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master c633e17 3/4: Resolve more '-Wconversion' issues |
Date: |
Thu, 31 May 2018 20:05:36 -0400 (EDT) |
branch: master
commit c633e176dc372bc80b3f77a8a752420e72c4001e
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Resolve more '-Wconversion' issues
Used a pragma to ignore conversion warnings on a single statement.
As the comments indicate, this code was written for C++98, which assumed
only a C89 standard library. A thorough modernization would take a lot
of time and effort; that doesn't seem justifiable for code that has
worked perfectly since 2004 as far as we know.
---
tn_range.tpp | 12 +++++++++++-
workhorse.make | 1 -
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/tn_range.tpp b/tn_range.tpp
index a1587a5..f1a76e6 100644
--- a/tn_range.tpp
+++ b/tn_range.tpp
@@ -182,17 +182,27 @@ namespace
static_assert(std::is_floating_point<T>::value);
bool operator()(T t)
{
+ // SOMEDAY !! nonstd::power() [SGI extension] may be
+ // preferable, because std::pow() might not be exact.
static T z0 = std::pow
(static_cast<T>(std::numeric_limits<T>::radix)
,static_cast<T>(std::numeric_limits<T>::digits)
);
long int z1 = std::numeric_limits<long int>::max();
+#if defined __GNUC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wconversion"
+#endif // defined __GNUC__
return
-z0 < t
&& t < z0
&& -z1 < t
&& t < z1
- && t == static_cast<long int>(t);
+ && t == static_cast<long int>(t)
+ ;
+#if defined __GNUC__
+# pragma GCC diagnostic pop
+#endif // defined __GNUC__
}
};
diff --git a/workhorse.make b/workhorse.make
index f9193d5..f89ac8d 100644
--- a/workhorse.make
+++ b/workhorse.make
@@ -480,7 +480,6 @@ wno_conv_objects := \
facets.o \
rate_table.o \
round_glibc.o \
- tn_range_test.o \
$(wno_conv_objects): gcc_common_extra_warnings += -Wno-conversion