lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 9b175313 2/6: Enable '-Wconditional-uninitial


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 9b175313 2/6: Enable '-Wconditional-uninitialized' for clang
Date: Sat, 9 Jul 2022 18:28:39 -0400 (EDT)

branch: master
commit 9b175313cf5df87b4907e95078a16dadb38eeb89
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Enable '-Wconditional-uninitialized' for clang
    
    * compiler_clang_warnings.make: Enable this warning.
    * zero.hpp: Ignore this warning in one place only. Use a pragma for
    this purpose, because this code is used only to only to demonstrate
    that TOMS 748 is suboptimal, and there is no point in alleviating
    whatever defects it possesses.
---
 compiler_clang_warnings.make | 2 --
 zero.hpp                     | 8 ++++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/compiler_clang_warnings.make b/compiler_clang_warnings.make
index 2933be24..23a10438 100644
--- a/compiler_clang_warnings.make
+++ b/compiler_clang_warnings.make
@@ -52,7 +52,6 @@ clang_c_warnings := \
 # -W++98-compat-pedantic: backward compatibility not desirable
 ### [triple '#' marks warnings requiring investigation]
 ###  -Wcomma
-###  -Wconditional-uninitialized
 # -Wcovered-switch-default: better to leave "default:" in place
 # -Wdate-time: only for "bit-wise-identical reproducible compilations"
 ###  -Wdeprecated-copy-with-dtor
@@ -84,7 +83,6 @@ clang_cxx_warnings := \
   -Wno-c++20-compat \
   -Wno-c++98-compat-pedantic \
   -Wno-comma \
-  -Wno-conditional-uninitialized \
   -Wno-covered-switch-default \
   -Wno-date-time \
   -Wno-deprecated-copy-with-dtor \
diff --git a/zero.hpp b/zero.hpp
index 894719e5..695a1f94 100644
--- a/zero.hpp
+++ b/zero.hpp
@@ -1310,8 +1310,16 @@ int rroot_(FunctionalType& f, int* nprob, int* neps, 
double* eps,
 /* FOUR FUNCTION VALUES "FA", "FB", "FD", AND "FE" ARE DISTINCT, AND */
 /* HENCE "PZERO" WILL BE CALLED. */
 
+#if defined LMI_CLANG
+#   pragma clang diagnostic push
+#   pragma clang diagnostic ignored "-Wconditional-uninitialized"
+#endif // defined LMI_CLANG
+    // clang: "variable 'fd' may be uninitialized when used here"
     prof = (fa - fb) * (fa - fd) * (fa - fe) * (fb - fd) * (fb - fe) * (fd -
             fe);
+#if defined LMI_CLANG
+#   pragma clang diagnostic pop
+#endif // defined LMI_CLANG
     if (itnum == 2 || prof == 0.) {
         newqua_(a, b, &d_0, &fa, &fb, &fd, &c0, &c2);
     } else {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]