[Libreoffice-commits] core.git: forms/source

Lionel Elie Mamane lionel at mamane.lu
Wed Oct 16 19:07:16 PDT 2013


 forms/source/component/CheckBox.cxx |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 9d5e05edb20819e7b989f366fbd86ca4c2cd7cc5
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Thu Oct 17 04:06:24 2013 +0200

    bogus WaE: 'bValue' may be used uninitialized in this function
    
    Change-Id: I14983509a41bd6be0d7fed29d7f89fa4a21fe08a

diff --git a/forms/source/component/CheckBox.cxx b/forms/source/component/CheckBox.cxx
index 5198ccc..5db7397 100644
--- a/forms/source/component/CheckBox.cxx
+++ b/forms/source/component/CheckBox.cxx
@@ -217,7 +217,7 @@ Any OCheckBoxModel::translateDbColumnToControlValue()
 
     //////////////////////////////////////////////////////////////////
     // Set value in ControlModel
-    bool bValue = false;
+    bool bValue;
     if(DbUseBool())
     {
         bValue = m_xColumn->getBoolean();
@@ -241,7 +241,17 @@ Any OCheckBoxModel::translateDbColumnToControlValue()
     }
     else if ( !aValue.hasValue() )
     {
+        // Since above either bValue is initialised, either aValue.hasValue(),
+        // bValue cannot be used uninitialised here.
+        // But GCC does not see/understand that, which breaks -Werror builds.
+#if defined __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
         aValue <<= (sal_Int16)( bValue ? STATE_CHECK : STATE_NOCHECK );
+#if defined __GNUC__
+#pragma GCC diagnostic pop
+#endif
     }
 
     return aValue;


More information about the Libreoffice-commits mailing list