[Libreoffice-commits] core.git: include/o3tl

Stephan Bergmann sbergman at redhat.com
Fri Sep 16 15:59:07 UTC 2016


 include/o3tl/typed_flags_set.hxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 43d633d789d817916a11801d0bd3c927a75ac258
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Sep 16 17:55:15 2016 +0200

    Try silence cid#1371124 ("Operands don't affect result")
    
    ...where Coverity doesn't reveal which instantiation of the templated code it is
    complaining about, but it must be ScRefFlags (sc/inc/address.hxx), which has
    underlying type sal_uInt16 and a mask of 0xFFFF.
    
    Change-Id: If0abd195885acdffb3c61cdab88d7a2c87c00c4f

diff --git a/include/o3tl/typed_flags_set.hxx b/include/o3tl/typed_flags_set.hxx
index 9b8cb81..e3ca014 100644
--- a/include/o3tl/typed_flags_set.hxx
+++ b/include/o3tl/typed_flags_set.hxx
@@ -79,7 +79,11 @@ struct is_typed_flags {
         {
 #if !HAVE_CXX11_CONSTEXPR || HAVE_CXX14_CONSTEXPR
             assert(detail::isNonNegative(value));
-            assert((value & ~M) == 0);
+            assert(
+                static_cast<typename std::underlying_type<E>::type>(~M) == 0
+                    // avoid "operands don't affect result" warnings when M
+                    // covers all bits of the underlying type
+                || (value & ~M) == 0);
 #endif
         }
 


More information about the Libreoffice-commits mailing list