lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 334b1b5 1/3: Suppress a harmless gcc-7 warnin


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 334b1b5 1/3: Suppress a harmless gcc-7 warning
Date: Sun, 4 Mar 2018 12:42:37 -0500 (EST)

branch: master
commit 334b1b58c08175e0c925b13abab4f067dd723835
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Suppress a harmless gcc-7 warning
    
    Bourn-casting a negative floating value to bool elicits an exception:
      if(!to_traits::is_signed && from < 0) throw...
    In that case, the unreachable next statement compares such a value to
    the lower limit for type bool, calculated in a way that depends on
    whether bool is represented as two's complement, as determined by a
    technique that involves the bitwise negation of the target type (bool
    in this case). IOW, all negatives having already been rejected, the
    question at hand is whether the lowest acceptable negative is -1 or -2.
    
    It is nevertheless dubious to form the bitwise negation of a bool,
    even where it's harmless. That will be easier to avoid once gcc-7 is
    accepted for production.
---
 bourn_cast.hpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bourn_cast.hpp b/bourn_cast.hpp
index ddfb5bd..d5a9a28 100644
--- a/bourn_cast.hpp
+++ b/bourn_cast.hpp
@@ -38,6 +38,9 @@
 #   if 5 <= __GNUC__
 #       pragma GCC diagnostic ignored "-Wbool-compare"
 #   endif // 5 <= __GNUC__
+#   if 7 <= __GNUC__
+#       pragma GCC diagnostic ignored "-Wbool-operation"
+#   endif // 7 <= __GNUC__
 #elif defined LMI_MSC
 #   pragma warning(push)
 #   pragma warning(disable : 4018)



reply via email to

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