[Libreoffice-commits] core.git: desktop/source include/tools lotuswordpro/qa oox/source sc/source sd/source sw/source vcl/unx writerfilter/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Mon Feb 24 18:24:17 UTC 2020
desktop/source/app/officeipcthread.cxx | 5 ++-
include/tools/color.hxx | 2 -
lotuswordpro/qa/cppunit/import_test.cxx | 2 -
oox/source/helper/propertymap.cxx | 3 +-
sc/source/core/data/table2.cxx | 4 +-
sd/source/filter/eppt/pptx-animations.cxx | 14 ++++++---
sw/source/core/access/AccessibilityCheck.cxx | 27 ++++++++++++------
sw/source/core/doc/docftn.cxx | 2 -
sw/source/uibase/uno/SwXDocumentSettings.cxx | 2 -
sw/source/uibase/utlui/navicfg.cxx | 2 -
vcl/unx/generic/gdi/salbmp.cxx | 2 -
vcl/unx/gtk3/gtk3gtkinst.cxx | 3 ++
writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 2 -
13 files changed, 45 insertions(+), 25 deletions(-)
New commits:
commit 1ca7e41fa8e300d0f5b8e0427ea3e6cad27ce175
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Feb 24 11:02:04 2020 +0100
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Mon Feb 24 19:23:38 2020 +0100
workaround GCC 9.2.1 -Og -Werror=maybe-uninitialized
vcl/unx/generic/gdi/salbmp.cxx:727:32: error: ‘pixmapHandle’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
vcl/unx/gtk3/gtk3gtkinst.cxx:7336:16: error: ‘eRet’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
etc.
One looks like it might occur in practice.
Change-Id: I09af7d36b134b31cb7bd8047b5c73f4a49c9d9b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89351
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index b1674138c5cd..923aab00c702 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -667,8 +667,9 @@ void RequestHandler::EnableRequests()
if (pGlobal->mState != State::Downing) {
pGlobal->mState = State::RequestsEnabled;
}
- // hit the compiler over the head
- ProcessDocumentsRequest aEmptyReq { std::optional< OUString >() };
+ // hit the compiler over the head - this avoids GCC -Werror=maybe-uninitialized
+ std::optional<OUString> tmp;
+ ProcessDocumentsRequest aEmptyReq(tmp);
// trigger already queued requests
RequestHandler::ExecuteCmdLineRequests(aEmptyReq, true);
}
diff --git a/include/tools/color.hxx b/include/tools/color.hxx
index cf11e0ae9df2..b5555c4cfccd 100644
--- a/include/tools/color.hxx
+++ b/include/tools/color.hxx
@@ -242,7 +242,7 @@ inline void Color::Merge( const Color& rMergeColor, sal_uInt8 cTransparency )
// to reduce the noise when moving these into and out of Any
inline bool operator >>=( const css::uno::Any & rAny, Color & value )
{
- sal_Int32 nTmp;
+ sal_Int32 nTmp = {}; // spurious -Werror=maybe-uninitialized
if (!(rAny >>= nTmp))
return false;
value = Color(nTmp);
diff --git a/lotuswordpro/qa/cppunit/import_test.cxx b/lotuswordpro/qa/cppunit/import_test.cxx
index 8093dc5c6247..8ffddc2153c1 100644
--- a/lotuswordpro/qa/cppunit/import_test.cxx
+++ b/lotuswordpro/qa/cppunit/import_test.cxx
@@ -173,7 +173,7 @@ CPPUNIT_TEST_FIXTURE(LotusWordProTest, paragraphProperties)
uno::Reference<text::XTextRange> const xParagraph8(xParaEnum->nextElement(),
uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertySet> xPropertySet8(xParagraph8, uno::UNO_QUERY);
- sal_Int16 nParaAdjust;
+ sal_Int16 nParaAdjust = {}; // spurious -Werror=maybe-uninitialized
xPropertySet8->getPropertyValue("ParaAdjust") >>= nParaAdjust;
CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER,
static_cast<style::ParagraphAdjust>(nParaAdjust));
diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx
index 34a58cf12bb9..75716b851534 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -532,7 +532,8 @@ static const char *lclGetEnhancedParameterType( sal_uInt16 nType )
static void printParameterPairData(int level, EnhancedCustomShapeParameterPair const &pp)
{
// These are always sal_Int32s so lets depend on that for our packing ...
- sal_Int32 nFirstValue, nSecondValue;
+ sal_Int32 nFirstValue = {};
+ sal_Int32 nSecondValue = {}; // spurious -Werror=maybe-uninitialized
if (!(pp.First.Value >>= nFirstValue))
assert (false);
if (!(pp.Second.Value >>= nSecondValue))
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index d27afaf4fd63..b3aef84bec14 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -928,8 +928,8 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
// Attribute
- SCROW nAttrRow1;
- SCROW nAttrRow2;
+ SCROW nAttrRow1 = {}; // spurious -Werror=maybe-uninitialized
+ SCROW nAttrRow2 = {}; // spurious -Werror=maybe-uninitialized
const ScPatternAttr* pPattern;
std::unique_ptr<ScAttrIterator> pAttrIter(aCol[nCol].CreateAttrIterator( nRow1, nRow2 ));
while ( (pPattern = pAttrIter->Next( nAttrRow1, nAttrRow2 )) != nullptr )
diff --git a/sd/source/filter/eppt/pptx-animations.cxx b/sd/source/filter/eppt/pptx-animations.cxx
index f809b6222484..0badff184841 100644
--- a/sd/source/filter/eppt/pptx-animations.cxx
+++ b/sd/source/filter/eppt/pptx-animations.cxx
@@ -101,8 +101,8 @@ void WriteAnimationProperty(const FSHelperPtr& pFS, const Any& rAny, sal_Int32 n
return;
}
- sal_uInt32 nRgb;
- double fDouble;
+ sal_Int32 nRgb = {}; // spurious -Werror=maybe-uninitialized
+ double fDouble = {}; // spurious -Werror=maybe-uninitialized
TypeClass aClass = rAny.getValueType().getTypeClass();
bool bWriteToken
@@ -115,11 +115,17 @@ void WriteAnimationProperty(const FSHelperPtr& pFS, const Any& rAny, sal_Int32 n
switch (rAny.getValueType().getTypeClass())
{
case TypeClass_LONG:
- rAny >>= nRgb;
+ if (!(rAny >>= nRgb))
+ {
+ assert(false);
+ }
pFS->singleElementNS(XML_a, XML_srgbClr, XML_val, I32SHEX(nRgb));
break;
case TypeClass_DOUBLE:
- rAny >>= fDouble;
+ if (!(rAny >>= fDouble))
+ {
+ assert(false);
+ }
pFS->singleElementNS(XML_p, XML_fltVal, XML_val, OString::number(fDouble));
break;
case TypeClass_STRING:
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx
index 641c32b49f15..3c2b1f7b5d8c 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -339,16 +339,24 @@ private:
void checkTextRange(uno::Reference<text::XTextRange> const& xTextRange,
uno::Reference<text::XTextContent> const& xParagraph, SwTextNode* pTextNode)
{
- sal_Int32 nParaBackColor;
+ sal_Int32 nParaBackColor = {}; // spurious -Werror=maybe-uninitialized
uno::Reference<beans::XPropertySet> xParagraphProperties(xParagraph, uno::UNO_QUERY);
- xParagraphProperties->getPropertyValue("ParaBackColor") >>= nParaBackColor;
+ if (!(xParagraphProperties->getPropertyValue("ParaBackColor") >>= nParaBackColor))
+ {
+ SAL_WARN("sw.a11y", "ParaBackColor void");
+ return;
+ }
uno::Reference<beans::XPropertySet> xProperties(xTextRange, uno::UNO_QUERY);
if (xProperties.is())
{
// Foreground color
- sal_Int32 nCharColor;
- xProperties->getPropertyValue("CharColor") >>= nCharColor;
+ sal_Int32 nCharColor = {}; // spurious -Werror=maybe-uninitialized
+ if (!(xProperties->getPropertyValue("CharColor") >>= nCharColor))
+ { // not sure this is impossible, can the default be void?
+ SAL_WARN("sw.a11y", "CharColor void");
+ return;
+ }
Color aForegroundColor(nCharColor);
if (aForegroundColor == COL_AUTO)
return;
@@ -368,12 +376,13 @@ private:
aPageBackground = rXFillColorItem->GetColorValue();
}
- sal_Int32 nCharBackColor;
- sal_Int16 eRelief;
-
- xProperties->getPropertyValue("CharBackColor") >>= nCharBackColor;
- xProperties->getPropertyValue("CharRelief") >>= eRelief;
+ sal_Int32 nCharBackColor = {}; // spurious -Werror=maybe-uninitialized
+ if (!(xProperties->getPropertyValue("CharBackColor") >>= nCharBackColor))
+ {
+ SAL_WARN("sw.a11y", "CharBackColor void");
+ return;
+ }
// Determine the background color
// Try Character background (highlight)
Color aBackgroundColor(nCharBackColor);
diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
index 9bd2a9ec63c7..36178ab18090 100644
--- a/sw/source/core/doc/docftn.cxx
+++ b/sw/source/core/doc/docftn.cxx
@@ -451,7 +451,7 @@ bool SwDoc::SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr,
pUndo.reset(new SwUndoChangeFootNote( rPam, rNumStr, bIsEndNote ));
}
- SwTextFootnote* pTextFootnote;
+ SwTextFootnote* pTextFootnote = nullptr;
sal_uLong nIdx;
bool bChg = false;
bool bTypeChgd = false;
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 7284b0313274..0cb9eaaa1d16 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -458,7 +458,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
break;
case HANDLE_PRINTER_PAPER:
{
- bool bPreferPrinterPapersize;
+ bool bPreferPrinterPapersize = {}; // spurious -Werror=maybe-uninitialized
if(!(rValue >>= bPreferPrinterPapersize))
throw IllegalArgumentException();
mbPreferPrinterPapersize = bPreferPrinterPapersize;
diff --git a/sw/source/uibase/utlui/navicfg.cxx b/sw/source/uibase/utlui/navicfg.cxx
index 40c1c30a861f..f1b4f39834d9 100644
--- a/sw/source/uibase/utlui/navicfg.cxx
+++ b/sw/source/uibase/utlui/navicfg.cxx
@@ -64,7 +64,7 @@ SwNavigationConfig::SwNavigationConfig() :
{
case 0:
{
- sal_Int32 nTmp;
+ sal_Int32 nTmp = {}; // spurious -Werror=maybe-uninitialized
if (pValues[nProp] >>= nTmp)
{
if (nTmp < sal_Int32(ContentTypeId::UNKNOWN)
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index 20760a452559..96b437c0ed98 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -708,7 +708,7 @@ bool X11SalBitmap::Create(
css::uno::Sequence< css::uno::Any > args;
if( xFastPropertySet->getFastPropertyValue(bMask ? 2 : 1) >>= args ) {
- long pixmapHandle;
+ long pixmapHandle = {}; // spurious -Werror=maybe-uninitialized
if( ( args[1] >>= pixmapHandle ) && ( args[2] >>= depth ) ) {
mbGrey = bMask;
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 0875bb071251..9d958393a5f1 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -59,6 +59,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <officecfg/Office/Common.hxx>
#include <rtl/bootstrap.hxx>
+#include <o3tl/unreachable.hxx>
#include <svl/zforlist.hxx>
#include <svl/zformat.hxx>
#include <tools/helpers.hxx>
@@ -7332,6 +7333,8 @@ public:
case vcl::ImageType::Size32:
eRet = GTK_ICON_SIZE_DIALOG;
break;
+ default:
+ O3TL_UNREACHABLE;
}
return eRet;
}
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 4aa381c9ebb5..08292c8d4459 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1687,7 +1687,7 @@ void OOXMLFastContextHandlerShape::sendShape( Token_t Element )
}
if (mnTableDepth > 0 && mbLayoutInCell) //if we had a table
{
- sal_Int16 nCurrentHorOriRel; //A temp variable for storaging the current setting
+ sal_Int16 nCurrentHorOriRel = {}; // spurious -Werror=maybe-uninitialized
xShapePropSet->getPropertyValue("HoriOrientRelation") >>= nCurrentHorOriRel;
//and the correction:
if (nCurrentHorOriRel == com::sun::star::text::RelOrientation::PAGE_FRAME)
More information about the Libreoffice-commits
mailing list