[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 6a5c4bb3 21/24: Distinguish gcc vs. clang flo
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 6a5c4bb3 21/24: Distinguish gcc vs. clang floating-point warnings |
Date: |
Fri, 8 Jul 2022 07:11:28 -0400 (EDT) |
branch: master
commit 6a5c4bb33b1919d59f523a703e8e7e23788048ab
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Distinguish gcc vs. clang floating-point warnings
Whereas gcc warns with '-Wfloat-conversion' here, clang warns with
'-Wimplicit-float-conversion'.
---
compiler_clang_warnings.make | 1 -
ieee754_test.cpp | 15 +++++++++++----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/compiler_clang_warnings.make b/compiler_clang_warnings.make
index 0aea81ef..4959948c 100644
--- a/compiler_clang_warnings.make
+++ b/compiler_clang_warnings.make
@@ -76,7 +76,6 @@ clang_cxx_warnings := \
-Wno-float-equal \
-Wno-global-constructors \
-Wno-implicit-fallthrough \
- -Wno-implicit-float-conversion \
-Wno-logical-op-parentheses \
-Wno-mismatched-tags \
-Wno-missing-noreturn \
diff --git a/ieee754_test.cpp b/ieee754_test.cpp
index 8869e644..9e1ec344 100644
--- a/ieee754_test.cpp
+++ b/ieee754_test.cpp
@@ -45,16 +45,23 @@ int test_main(int, char*[])
LMI_TEST(is_infinite<long double>(-infinity<long double>()));
// Narrowing conversions tested here:
-#if defined __GNUC__
+#if defined LMI_GCC
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wfloat-conversion"
-#endif // defined __GNUC__
+#endif // defined LMI_GCC
+#if defined LMI_CLANG
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wimplicit-float-conversion"
+#endif // defined LMI_CLANG
LMI_TEST(is_infinite<float >(-infinity<double >()));
LMI_TEST(is_infinite<float >(-infinity<long double>()));
LMI_TEST(is_infinite<double >(-infinity<long double>()));
-#if defined __GNUC__
+#if defined LMI_CLANG
+# pragma clang diagnostic pop
+#endif // defined LMI_CLANG
+#if defined LMI_GCC
# pragma GCC diagnostic pop
-#endif // defined __GNUC__
+#endif // defined LMI_GCC
LMI_TEST(!is_infinite(0.0));
LMI_TEST(!is_infinite( std::numeric_limits<double>::max()));
- [lmi-commits] [lmi] master e7ef946d 11/24: Disable a warning only for cgicc, (continued)
- [lmi-commits] [lmi] master e7ef946d 11/24: Disable a warning only for cgicc, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master e97c7ec6 17/24: Enable another clang warning, with one pragmatic exception, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master b5cee829 18/24: Explain why '-Wpadded' is disabled for clang, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master 9a551769 22/24: Disable floating-point comparison warning, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master bb0434c3 09/24: Avoid clang warning on silliness, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master 17c9b8e0 16/24: Enable another clang warning, except for cgicc, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master 1be7d13d 23/24: Don't let clang warn about lawful comments, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master 29fec503 13/24: Work around spurious clang "unused" warnings, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master 89930e76 15/24: Experimentally work around a clang warning, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master 06024f1f 19/24: '-Wold-style-cast': treat clang the same as gcc, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master 6a5c4bb3 21/24: Distinguish gcc vs. clang floating-point warnings,
Greg Chicares <=