[Libreoffice-commits] core.git: basctl/source basic/source chart2/source compilerplugins/clang connectivity/source cui/source dbaccess/source filter/source framework/source l10ntools/source oox/source reportdesign/source scripting/source sc/source sdext/source sd/source sfx2/source solenv/CompilerTest_compilerplugins_clang.mk soltools/mkdepend stoc/source svtools/source svx/source sw/source toolkit/source ucb/source vcl/source vcl/unx writerfilter/source xmlhelp/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Feb 11 12:25:57 UTC 2019


 basctl/source/dlged/dlgedobj.cxx                           |    4 
 basic/source/classes/sbunoobj.cxx                          |    3 
 basic/source/comp/exprgen.cxx                              |    2 
 chart2/source/view/charttypes/NetChart.cxx                 |    5 
 chart2/source/view/main/ChartView.cxx                      |    2 
 compilerplugins/clang/test/writeonlyvars.cxx               |  147 +
 compilerplugins/clang/writeonlyvars.cxx                    | 1148 +++++++++++++
 connectivity/source/drivers/dbase/DTable.cxx               |   35 
 connectivity/source/drivers/firebird/Connection.cxx        |    5 
 connectivity/source/drivers/firebird/Table.cxx             |    3 
 connectivity/source/drivers/mork/MorkParser.cxx            |    3 
 cui/source/dialogs/hldocntp.cxx                            |    6 
 cui/source/options/treeopt.cxx                             |    5 
 dbaccess/source/filter/xml/xmlExport.cxx                   |    2 
 dbaccess/source/filter/xml/xmlfilter.cxx                   |    5 
 dbaccess/source/ui/browser/unodatbr.cxx                    |    2 
 dbaccess/source/ui/misc/RowSetDrop.cxx                     |    4 
 dbaccess/source/ui/misc/TokenWriter.cxx                    |    2 
 dbaccess/source/ui/relationdesign/RTableConnectionData.cxx |    2 
 filter/source/flash/swffilter.cxx                          |    6 
 filter/source/graphicfilter/idxf/dxf2mtf.cxx               |    2 
 filter/source/odfflatxml/OdfFlatXml.cxx                    |    3 
 filter/source/xsltfilter/XSLTFilter.cxx                    |    9 
 framework/source/layoutmanager/layoutmanager.cxx           |    5 
 framework/source/uielement/menubarmanager.cxx              |    3 
 framework/source/uielement/statusbarmanager.cxx            |    5 
 framework/source/uielement/toolbarmerger.cxx               |    2 
 framework/source/uielement/uicommanddescription.cxx        |    3 
 l10ntools/source/idxdict/idxdict.cxx                       |    2 
 oox/source/export/shapes.cxx                               |    6 
 reportdesign/source/core/api/ReportDefinition.cxx          |    4 
 sc/source/core/data/documen2.cxx                           |    3 
 sc/source/core/data/table3.cxx                             |    4 
 sc/source/ui/unoobj/PivotTableDataProvider.cxx             |   15 
 sc/source/ui/vba/vbaworkbook.cxx                           |    2 
 sc/source/ui/view/gridwin5.cxx                             |    3 
 scripting/source/dlgprov/dlgevtatt.cxx                     |    2 
 sd/source/ui/unoidl/UnoDocumentSettings.cxx                |    2 
 sdext/source/presenter/PresenterSlidePreview.cxx           |   15 
 sdext/source/presenter/PresenterTextView.cxx               |    9 
 sdext/source/presenter/PresenterToolBar.cxx                |    3 
 sfx2/source/bastyp/fltfnc.cxx                              |    5 
 sfx2/source/dialog/backingwindow.cxx                       |   12 
 sfx2/source/notebookbar/NotebookbarTabControl.cxx          |    3 
 solenv/CompilerTest_compilerplugins_clang.mk               |    1 
 soltools/mkdepend/main.c                                   |    7 
 soltools/mkdepend/pr.c                                     |    4 
 stoc/source/inspect/introspection.cxx                      |    4 
 svtools/source/contnr/fileview.cxx                         |    8 
 svtools/source/contnr/imivctl1.cxx                         |    6 
 svx/source/customshapes/EnhancedCustomShape2d.cxx          |    2 
 svx/source/fmcomp/fmgridcl.cxx                             |   14 
 svx/source/form/fmshimp.cxx                                |    2 
 sw/source/core/unocore/unochart.cxx                        |    5 
 sw/source/filter/docx/swdocxreader.cxx                     |    2 
 sw/source/filter/ww8/ww8par3.cxx                           |    3 
 sw/source/filter/xml/xmltexte.cxx                          |   10 
 sw/source/ui/dbui/addresslistdialog.cxx                    |    8 
 sw/source/uibase/app/apphdl.cxx                            |    3 
 sw/source/uibase/dbui/dbtree.cxx                           |    5 
 sw/source/uibase/docvw/srcedtw.cxx                         |    2 
 toolkit/source/awt/vclxwindow.cxx                          |    6 
 ucb/source/ucp/file/filtask.cxx                            |    4 
 vcl/source/window/builder.cxx                              |    2 
 vcl/source/window/printdlg.cxx                             |    8 
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx             |    8 
 vcl/unx/gtk/salprn-gtk.cxx                                 |    6 
 writerfilter/source/dmapper/FontTable.cxx                  |    8 
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx            |    4 
 xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx      |    3 
 70 files changed, 1335 insertions(+), 313 deletions(-)

New commits:
commit 0d1253c2328106a443d16b6c8e96347de33e2ace
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jan 24 09:08:34 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Feb 11 13:25:31 2019 +0100

    new loplugin writeonlyvars
    
    largely based on the relevant portion of the unusedfields loplugin, but
    adapted for local vars
    
    Change-Id: Ic522a941573940e8f75c88f90ba5f37508ca49b1
    Reviewed-on: https://gerrit.libreoffice.org/66835
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 29aabd49a6d2..8d2b42010fdd 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -236,11 +236,9 @@ bool DlgEdObj::TransformControlToSdrCoordinates(
     DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformControlToSdrCoordinates: no form property set!" );
     if ( !xPSetForm.is() )
         return false;
-    sal_Int32 nFormX = 0, nFormY = 0, nFormWidth, nFormHeight;
+    sal_Int32 nFormX = 0, nFormY = 0;
     xPSetForm->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nFormX;
     xPSetForm->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nFormY;
-    xPSetForm->getPropertyValue( DLGED_PROP_WIDTH ) >>= nFormWidth;
-    xPSetForm->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nFormHeight;
     Size aFormPos( nFormX, nFormY );
 
     // convert logic units to pixel
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 0449b2e4f40c..553c6be7360d 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -4630,12 +4630,9 @@ void SbUnoStructRefObject::initMemberCache()
 {
     if ( mbMemberCacheInit )
         return;
-    sal_Int32 nAll = 0;
     typelib_TypeDescription * pTD = nullptr;
     maMemberInfo.getType().getDescription(&pTD);
     typelib_CompoundTypeDescription * pCompTypeDescr = reinterpret_cast<typelib_CompoundTypeDescription *>(pTD);
-    for ( ; pCompTypeDescr; pCompTypeDescr = pCompTypeDescr->pBaseTypeDescription )
-        nAll += pCompTypeDescr->nMembers;
     for ( pCompTypeDescr = reinterpret_cast<typelib_CompoundTypeDescription *>(pTD); pCompTypeDescr;
         pCompTypeDescr = pCompTypeDescr->pBaseTypeDescription )
     {
diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx
index e3615f91f4e7..4cf496b2f966 100644
--- a/basic/source/comp/exprgen.cxx
+++ b/basic/source/comp/exprgen.cxx
@@ -209,7 +209,6 @@ void SbiExprList::Gen(SbiCodeGen& rGen)
     {
         rGen.Gen( SbiOpcode::ARGC_ );
         // Type adjustment at DECLARE
-        sal_uInt16 nCount = 1;
 
         for( auto& pExpr: aData )
         {
@@ -249,7 +248,6 @@ void SbiExprList::Gen(SbiCodeGen& rGen)
             {
                 rGen.Gen( SbiOpcode::ARGV_ );
             }
-            nCount++;
         }
     }
 }
diff --git a/chart2/source/view/charttypes/NetChart.cxx b/chart2/source/view/charttypes/NetChart.cxx
index 56e46bf1d791..c2d1026f5d9f 100644
--- a/chart2/source/view/charttypes/NetChart.cxx
+++ b/chart2/source/view/charttypes/NetChart.cxx
@@ -346,8 +346,6 @@ void NetChart::createShapes()
     //better performance for big data
     std::map< VDataSeries*, FormerPoint > aSeriesFormerPointMap;
     m_bPointsWereSkipped = false;
-    sal_Int32 nSkippedPoints = 0;
-    sal_Int32 nCreatedPoints = 0;
 
     bool bDateCategory = (m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis());
 
@@ -487,7 +485,6 @@ void NetChart::createShapes()
                                aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ
                                                             , aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) )
                     {
-                        ++nSkippedPoints;
                         m_bPointsWereSkipped = true;
                         continue;
                     }
@@ -535,8 +532,6 @@ void NetChart::createShapes()
                             uno::Reference<drawing::XShape>( xPointGroupShape_Shapes, uno::UNO_QUERY );
 
                     {
-                        nCreatedPoints++;
-
                         //create data point
                         drawing::Direction3D aSymbolSize(0,0,0);
                         if (bCreateSymbol) // implies pSymbolProperties
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index a989552ffe90..b2e493e8d46e 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -952,7 +952,6 @@ drawing::Direction3D SeriesPlotterContainer::getPreferredAspectRatio()
 {
     drawing::Direction3D aPreferredAspectRatio(1.0,1.0,1.0);
 
-    sal_Int32 nPlotterCount=0;
     //get a list of all preferred aspect ratios and combine them
     //first with special demands wins (less or equal zero <-> arbitrary)
     double fx, fy, fz;
@@ -985,7 +984,6 @@ drawing::Direction3D SeriesPlotterContainer::getPreferredAspectRatio()
 
         if( fx>0 && fy>0 && fz>0 )
             break;
-        ++nPlotterCount;
     }
     aPreferredAspectRatio = drawing::Direction3D(fx, fy, fz);
     return aPreferredAspectRatio;
diff --git a/compilerplugins/clang/test/writeonlyvars.cxx b/compilerplugins/clang/test/writeonlyvars.cxx
new file mode 100644
index 000000000000..719ad26ea870
--- /dev/null
+++ b/compilerplugins/clang/test/writeonlyvars.cxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <vector>
+#include <ostream>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace Bar
+{
+void test()
+{
+    // check that we DON'T see reads here
+    // expected-error at +1 {{write m_bar3 [loplugin:writeonlyvars]}}
+    int* m_bar3;
+    // expected-error at +1 {{write m_bar3b [loplugin:writeonlyvars]}}
+    int* m_bar3b;
+    m_bar3 = nullptr;
+    m_bar3b = m_bar3 = nullptr;
+
+    // check that we see reads of field when passed to a function pointer
+    // check that we see read of a field that is a function pointer
+    // expected-error at +2 {{write m_bar4 [loplugin:writeonlyvars]}}
+    // expected-error at +1 {{read m_bar4 [loplugin:writeonlyvars]}}
+    int m_bar4;
+    // expected-error at +1 {{read m_barfunctionpointer [loplugin:writeonlyvars]}}
+    void (*m_barfunctionpointer)(int&) = nullptr;
+    m_barfunctionpointer(m_bar4);
+
+    // check that we see reads of a field when used in variable init
+    // expected-error at +1 {{read m_bar5 [loplugin:writeonlyvars]}}
+    int m_bar5 = 1;
+    int x = m_bar5;
+    (void)x;
+
+    // check that we see reads of a field when used in ranged-for
+    // expected-error at +1 {{read m_bar6 [loplugin:writeonlyvars]}}
+    std::vector<int> m_bar6;
+    for (auto i : m_bar6)
+    {
+        (void)i;
+    }
+
+    // check that we see writes of array fields
+    // expected-error at +1 {{write m_bar7 [loplugin:writeonlyvars]}}
+    int m_bar7[5];
+    m_bar7[3] = 1;
+
+    // check that we see reads when a field is used in an array expression
+    // expected-error at +1 {{read m_bar8 [loplugin:writeonlyvars]}}
+    int m_bar8 = 1;
+    // expected-error at +1 {{read tmp [loplugin:writeonlyvars]}}
+    char tmp[5];
+    auto x2 = tmp[m_bar8];
+    (void)x2;
+
+    // check that we don't see reads when calling operator>>=
+    // expected-error at +1 {{write m_bar9 [loplugin:writeonlyvars]}}
+    int m_bar9;
+    // expected-error at +1 {{read any [loplugin:writeonlyvars]}}
+    css::uno::Any any;
+    any >>= m_bar9;
+
+    // check that we see don't see writes when calling operator<<=
+    // expected-error at +1 {{read m_bar10 [loplugin:writeonlyvars]}}
+    int m_bar10;
+    // expected-error at +2 {{write any2 [loplugin:writeonlyvars]}}
+    // expected-error at +1 {{read any2 [loplugin:writeonlyvars]}}
+    css::uno::Any any2;
+    any2 <<= m_bar10;
+};
+};
+
+struct ReadOnly1
+{
+    ReadOnly1(int&);
+};
+
+namespace ReadOnlyAnalysis
+{
+void method1(int&);
+
+void test()
+{
+    // check that we see a write when we pass by non-const ref
+    // expected-error at +2 {{read m_f2 [loplugin:writeonlyvars]}}
+    // expected-error at +1 {{write m_f2 [loplugin:writeonlyvars]}}
+    int m_f2;
+    method1(m_f2);
+
+    // expected-error at +1 {{write m_f4 [loplugin:writeonlyvars]}}
+    std::vector<int> m_f4;
+    m_f4.push_back(1);
+
+    // check that we see a write when we pass by non-const ref
+    // expected-error at +2 {{read m_f5 [loplugin:writeonlyvars]}}
+    // expected-error at +1 {{write m_f5 [loplugin:writeonlyvars]}}
+    int m_f5;
+    ReadOnly1 a(m_f5);
+
+    // check that we see a write when we pass by non-const ref
+    // expected-error at +2 {{read m_f6 [loplugin:writeonlyvars]}}
+    // expected-error at +1 {{write m_f6 [loplugin:writeonlyvars]}}
+    int m_f6;
+    // expected-error at +1 {{write r [loplugin:writeonlyvars]}}
+    int& r = m_f6;
+    r = 1;
+};
+};
+
+void ReadOnlyAnalysis3()
+{
+    // expected-error at +1 {{read m_f1 [loplugin:writeonlyvars]}}
+    int m_f1 = 0;
+
+    if (m_f1)
+        m_f1 = 1;
+};
+
+// Verify the special logic for container fields that only contains mutations that
+// add elements.
+void ReadOnlyAnalysis4()
+{
+    // expected-error at +1 {{read m_readonly [loplugin:writeonlyvars]}}
+    std::vector<int> m_readonly;
+    // expected-error at +1 {{write m_writeonly [loplugin:writeonlyvars]}}
+    std::vector<int> m_writeonly;
+    // expected-error at +1 {{read m_readonlyCss [loplugin:writeonlyvars]}}
+    css::uno::Sequence<sal_Int32> m_readonlyCss;
+
+    // expected-error at +1 {{write x [loplugin:writeonlyvars]}}
+    int x = m_readonly[0];
+    (void)x;
+    *m_readonly.begin() = 1; // TODO?
+
+    m_writeonly.push_back(0);
+
+    x = m_readonlyCss.getArray()[0];
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/writeonlyvars.cxx b/compilerplugins/clang/writeonlyvars.cxx
new file mode 100644
index 000000000000..d9a02898ca10
--- /dev/null
+++ b/compilerplugins/clang/writeonlyvars.cxx
@@ -0,0 +1,1148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#if !defined _WIN32 //TODO, #include <sys/file.h>
+
+#include <cassert>
+#include <string>
+#include <iostream>
+#include <fstream>
+#include <unordered_set>
+#include <vector>
+#include <algorithm>
+#include <sys/file.h>
+#include <unistd.h>
+#include "plugin.hxx"
+#include "compat.hxx"
+#include "check.hxx"
+
+/**
+  Finds variables that are effectively write-only.
+
+  Largely the same as the unusedfields.cxx loplugin.
+*/
+
+namespace
+{
+struct MyVarInfo
+{
+    const VarDecl* varDecl;
+    std::string parent;
+    std::string varName;
+    std::string varType;
+    std::string sourceLocation;
+};
+bool operator<(const MyVarInfo& lhs, const MyVarInfo& rhs)
+{
+    return std::tie(lhs.parent, lhs.varName) < std::tie(rhs.parent, rhs.varName);
+}
+
+// try to limit the voluminous output a little
+static std::set<MyVarInfo> readFromSet;
+static std::set<MyVarInfo> writeToSet;
+static std::set<MyVarInfo> definitionSet;
+
+/**
+ * Wrap the different kinds of callable and callee objects in the clang AST so I can define methods that handle everything.
+ */
+class CallerWrapper
+{
+    const CallExpr* m_callExpr;
+    const CXXConstructExpr* m_cxxConstructExpr;
+
+public:
+    CallerWrapper(const CallExpr* callExpr)
+        : m_callExpr(callExpr)
+        , m_cxxConstructExpr(nullptr)
+    {
+    }
+    CallerWrapper(const CXXConstructExpr* cxxConstructExpr)
+        : m_callExpr(nullptr)
+        , m_cxxConstructExpr(cxxConstructExpr)
+    {
+    }
+    unsigned getNumArgs() const
+    {
+        return m_callExpr ? m_callExpr->getNumArgs() : m_cxxConstructExpr->getNumArgs();
+    }
+    const Expr* getArg(unsigned i) const
+    {
+        return m_callExpr ? m_callExpr->getArg(i) : m_cxxConstructExpr->getArg(i);
+    }
+};
+class CalleeWrapper
+{
+    const FunctionDecl* m_calleeFunctionDecl = nullptr;
+    const CXXConstructorDecl* m_cxxConstructorDecl = nullptr;
+    const FunctionProtoType* m_functionPrototype = nullptr;
+
+public:
+    explicit CalleeWrapper(const FunctionDecl* calleeFunctionDecl)
+        : m_calleeFunctionDecl(calleeFunctionDecl)
+    {
+    }
+    explicit CalleeWrapper(const CXXConstructExpr* cxxConstructExpr)
+        : m_cxxConstructorDecl(cxxConstructExpr->getConstructor())
+    {
+    }
+    explicit CalleeWrapper(const FunctionProtoType* functionPrototype)
+        : m_functionPrototype(functionPrototype)
+    {
+    }
+    unsigned getNumParams() const
+    {
+        if (m_calleeFunctionDecl)
+            return m_calleeFunctionDecl->getNumParams();
+        else if (m_cxxConstructorDecl)
+            return m_cxxConstructorDecl->getNumParams();
+        else if (m_functionPrototype->param_type_begin() == m_functionPrototype->param_type_end())
+            // FunctionProtoType will assert if we call getParamTypes() and it has no params
+            return 0;
+        else
+            return m_functionPrototype->getParamTypes().size();
+    }
+    const QualType getParamType(unsigned i) const
+    {
+        if (m_calleeFunctionDecl)
+            return m_calleeFunctionDecl->getParamDecl(i)->getType();
+        else if (m_cxxConstructorDecl)
+            return m_cxxConstructorDecl->getParamDecl(i)->getType();
+        else
+            return m_functionPrototype->getParamTypes()[i];
+    }
+    std::string getNameAsString() const
+    {
+        if (m_calleeFunctionDecl)
+            return m_calleeFunctionDecl->getNameAsString();
+        else if (m_cxxConstructorDecl)
+            return m_cxxConstructorDecl->getNameAsString();
+        else
+            return "";
+    }
+    CXXMethodDecl const* getAsCXXMethodDecl() const
+    {
+        if (m_calleeFunctionDecl)
+            return dyn_cast<CXXMethodDecl>(m_calleeFunctionDecl);
+        return nullptr;
+    }
+};
+
+class WriteOnlyVars : public loplugin::FilteringPlugin<WriteOnlyVars>
+{
+public:
+    explicit WriteOnlyVars(loplugin::InstantiationData const& data)
+        : FilteringPlugin(data)
+    {
+    }
+
+    virtual void run() override;
+
+    bool shouldVisitTemplateInstantiations() const { return true; }
+    bool shouldVisitImplicitCode() const { return true; }
+
+    bool VisitVarDecl(const VarDecl*);
+    bool VisitDeclRefExpr(const DeclRefExpr*);
+    bool TraverseIfStmt(IfStmt*);
+
+private:
+    MyVarInfo niceName(const VarDecl*);
+    void checkIfReadFrom(const VarDecl* varDecl, const Expr* memberExpr);
+    void checkIfWrittenTo(const VarDecl* varDecl, const Expr* memberExpr);
+    bool checkForWriteWhenUsingCollectionType(const CXXMethodDecl* calleeMethodDecl);
+    bool IsPassedByNonConst(const VarDecl* varDecl, const Stmt* child, CallerWrapper callExpr,
+                            CalleeWrapper calleeFunctionDecl);
+    llvm::Optional<CalleeWrapper> getCallee(CallExpr const*);
+
+    // For reasons I do not understand, parentFunctionDecl() is not reliable, so
+    // we store the parent function on the way down the AST.
+    FunctionDecl* insideFunctionDecl = nullptr;
+    std::vector<VarDecl const*> insideConditionalCheckOfMemberSet;
+};
+
+void WriteOnlyVars::run()
+{
+    TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+
+    if (!isUnitTestMode())
+    {
+        StringRef fn(handler.getMainFileName());
+        // playing paging-in games with volatile
+        if (loplugin::isSamePathname(fn, SRCDIR "/sal/osl/unx/file.cxx"))
+            return;
+        // playing paging-in games with volatile
+        if (loplugin::isSamePathname(fn, SRCDIR "/desktop/unx/source/file_image_unx.c"))
+            return;
+        // false+
+        if (loplugin::isSamePathname(fn, SRCDIR "/store/source/storpage.cxx"))
+            return;
+        // yydebug?
+        if (loplugin::isSamePathname(fn, SRCDIR "/idlc/source/idlccompile.cxx"))
+            return;
+        if (fn.contains("/qa/"))
+            return;
+        if (fn.contains("/vcl/workben/"))
+            return;
+        // preload
+        if (loplugin::isSamePathname(fn, SRCDIR "/cppuhelper/source/servicemanager.cxx"))
+            return;
+        // doing a "free items outside lock" thing
+        if (loplugin::isSamePathname(fn, SRCDIR "/unotools/source/config/itemholder1.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/svl/source/config/itemholder2.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/svtools/source/config/itemholder2.cxx"))
+            return;
+        // doiing a "keep objects alive" thing
+        if (loplugin::isSamePathname(fn, SRCDIR "/jvmfwk/source/framework.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/jvmfwk/plugins/sunmajor/pluginlib/util.cxx"))
+            return;
+        // debug code
+        if (loplugin::isSamePathname(fn, SRCDIR "/svl/source/items/style.cxx"))
+            return;
+        // ok
+        if (loplugin::isSamePathname(fn, SRCDIR "/stoc/source/inspect/introspection.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/package/source/zippackage/ZipPackage.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/hwpfilter/source/hwpreader.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/treelist/transfer.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/app/brand.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/filter/igif/gifread.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/gdi/metaact.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/fontsubset/sft.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/filter/ipdf/pdfdocument.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/filter/ipdf/pdfdocument2.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/vcl/unx/generic/app/sm.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/filter/jpeg/JpegWriter.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/vcl/unx/generic/dtrans/X11_selection.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/filter/jpeg/jpegc.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/vcl/unx/generic/window/FWS.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/toolkit/source/awt/vclxspinbutton.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/toolkit/source/controls/formattedcontrol.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/svtools/source/config/helpopt.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/svtools/source/filter/SvFilterOptionsDialog.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/svtools/source/uno/generictoolboxcontroller.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/svtools/source/java/javainteractionhandler.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/basic/source/classes/sbunoobj.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn,
+                                     SRCDIR "/accessibility/source/standard/vclxaccessiblebox.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/cppcanvas/source/mtfrenderer/implrenderer.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sfx2/source/doc/guisaveas.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sfx2/source/appl/newhelp.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sfx2/source/control/thumbnailview.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sfx2/source/control/recentdocsview.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sfx2/source/view/viewfrm.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/framework/source/services/desktop.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR
+                                     "/framework/source/uielement/generictoolbarcontroller.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR
+                                     "/framework/source/uielement/complextoolbarcontroller.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn,
+                                     SRCDIR "/framework/source/interaction/quietinteraction.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/editeng/source/editeng/editdoc.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/editeng/source/editeng/impedit4.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/editeng/source/editeng/editobj.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/editeng/source/items/frmitems.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/binaryurp/source/bridge.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/svx/source/tbxctrls/fontworkgallery.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/basctl/source/basicide/moduldl2.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/canvas/source/cairo/cairo_spritecanvas.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/chart2/source/tools/DiagramHelper.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn,
+                                     SRCDIR "/chart2/source/tools/ExplicitCategoriesProvider.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/chart2/source/tools/LegendHelper.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/chart2/source/tools/OPropertySet.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/chart2/source/tools/CommonConverters.cxx"))
+            return;
+        if (loplugin::isSamePathname(
+                fn,
+                SRCDIR "/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/chart2/source/tools/DataSourceHelper.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/oox/source/export/shapes.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/oox/source/export/chartexport.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn,
+                                     SRCDIR "/filter/source/storagefilterdetect/filterdetect.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/filter/source/pdf/pdfexport.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/filter/source/svg/svgexport.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/filter/source/msfilter/svdfppt.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR
+                                     "/dbaccess/source/core/recovery/subcomponentrecovery.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR
+                                     "/dbaccess/source/core/dataaccess/documentcontainer.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR
+                                     "/dbaccess/source/core/dataaccess/databasedocument.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn,
+                                     SRCDIR "/dbaccess/source/ui/browser/genericcontroller.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/ucb/source/core/ucbcmds.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn,
+                                     SRCDIR "/desktop/source/deployment/manager/dp_manager.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR
+                                     "/desktop/source/deployment/registry/package/dp_package.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/desktop/source/lib/init.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR
+                                     "/extensions/source/propctrlr/formcomponenthandler.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/embeddedobj/source/general/docholder.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR
+                                     "/extensions/source/propctrlr/stringrepresentation.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpcontent.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpdivinfo.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpdoc.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/filter/source/pdf/impdialog.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwplayout.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpoleobject.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwprowlayout.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpfoundry.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpparastyle.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpnotes.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpfont.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwptblcell.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpusrdicts.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwpverdocument.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/lwptblformula.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/vbahelper/source/vbahelper/vbafontbase.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/vbahelper/source/vbahelper/vbadocumentbase.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/docshell/docsh8.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/docshell/docsh6.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/core/data/table3.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/unoobj/cellsuno.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/filter/excel/xelink.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/filter/lotus/lotus.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/vba/vbaworkbooks.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/vba/vbaworksheets.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/vba/vbarange.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/ui/view/drviews2.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/filter/ppt/pptin.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/ui/app/sdxfer.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/ui/view/drviewsf.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/filter/xml/sdxmlwrp.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/filter/html/pubdlg.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/core/txtnode/thints.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/core/doc/docbm.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/core/crsr/crsrsh.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/filter/xml/swxml.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/core/doc/docredln.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/filter/ww8/ww8par2.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/uibase/shells/drformsh.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/filter/ww8/ww8par6.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/ui/dbui/dbinsdlg.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sdext/source/minimizer/impoptimizer.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sdext/source/presenter/PresenterTheme.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/sdext/source/pdfimport/wrapper/wrapper.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR
+                                     "/slideshow/source/engine/animationnodes/generateevent.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/starmath/source/mathmlimport.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/starmath/source/eqnolefilehdr.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/svgio/source/svgreader/svgmarkernode.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/uui/source/iahndl-locking.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR
+                                     "/shell/source/sessioninstall/SyncDbusSessionHelper.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn,
+                                     SRCDIR "/slideshow/source/engine/opengl/TransitionerImpl.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/forms/source/component/FormattedField.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/forms/source/component/DatabaseForm.cxx"))
+            return;
+        if (loplugin::isSamePathname(fn,
+                                     SRCDIR "/reportdesign/source/ui/report/ReportController.cxx"))
+            return;
+        if (loplugin::hasPathnamePrefix(fn, SRCDIR "/test/"))
+            return;
+        if (loplugin::isSamePathname(fn, SRCDIR "/i18npool/source/localedata/LocaleNode.cxx"))
+            return;
+
+        // yynerrs?
+        if (loplugin::isSamePathname(fn, SRCDIR "/hwpfilter/source/grammar.cxx"))
+            return;
+
+        for (MyVarInfo const& v : definitionSet)
+        {
+            bool read = readFromSet.find(v) != readFromSet.end();
+            bool write = writeToSet.find(v) != writeToSet.end();
+            if (!read && write)
+                report(DiagnosticsEngine::Warning, "write-only %0", compat::getBeginLoc(v.varDecl))
+                    << v.varName;
+        }
+    }
+    else
+    {
+        for (const MyVarInfo& s : readFromSet)
+            report(DiagnosticsEngine::Warning, "read %0", compat::getBeginLoc(s.varDecl))
+                << s.varName;
+        for (const MyVarInfo& s : writeToSet)
+            report(DiagnosticsEngine::Warning, "write %0", compat::getBeginLoc(s.varDecl))
+                << s.varName;
+    }
+}
+
+MyVarInfo WriteOnlyVars::niceName(const VarDecl* varDecl)
+{
+    MyVarInfo aInfo;
+
+    aInfo.varDecl = varDecl->getCanonicalDecl();
+    aInfo.varName = varDecl->getNameAsString();
+    // sometimes the name (if it's an anonymous thing) contains the full path of the build folder, which we don't need
+    size_t idx = aInfo.varName.find(SRCDIR);
+    if (idx != std::string::npos)
+    {
+        aInfo.varName = aInfo.varName.replace(idx, strlen(SRCDIR), "");
+    }
+    aInfo.varType = varDecl->getType().getAsString();
+
+    SourceLocation expansionLoc
+        = compiler.getSourceManager().getExpansionLoc(varDecl->getLocation());
+    StringRef filename = compiler.getSourceManager().getFilename(expansionLoc);
+    aInfo.sourceLocation
+        = std::string(filename.substr(strlen(SRCDIR) + 1)) + ":"
+          + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
+    loplugin::normalizeDotDotInFilePath(aInfo.sourceLocation);
+    aInfo.parent = filename;
+
+    return aInfo;
+}
+
+static bool contains(std::string const& s, std::string const& needle)
+{
+    return s.find(needle) != std::string::npos;
+}
+
+bool WriteOnlyVars::VisitVarDecl(const VarDecl* varDecl)
+{
+    if (varDecl->isImplicit() || varDecl->isExternC() || isa<ParmVarDecl>(varDecl))
+        return true;
+    auto tc = loplugin::TypeCheck(varDecl->getType());
+    if (tc.Pointer() || tc.LvalueReference() || tc.Class("shared_ptr").StdNamespace()
+        || tc.Class("unique_ptr").StdNamespace())
+        return true;
+    if (tc.Typedef("BitmapScopedWriteAccess"))
+        return true;
+    std::string typeName = varDecl->getType().getAsString();
+    if (contains(typeName, "Guard") || contains(typeName, "Reader") || contains(typeName, "Stream")
+        || contains(typeName, "Parser") || contains(typeName, "Codec")
+        || contains(typeName, "Exception"))
+        return true;
+    varDecl = varDecl->getCanonicalDecl();
+    if (!varDecl->getLocation().isValid() || ignoreLocation(varDecl))
+        return true;
+    if (!compiler.getSourceManager().isInMainFile(varDecl->getLocation()))
+        return true;
+    if (compiler.getSourceManager().isMacroBodyExpansion(compat::getBeginLoc(varDecl)))
+        return true;
+    if (compiler.getSourceManager().isMacroArgExpansion(compat::getBeginLoc(varDecl)))
+        return true;
+    // ignore stuff that forms part of the stable URE interface
+    if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(varDecl->getLocation())))
+        return true;
+
+    definitionSet.insert(niceName(varDecl));
+    return true;
+}
+
+static char easytolower(char in)
+{
+    if (in <= 'Z' && in >= 'A')
+        return in - ('Z' - 'z');
+    return in;
+}
+
+bool startswith(const std::string& rStr, const char* pSubStr)
+{
+    return rStr.compare(0, strlen(pSubStr), pSubStr) == 0;
+}
+
+bool WriteOnlyVars::TraverseIfStmt(IfStmt* ifStmt)
+{
+    VarDecl const* varDecl = nullptr;
+    Expr const* cond = ifStmt->getCond()->IgnoreParenImpCasts();
+    if (auto declRefExpr = dyn_cast<DeclRefExpr>(cond))
+    {
+        if ((varDecl = dyn_cast<VarDecl>(declRefExpr->getDecl())))
+            insideConditionalCheckOfMemberSet.push_back(varDecl);
+    }
+    bool ret = RecursiveASTVisitor::TraverseIfStmt(ifStmt);
+    if (varDecl)
+        insideConditionalCheckOfMemberSet.pop_back();
+    return ret;
+}
+
+void WriteOnlyVars::checkIfReadFrom(const VarDecl* varDecl, const Expr* memberExpr)
+{
+    auto parentsRange = compiler.getASTContext().getParents(*memberExpr);
+    const Stmt* child = memberExpr;
+    const Stmt* parent
+        = parentsRange.begin() == parentsRange.end() ? nullptr : parentsRange.begin()->get<Stmt>();
+    // walk up the tree until we find something interesting
+    bool bPotentiallyReadFrom = false;
+    bool bDump = false;
+    auto walkupUp = [&]() {
+        child = parent;
+        auto parentsRange = compiler.getASTContext().getParents(*parent);
+        parent = parentsRange.begin() == parentsRange.end() ? nullptr
+                                                            : parentsRange.begin()->get<Stmt>();
+    };
+    do
+    {
+        if (!parent)
+        {
+            // check if we're inside a CXXCtorInitializer or a VarDecl
+            auto parentsRange = compiler.getASTContext().getParents(*child);
+            if (parentsRange.begin() != parentsRange.end())
+            {
+                const Decl* decl = parentsRange.begin()->get<Decl>();
+                if (decl && (isa<CXXConstructorDecl>(decl) || isa<VarDecl>(decl)))
+                    bPotentiallyReadFrom = true;
+            }
+            if (!bPotentiallyReadFrom)
+                return;
+            break;
+        }
+        if (isa<CXXReinterpretCastExpr>(parent))
+        {
+            // once we see one of these, there is not much useful we can know
+            bPotentiallyReadFrom = true;
+            break;
+        }
+        else if (isa<CastExpr>(parent) || isa<MemberExpr>(parent) || isa<ParenExpr>(parent)
+                 || isa<ParenListExpr>(parent) || isa<ArrayInitLoopExpr>(parent)
+                 || isa<ExprWithCleanups>(parent))
+        {
+            walkupUp();
+        }
+        else if (auto unaryOperator = dyn_cast<UnaryOperator>(parent))
+        {
+            UnaryOperator::Opcode op = unaryOperator->getOpcode();
+            if (memberExpr->getType()->isArrayType() && op == UO_Deref)
+            {
+                // ignore, deref'ing an array does not count as a read
+            }
+            else if (op == UO_AddrOf || op == UO_Deref || op == UO_Plus || op == UO_Minus
+                     || op == UO_Not || op == UO_LNot)
+            {
+                bPotentiallyReadFrom = true;
+                break;
+            }
+            /* The following are technically reads, but from a code-sense they're more of a write/modify, so
+                ignore them to find interesting fields that only modified, not usefully read:
+                UO_PreInc / UO_PostInc / UO_PreDec / UO_PostDec
+                But we still walk up in case the result of the expression is used in a read sense.
+            */
+            walkupUp();
+        }
+        else if (auto caseStmt = dyn_cast<CaseStmt>(parent))
+        {
+            bPotentiallyReadFrom = caseStmt->getLHS() == child || caseStmt->getRHS() == child;
+            break;
+        }
+        else if (auto ifStmt = dyn_cast<IfStmt>(parent))
+        {
+            bPotentiallyReadFrom = ifStmt->getCond() == child;
+            break;
+        }
+        else if (auto doStmt = dyn_cast<DoStmt>(parent))
+        {
+            bPotentiallyReadFrom = doStmt->getCond() == child;
+            break;
+        }
+        else if (auto arraySubscriptExpr = dyn_cast<ArraySubscriptExpr>(parent))
+        {
+            if (arraySubscriptExpr->getIdx() == child)
+            {
+                bPotentiallyReadFrom = true;
+                break;
+            }
+            walkupUp();
+        }
+        else if (auto callExpr = dyn_cast<CXXMemberCallExpr>(parent))
+        {
+            // check for calls to ReadXXX() type methods and the operator>>= methods on Any.
+            auto callee = getCallee(callExpr);
+            if (callee && *callExpr->child_begin() == child)
+            {
+                // FIXME perhaps a better solution here would be some kind of SAL_PARAM_WRITEONLY attribute
+                // which we could scatter around.
+                std::string name = callee->getNameAsString();
+                std::transform(name.begin(), name.end(), name.begin(), easytolower);
+                if (startswith(name, "read"))
+                    // this is a write-only call
+                    ;
+                else if (startswith(name, "emplace") || name == "insert" || name == "erase"
+                         || name == "remove" || name == "remove_if" || name == "sort"
+                         || name == "push_back" || name == "pop_back" || name == "push_front"
+                         || name == "pop_front" || name == "reserve" || name == "resize"
+                         || name == "clear" || name == "fill")
+                    // write-only modifications to collections
+                    ;
+                else if (name.find(">>=") != std::string::npos && callExpr->getArg(1) == child)
+                    // this is a write-only call
+                    ;
+                else if (name == "dispose" || name == "disposeAndClear" || name == "swap")
+                    // we're abusing the write-only analysis here to look for vars which don't have anything useful
+                    // being done to them, so we're ignoring things like std::vector::clear, std::vector::swap,
+                    // and VclPtr::disposeAndClear
+                    ;
+                else
+                    bPotentiallyReadFrom = true;
+            }
+            else
+                bPotentiallyReadFrom = true;
+            break;
+        }
+        else if (auto callExpr = dyn_cast<CallExpr>(parent))
+        {
+            // check for calls to ReadXXX() type methods and the operator>>= methods on Any.
+            auto callee = getCallee(callExpr);
+            if (callee)
+            {
+                // FIXME perhaps a better solution here would be some kind of SAL_PARAM_WRITEONLY attribute
+                // which we could scatter around.
+                std::string name = callee->getNameAsString();
+                std::transform(name.begin(), name.end(), name.begin(), easytolower);
+                if (startswith(name, "read"))
+                    // this is a write-only call
+                    ;
+                else if (name.find(">>=") != std::string::npos && callExpr->getArg(1) == child)
+                    // this is a write-only call
+                    ;
+                else
+                    bPotentiallyReadFrom = true;
+            }
+            else
+                bPotentiallyReadFrom = true;
+            break;
+        }
+        else if (auto binaryOp = dyn_cast<BinaryOperator>(parent))
+        {
+            BinaryOperator::Opcode op = binaryOp->getOpcode();
+            // If the child is on the LHS and it is an assignment op, we are obviously not reading from it
+            const bool assignmentOp = op == BO_Assign || op == BO_MulAssign || op == BO_DivAssign
+                                      || op == BO_RemAssign || op == BO_AddAssign
+                                      || op == BO_SubAssign || op == BO_ShlAssign
+                                      || op == BO_ShrAssign || op == BO_AndAssign
+                                      || op == BO_XorAssign || op == BO_OrAssign;
+            if (!(binaryOp->getLHS() == child && assignmentOp))
+            {
+                bPotentiallyReadFrom = true;
+            }
+            break;
+        }
+        else if (isa<ReturnStmt>(parent) || isa<CXXConstructExpr>(parent)
+                 || isa<ConditionalOperator>(parent) || isa<SwitchStmt>(parent)
+                 || isa<DeclStmt>(parent) || isa<WhileStmt>(parent) || isa<CXXNewExpr>(parent)
+                 || isa<ForStmt>(parent) || isa<InitListExpr>(parent)
+                 || isa<CXXDependentScopeMemberExpr>(parent) || isa<UnresolvedMemberExpr>(parent)
+                 || isa<MaterializeTemporaryExpr>(parent))
+        {
+            bPotentiallyReadFrom = true;
+            break;
+        }
+        else if (isa<CXXDeleteExpr>(parent) || isa<UnaryExprOrTypeTraitExpr>(parent)
+                 || isa<CXXUnresolvedConstructExpr>(parent) || isa<CompoundStmt>(parent)
+                 || isa<LabelStmt>(parent) || isa<CXXForRangeStmt>(parent)
+                 || isa<CXXTypeidExpr>(parent) || isa<DefaultStmt>(parent)
+                 || isa<GCCAsmStmt>(parent) || isa<VAArgExpr>(parent)
+#if CLANG_VERSION >= 80000
+                 || isa<ConstantExpr>(parent)
+#endif
+                 || isa<CXXDefaultArgExpr>(parent) || isa<LambdaExpr>(parent))
+        {
+            break;
+        }
+        else
+        {
+            bPotentiallyReadFrom = true;
+            bDump = true;
+            break;
+        }
+    } while (true);
+
+    if (bDump)
+    {
+        report(DiagnosticsEngine::Warning, "oh dear, what can the matter be?",
+               compat::getBeginLoc(memberExpr))
+            << memberExpr->getSourceRange();
+        report(DiagnosticsEngine::Note, "parent over here", compat::getBeginLoc(parent))
+            << parent->getSourceRange();
+        parent->dump();
+        memberExpr->dump();
+    }
+
+    MyVarInfo varInfo = niceName(varDecl);
+    if (bPotentiallyReadFrom)
+    {
+        readFromSet.insert(varInfo);
+    }
+}
+
+void WriteOnlyVars::checkIfWrittenTo(const VarDecl* varDecl, const Expr* memberExpr)
+{
+    // if we're inside a block that looks like
+    //   if (varDecl)
+    //       ....
+    // then writes to this var don't matter, because unless we find another write to this var, this var is dead
+    if (std::find(insideConditionalCheckOfMemberSet.begin(),
+                  insideConditionalCheckOfMemberSet.end(), varDecl)
+        != insideConditionalCheckOfMemberSet.end())
+        return;
+
+    auto parentsRange = compiler.getASTContext().getParents(*memberExpr);
+    const Stmt* child = memberExpr;
+    const Stmt* parent
+        = parentsRange.begin() == parentsRange.end() ? nullptr : parentsRange.begin()->get<Stmt>();
+    // walk up the tree until we find something interesting
+    bool bPotentiallyWrittenTo = false;
+    bool bDump = false;
+    auto walkupUp = [&]() {
+        child = parent;
+        auto parentsRange = compiler.getASTContext().getParents(*parent);
+        parent = parentsRange.begin() == parentsRange.end() ? nullptr
+                                                            : parentsRange.begin()->get<Stmt>();
+    };
+    do
+    {
+        if (!parent)
+        {
+            // check if we have an expression like
+            //    int& r = var;
+            auto parentsRange = compiler.getASTContext().getParents(*child);
+            if (parentsRange.begin() != parentsRange.end())
+            {
+                auto varDecl = dyn_cast_or_null<VarDecl>(parentsRange.begin()->get<Decl>());
+                // The isImplicit() call is to avoid triggering when we see the vardecl which is part of a for-range statement,
+                // which is of type 'T&&' and also an l-value-ref ?
+                if (varDecl && !varDecl->isImplicit()
+                    && loplugin::TypeCheck(varDecl->getType()).LvalueReference().NonConst())
+                {
+                    bPotentiallyWrittenTo = true;
+                }
+            }
+            break;
+        }
+        if (isa<CXXReinterpretCastExpr>(parent))
+        {
+            // once we see one of these, there is not much useful we can know
+            bPotentiallyWrittenTo = true;
+            break;
+        }
+        else if (isa<CastExpr>(parent) || isa<MemberExpr>(parent) || isa<ParenExpr>(parent)
+                 || isa<ParenListExpr>(parent) || isa<ArrayInitLoopExpr>(parent)
+                 || isa<ExprWithCleanups>(parent))
+        {
+            walkupUp();
+        }
+        else if (auto unaryOperator = dyn_cast<UnaryOperator>(parent))
+        {
+            UnaryOperator::Opcode op = unaryOperator->getOpcode();
+            if (op == UO_AddrOf || op == UO_PostInc || op == UO_PostDec || op == UO_PreInc
+                || op == UO_PreDec)
+            {
+                bPotentiallyWrittenTo = true;
+            }
+            break;
+        }
+        else if (auto arraySubscriptExpr = dyn_cast<ArraySubscriptExpr>(parent))
+        {
+            if (arraySubscriptExpr->getIdx() == child)
+                break;
+            walkupUp();
+        }
+        else if (auto operatorCallExpr = dyn_cast<CXXOperatorCallExpr>(parent))
+        {
+            auto callee = getCallee(operatorCallExpr);
+            if (callee)
+            {
+                // if calling a non-const operator on the var
+                auto calleeMethodDecl = callee->getAsCXXMethodDecl();
+                if (calleeMethodDecl && operatorCallExpr->getArg(0) == child)
+                {
+                    if (!calleeMethodDecl->isConst())
+                        bPotentiallyWrittenTo
+                            = checkForWriteWhenUsingCollectionType(calleeMethodDecl);
+                }
+                else if (IsPassedByNonConst(varDecl, child, operatorCallExpr, *callee))
+                {
+                    bPotentiallyWrittenTo = true;
+                }
+            }
+            else
+                bPotentiallyWrittenTo = true; // conservative, could improve
+            break;
+        }
+        else if (auto cxxMemberCallExpr = dyn_cast<CXXMemberCallExpr>(parent))
+        {
+            const CXXMethodDecl* calleeMethodDecl = cxxMemberCallExpr->getMethodDecl();
+            if (calleeMethodDecl)
+            {
+                // if calling a non-const method on the var
+                const Expr* tmp = dyn_cast<Expr>(child);
+                if (tmp->isBoundMemberFunction(compiler.getASTContext()))
+                {
+                    tmp = dyn_cast<MemberExpr>(tmp)->getBase();
+                }
+                if (cxxMemberCallExpr->getImplicitObjectArgument() == tmp)
+                {
+                    if (!calleeMethodDecl->isConst())
+                        bPotentiallyWrittenTo
+                            = checkForWriteWhenUsingCollectionType(calleeMethodDecl);
+                    break;
+                }
+                else if (IsPassedByNonConst(varDecl, child, cxxMemberCallExpr,
+                                            CalleeWrapper(calleeMethodDecl)))
+                    bPotentiallyWrittenTo = true;
+            }
+            else
+                bPotentiallyWrittenTo = true; // can happen in templates
+            break;
+        }
+        else if (auto cxxConstructExpr = dyn_cast<CXXConstructExpr>(parent))
+        {
+            if (IsPassedByNonConst(varDecl, child, cxxConstructExpr,
+                                   CalleeWrapper(cxxConstructExpr)))
+                bPotentiallyWrittenTo = true;
+            break;
+        }
+        else if (auto callExpr = dyn_cast<CallExpr>(parent))
+        {
+            auto callee = getCallee(callExpr);
+            if (callee)
+            {
+                if (IsPassedByNonConst(varDecl, child, callExpr, *callee))
+                    bPotentiallyWrittenTo = true;
+            }
+            else
+                bPotentiallyWrittenTo = true; // conservative, could improve
+            break;
+        }
+        else if (auto binaryOp = dyn_cast<BinaryOperator>(parent))
+        {
+            BinaryOperator::Opcode op = binaryOp->getOpcode();
+            const bool assignmentOp = op == BO_Assign || op == BO_MulAssign || op == BO_DivAssign
+                                      || op == BO_RemAssign || op == BO_AddAssign
+                                      || op == BO_SubAssign || op == BO_ShlAssign
+                                      || op == BO_ShrAssign || op == BO_AndAssign
+                                      || op == BO_XorAssign || op == BO_OrAssign;
+            if (assignmentOp)
+            {
+                if (binaryOp->getLHS() == child)
+                    bPotentiallyWrittenTo = true;
+                else if (loplugin::TypeCheck(binaryOp->getLHS()->getType())
+                             .LvalueReference()
+                             .NonConst())
+                    // if the LHS is a non-const reference, we could write to the var later on
+                    bPotentiallyWrittenTo = true;
+            }
+            break;
+        }
+        else if (isa<ReturnStmt>(parent))
+        {
+            if (insideFunctionDecl)
+            {
+                auto tc = loplugin::TypeCheck(insideFunctionDecl->getReturnType());
+                if (tc.LvalueReference().NonConst())
+                    bPotentiallyWrittenTo = true;
+            }
+            break;
+        }
+        else if (isa<ConditionalOperator>(parent) || isa<SwitchStmt>(parent)
+                 || isa<DeclStmt>(parent) || isa<WhileStmt>(parent) || isa<CXXNewExpr>(parent)
+                 || isa<ForStmt>(parent) || isa<InitListExpr>(parent)
+                 || isa<CXXDependentScopeMemberExpr>(parent) || isa<UnresolvedMemberExpr>(parent)
+                 || isa<MaterializeTemporaryExpr>(parent) || isa<IfStmt>(parent)
+                 || isa<DoStmt>(parent) || isa<CXXDeleteExpr>(parent)
+                 || isa<UnaryExprOrTypeTraitExpr>(parent) || isa<CXXUnresolvedConstructExpr>(parent)
+                 || isa<CompoundStmt>(parent) || isa<LabelStmt>(parent)
+                 || isa<CXXForRangeStmt>(parent) || isa<CXXTypeidExpr>(parent)
+                 || isa<DefaultStmt>(parent)
+#if CLANG_VERSION >= 80000
+                 || isa<ConstantExpr>(parent)
+#endif
+                 || isa<GCCAsmStmt>(parent) || isa<VAArgExpr>(parent)
+                 || isa<CXXDefaultArgExpr>(parent) || isa<LambdaExpr>(parent))
+        {
+            break;
+        }
+        else
+        {
+            bPotentiallyWrittenTo = true;
+            bDump = true;
+            break;
+        }
+    } while (true);
+
+    if (bDump)
+    {
+        report(DiagnosticsEngine::Warning, "oh dear2, what can the matter be? writtenTo=%0",
+               compat::getBeginLoc(memberExpr))
+            << bPotentiallyWrittenTo << memberExpr->getSourceRange();
+        if (parent)
+        {
+            report(DiagnosticsEngine::Note, "parent over here", compat::getBeginLoc(parent))
+                << parent->getSourceRange();
+            parent->dump();
+        }
+        memberExpr->dump();
+        varDecl->getType()->dump();
+    }
+
+    MyVarInfo varInfo = niceName(varDecl);
+    if (bPotentiallyWrittenTo)
+    {
+        writeToSet.insert(varInfo);
+    }
+}
+
+// return true if this not a collection type, or if it is a collection type, and we might be writing to it
+bool WriteOnlyVars::checkForWriteWhenUsingCollectionType(const CXXMethodDecl* calleeMethodDecl)
+{
+    auto const tc = loplugin::TypeCheck(calleeMethodDecl->getParent());
+    bool listLike = false, setLike = false, mapLike = false, cssSequence = false;
+    if (tc.Class("deque").StdNamespace() || tc.Class("list").StdNamespace()
+        || tc.Class("queue").StdNamespace() || tc.Class("vector").StdNamespace())
+    {
+        listLike = true;
+    }
+    else if (tc.Class("set").StdNamespace() || tc.Class("unordered_set").StdNamespace())
+    {
+        setLike = true;
+    }
+    else if (tc.Class("map").StdNamespace() || tc.Class("unordered_map").StdNamespace())
+    {
+        mapLike = true;
+    }
+    else if (tc.Class("Sequence")
+                 .Namespace("uno")
+                 .Namespace("star")
+                 .Namespace("sun")
+                 .Namespace("com")
+                 .GlobalNamespace())
+    {
+        cssSequence = true;
+    }
+    else
+        return true;
+
+    if (calleeMethodDecl->isOverloadedOperator())
+    {
+        auto oo = calleeMethodDecl->getOverloadedOperator();
+        if (oo == OO_Equal)
+            return true;
+        // This is operator[]. We only care about things that add elements to the collection.
+        // if nothing modifies the size of the collection, then nothing useful
+        // is stored in it.
+        if (listLike)
+            return false;
+        return true;
+    }
+
+    auto name = calleeMethodDecl->getName();
+    if (listLike || setLike || mapLike)
+    {
+        if (name == "reserve" || name == "shrink_to_fit" || name == "clear" || name == "erase"
+            || name == "pop_back" || name == "pop_front" || name == "front" || name == "back"
+            || name == "data" || name == "remove" || name == "remove_if" || name == "unique"
+            || name == "sort" || name == "begin" || name == "end" || name == "rbegin"
+            || name == "rend" || name == "at" || name == "find" || name == "equal_range"
+            || name == "lower_bound" || name == "upper_bound")
+            return false;
+    }
+    if (cssSequence)
+    {
+        if (name == "getArray" || name == "begin" || name == "end")
+            return false;
+    }
+
+    return true;
+}
+
+bool WriteOnlyVars::IsPassedByNonConst(const VarDecl* varDecl, const Stmt* child,
+                                       CallerWrapper callExpr, CalleeWrapper calleeFunctionDecl)
+{
+    unsigned len = std::min(callExpr.getNumArgs(), calleeFunctionDecl.getNumParams());
+    // if it's an array, passing it by value to a method typically means the
+    // callee takes a pointer and can modify the array
+    if (varDecl->getType()->isConstantArrayType())
+    {
+        for (unsigned i = 0; i < len; ++i)
+            if (callExpr.getArg(i) == child)
+                if (loplugin::TypeCheck(calleeFunctionDecl.getParamType(i)).Pointer().NonConst())
+                    return true;
+    }
+    else
+    {
+        for (unsigned i = 0; i < len; ++i)
+            if (callExpr.getArg(i) == child)
+                if (loplugin::TypeCheck(calleeFunctionDecl.getParamType(i))
+                        .LvalueReference()
+                        .NonConst())
+                    return true;
+    }
+    return false;
+}
+
+bool WriteOnlyVars::VisitDeclRefExpr(const DeclRefExpr* declRefExpr)
+{
+    const Decl* decl = declRefExpr->getDecl();
+    const VarDecl* varDecl = dyn_cast<VarDecl>(decl);
+    if (!varDecl)
+        return true;
+    if (varDecl->isImplicit() || isa<ParmVarDecl>(varDecl))
+        return true;
+    varDecl = varDecl->getCanonicalDecl();
+    if (ignoreLocation(varDecl))
+        return true;
+    // ignore stuff that forms part of the stable URE interface
+    if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(varDecl->getLocation())))
+        return true;
+
+    checkIfReadFrom(varDecl, declRefExpr);
+
+    checkIfWrittenTo(varDecl, declRefExpr);
+
+    return true;
+}
+
+llvm::Optional<CalleeWrapper> WriteOnlyVars::getCallee(CallExpr const* callExpr)
+{
+    FunctionDecl const* functionDecl = callExpr->getDirectCallee();
+    if (functionDecl)
+        return CalleeWrapper(functionDecl);
+
+    // Extract the functionprototype from a type
+    clang::Type const* calleeType = callExpr->getCallee()->getType().getTypePtr();
+    if (auto pointerType = calleeType->getUnqualifiedDesugaredType()->getAs<clang::PointerType>())
+    {
+        if (auto prototype = pointerType->getPointeeType()
+                                 ->getUnqualifiedDesugaredType()
+                                 ->getAs<FunctionProtoType>())
+        {
+            return CalleeWrapper(prototype);
+        }
+    }
+
+    return llvm::Optional<CalleeWrapper>();
+}
+
+loplugin::Plugin::Registration<WriteOnlyVars> X("writeonlyvars", false);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 767f4d99ac99..e84494bb8f3d 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -2332,11 +2332,10 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn)
 {
     OUString sTempName = createTempFile();
 
-    ODbaseTable* pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection));
-    Reference< XPropertySet > xHold = pNewTable;
-    pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName));
+    rtl::Reference<ODbaseTable> xNewTable(new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection)));
+    xNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName));
     {
-        Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY);
+        Reference<XAppend> xAppend(xNewTable->getColumns(),UNO_QUERY);
         bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers();
         // copy the structure
         for(sal_Int32 i=0;i < m_xColumns->getCount();++i)
@@ -2361,7 +2360,7 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn)
     }
 
     // construct the new table
-    if(!pNewTable->CreateImpl())
+    if(!xNewTable->CreateImpl())
     {
         const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
                 STR_COLUMN_NOT_ADDABLE,
@@ -2370,16 +2369,16 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn)
         ::dbtools::throwGenericSQLException( sError, *this );
     }
 
-    pNewTable->construct();
+    xNewTable->construct();
     // copy the data
-    copyData(pNewTable,pNewTable->m_xColumns->getCount());
+    copyData(xNewTable.get(),xNewTable->m_xColumns->getCount());
     // drop the old table
     if(DropImpl())
     {
-        pNewTable->renameImpl(m_Name);
+        xNewTable->renameImpl(m_Name);
         // release the temp file
     }
-    xHold.clear();
+    xNewTable.clear();
 
     FileClose();
     construct();
@@ -2391,11 +2390,10 @@ void ODbaseTable::dropColumn(sal_Int32 _nPos)
 {
     OUString sTempName = createTempFile();
 
-    ODbaseTable* pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection));
-    Reference< XPropertySet > xHold = pNewTable;
-    pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName));
+    rtl::Reference<ODbaseTable> xNewTable(new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection)));
+    xNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName));
     {
-        Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY);
+        Reference<XAppend> xAppend(xNewTable->getColumns(),UNO_QUERY);
         bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers();
         // copy the structure
         for(sal_Int32 i=0;i < m_xColumns->getCount();++i)
@@ -2419,24 +2417,23 @@ void ODbaseTable::dropColumn(sal_Int32 _nPos)
     }
 
     // construct the new table
-    if(!pNewTable->CreateImpl())
+    if(!xNewTable->CreateImpl())
     {
-        xHold.clear();
         const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
                 STR_COLUMN_NOT_DROP,
                 "$position$", OUString::number(_nPos)
              ) );
         ::dbtools::throwGenericSQLException( sError, *this );
     }
-    pNewTable->construct();
+    xNewTable->construct();
     // copy the data
-    copyData(pNewTable,_nPos);
+    copyData(xNewTable.get(),_nPos);
     // drop the old table
     if(DropImpl())
-        pNewTable->renameImpl(m_Name);
+        xNewTable->renameImpl(m_Name);
         // release the temp file
 
-    xHold.clear();
+    xNewTable.clear();
 
     FileClose();
     construct();
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index 82e682c5a01d..877f83830b9b 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -135,7 +135,6 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >&
         // the database may be stored as an
         // fdb file in older versions
         bool bIsFdbStored = false;
-        OUString aStorageURL;
         if (url == "sdbc:embedded:firebird")
         {
             m_bIsEmbedded = true;
@@ -149,10 +148,6 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >&
                 {
                     m_xEmbeddedStorage.set(pIter->Value,UNO_QUERY);
                 }
-                else if ( pIter->Name == "URL" )
-                {
-                    pIter->Value >>= aStorageURL;
-                }
                 else if ( pIter->Name == "Document" )
                 {
                     pIter->Value >>= m_xParentDocument;
diff --git a/connectivity/source/drivers/firebird/Table.cxx b/connectivity/source/drivers/firebird/Table.cxx
index 0381128357da..13bb595d5692 100644
--- a/connectivity/source/drivers/firebird/Table.cxx
+++ b/connectivity/source/drivers/firebird/Table.cxx
@@ -195,8 +195,7 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
 
     if (bDefaultChanged)
     {
-        OUString sOldDefault, sNewDefault;
-        xColumn->getPropertyValue("DefaultValue") >>= sOldDefault;
+        OUString sNewDefault;
         rDescriptor->getPropertyValue("DefaultValue") >>= sNewDefault;
 
         OUString sSql;
diff --git a/connectivity/source/drivers/mork/MorkParser.cxx b/connectivity/source/drivers/mork/MorkParser.cxx
index 989455c37593..676488cb209d 100644
--- a/connectivity/source/drivers/mork/MorkParser.cxx
+++ b/connectivity/source/drivers/mork/MorkParser.cxx
@@ -100,13 +100,10 @@ bool MorkParser::parse()
     // Run over mork chars and parse each term
     char cur = nextChar();
 
-    int i = 0;
-
     while ( Result && cur )
     {
         if ( !isWhiteSpace( cur ) )
         {
-            i++;
             // Figure out what a term
             switch ( cur )
             {
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index eba5f9c7bd69..def0a72ea767 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -177,7 +177,7 @@ void SvxHyperlinkNewDocTp::FillDocumentList ()
     {
         uno::Sequence< beans::PropertyValue >& rDynamicMenuEntry = aDynamicMenuEntries[ i ];
 
-        OUString aDocumentUrl, aTitle, aImageId, aTargetName;
+        OUString aDocumentUrl, aTitle;
 
         for ( int e = 0; e < rDynamicMenuEntry.getLength(); e++ )
         {
@@ -185,10 +185,6 @@ void SvxHyperlinkNewDocTp::FillDocumentList ()
                 rDynamicMenuEntry[ e ].Value >>= aDocumentUrl;
             else if ( rDynamicMenuEntry[e].Name == DYNAMICMENU_PROPERTYNAME_TITLE )
                 rDynamicMenuEntry[e].Value >>= aTitle;
-            else if ( rDynamicMenuEntry[e].Name == DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER )
-                rDynamicMenuEntry[e].Value >>= aImageId;
-            else if ( rDynamicMenuEntry[e].Name == DYNAMICMENU_PROPERTYNAME_TARGETNAME )
-                rDynamicMenuEntry[e].Value >>= aTargetName;
         }
         //#i96822# business cards, labels and database should not be inserted here
         if( aDocumentUrl == "private:factory/swriter?slot=21051" ||
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 0555cc339caf..c1383ea4e16b 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -1840,16 +1840,13 @@ VectorOfNodes OfaTreeOptionsDialog::LoadNodes(
 
         if ( xNodeAccess.is() )
         {
-            OUString sNodeId, sLabel, sPageURL, sGroupId;
+            OUString sNodeId, sLabel, sPageURL;
             bool bAllModules = false;
-            sal_Int32 nGroupIndex = 0;
 
             sNodeId = seqNames[i];
             xNodeAccess->getByName( "Label" ) >>= sLabel;
             xNodeAccess->getByName( "OptionsPage" ) >>= sPageURL;
             xNodeAccess->getByName( "AllModules" ) >>= bAllModules;
-            xNodeAccess->getByName( "GroupId" ) >>= sGroupId;
-            xNodeAccess->getByName( "GroupIndex" ) >>= nGroupIndex;
 
             if ( sLabel.isEmpty() )
                 sLabel = sGroupName;
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx
index 1915b6815b91..53363f09d6fd 100644
--- a/dbaccess/source/filter/xml/xmlExport.cxx
+++ b/dbaccess/source/filter/xml/xmlExport.cxx
@@ -398,8 +398,6 @@ void ODBExport::exportDataSource()
                 // special handlings
                 if ( pProperties->Name == PROPERTY_BOOLEANCOMPARISONMODE )
                 {
-                    sal_Int32 nValue = 0;
-                    aValue >>= nValue;
                     if ( sValue == "0" )
                         sValue = "equal-integer";
                     else if ( sValue == "1" )
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx
index 2be6e6d7be65..a0fabc0d02d8 100644
--- a/dbaccess/source/filter/xml/xmlfilter.cxx
+++ b/dbaccess/source/filter/xml/xmlfilter.cxx
@@ -159,7 +159,6 @@ static ErrCode ReadThroughComponent(
 
         try
         {
-            bool bEncrypted = false;
             // open stream (and set parser input)
             OUString sStreamName = OUString::createFromAscii(pStreamName);
             if ( !xStorage->hasByName( sStreamName ) || !xStorage->isStreamElement( sStreamName ) )
@@ -179,10 +178,6 @@ static ErrCode ReadThroughComponent(
 
             // get input stream
             xDocStream = xStorage->openStreamElement( sStreamName, embed::ElementModes::READ );
-
-            uno::Reference< beans::XPropertySet > xProps( xDocStream, uno::UNO_QUERY_THROW );
-            uno::Any aAny = xProps->getPropertyValue("Encrypted");
-            aAny >>= bEncrypted;
         }
         catch (const packages::WrongPasswordException&)
         {
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index e4528d487620..d366b3a4618f 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -2963,8 +2963,6 @@ void SbaTableQueryBrowser::unloadAndCleanup( bool _bDisposeConnection )
     {
         // get the active connection. We need to dispose it.
         Reference< XPropertySet > xRowSetProps(getRowSet(),UNO_QUERY);
-        Reference< XConnection > xConn;
-        xRowSetProps->getPropertyValue(PROPERTY_ACTIVE_CONNECTION) >>= xConn;
 #if OSL_DEBUG_LEVEL > 0
         {
             Reference< XComponent > xComp(
diff --git a/dbaccess/source/ui/misc/RowSetDrop.cxx b/dbaccess/source/ui/misc/RowSetDrop.cxx
index 12964ce0d786..8b596b137839 100644
--- a/dbaccess/source/ui/misc/RowSetDrop.cxx
+++ b/dbaccess/source/ui/misc/RowSetDrop.cxx
@@ -121,8 +121,6 @@ bool ORowSetImportExport::Read()
     {
         Reference<XPropertySet> xProp(m_xResultSet,UNO_QUERY);
         sal_Int32 nRowCount = 0;
-        sal_Int32 nCurrentRow = 0;
-        sal_Int32 nRowFilterIndex = 0;
         if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_ISROWCOUNTFINAL) )
         {
             bool bFinal = false;
@@ -141,8 +139,6 @@ bool ORowSetImportExport::Read()
         while(m_xResultSet.is() && m_xResultSet->next() && bContinue && nRowCount )
         {
             --nRowCount;
-            ++nCurrentRow;
-            ++nRowFilterIndex;
             bContinue = insertNewRow();
         }
     }
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index 029856bb066e..28a316ac7621 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -815,7 +815,6 @@ void OHTMLImportExport::WriteTables()
 
         // 2. and now the data
         Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
-        sal_Int32 j=1;
         sal_Int32 kk=0;
         m_xResultSet->beforeFirst(); // set back before the first row
         while(m_xResultSet->next())
@@ -846,7 +845,6 @@ void OHTMLImportExport::WriteTables()
                 }
                 WriteCell(pFormat[i-1],pColWidth[i-1],nHeight,pHorJustify[i-1],aValue,OOO_STRING_SVTOOLS_HTML_tabledata);
             }
-            ++j;
             TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
         }
     }
diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
index 226cf4bb9c19..e07197ff734a 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
@@ -311,8 +311,6 @@ bool ORelationTableConnectionData::Update()
         OSL_ENSURE(xKey.is(),"Key is not valid!");
         if ( xKey.is() )
         {
-            sal_Int32 nType = 0;
-            xKey->getPropertyValue(PROPERTY_TYPE) >>= nType;
             OUString sReferencedTable;
             xKey->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= sReferencedTable;
             if ( sReferencedTable == getReferencedTable()->GetTableName() )
diff --git a/filter/source/flash/swffilter.cxx b/filter/source/flash/swffilter.cxx
index 77ba50328163..4448def2d09e 100644
--- a/filter/source/flash/swffilter.cxx
+++ b/filter/source/flash/swffilter.cxx
@@ -354,8 +354,7 @@ void FlashExportFilter::ExportAsMultipleFiles(const Sequence< PropertyValue >& a
 
     swfdirpath = sPath + "/" + sPresentationName + ".sxi-swf-files";
 
-    oslFileError err;
-    err = osl_createDirectory( swfdirpath.pData );
+    osl_createDirectory( swfdirpath.pData );
 
     fullpath = swfdirpath + "/backgroundconfig.txt";
 
@@ -370,11 +369,10 @@ void FlashExportFilter::ExportAsMultipleFiles(const Sequence< PropertyValue >& a
         osl_openFile( fullpath.pData, &aBackgroundConfig, osl_File_OpenFlag_Create | osl_File_OpenFlag_Write );
 
         sal_uInt64 bytesWritten;
-        err = osl_writeFile(aBackgroundConfig, "slides=", strlen("slides="), &bytesWritten);
+        osl_writeFile(aBackgroundConfig, "slides=", strlen("slides="), &bytesWritten);
     }
 
     // TODO: check for errors
-    (void) err;
 
     FlashExporter aFlashExporter(
         mxContext,
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
index 1f70f450bda2..d4335024c26d 100644
--- a/filter/source/graphicfilter/idxf/dxf2mtf.cxx
+++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
@@ -681,7 +681,6 @@ void DXF2GDIMetaFile::DrawEntities(const DXFEntities & rEntities,
         return;
     rEntities.mbBeingDrawn = true;
 
-    sal_uLong nCount=0;
     DXFTransform aET;
     const DXFTransform * pT;
 
@@ -744,7 +743,6 @@ void DXF2GDIMetaFile::DrawEntities(const DXFEntities & rEntities,
             }
         }
         pE=pE->pSucc;
-        nCount++;
     }
 
     rEntities.mbBeingDrawn = false;
diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx b/filter/source/odfflatxml/OdfFlatXml.cxx
index 5e9b78e3516b..db483ffef04b 100644
--- a/filter/source/odfflatxml/OdfFlatXml.cxx
+++ b/filter/source/odfflatxml/OdfFlatXml.cxx
@@ -170,7 +170,6 @@ OdfFlatXml::exporter(const Sequence< PropertyValue >& sourceData,
                      const Sequence< OUString >& /*msUserData*/)
 {
     OUString paramName;
-    OUString targetURL;
     Reference<XOutputStream> outputStream;
 
     // Read output stream and target URL from the parameters given in sourceData.
@@ -180,8 +179,6 @@ OdfFlatXml::exporter(const Sequence< PropertyValue >& sourceData,
             paramName = sourceData[paramIdx].Name;
             if ( paramName == "OutputStream" )
                 sourceData[paramIdx].Value >>= outputStream;
-            else if ( paramName == "URL" )
-                sourceData[paramIdx].Value >>= targetURL;
         }
 
     if (!getDelegate().is())
diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx
index a82b6db15f54..3e5164e7af4d 100644
--- a/filter/source/xsltfilter/XSLTFilter.cxx
+++ b/filter/source/xsltfilter/XSLTFilter.cxx
@@ -283,7 +283,7 @@ namespace XSLT
         // is most important here since we need to supply it to
         // the sax parser that drives the supplied document handler
         sal_Int32 nLength = aSourceData.getLength();
-        OUString aName, aFileName, aURL;
+        OUString aName, aURL;
         css::uno::Reference<XInputStream> xInputStream;
         css::uno::Reference<XInteractionHandler> xInterActionHandler;
         for (sal_Int32 i = 0; i < nLength; i++)
@@ -292,8 +292,6 @@ namespace XSLT
                 Any value = aSourceData[i].Value;
                 if ( aName == "InputStream" )
                     value >>= xInputStream;
-                else if ( aName == "FileName" )
-                    value >>= aFileName;
                 else if ( aName == "URL" )
                     value >>= aURL;
                 else if ( aName == "InteractionHandler" )
@@ -430,18 +428,15 @@ namespace XSLT
         // since that is where our xml-writer will push the data
         // from its data-source interface
         OUString aName, sURL;
-        bool bIndent = false;
         OUString aDoctypePublic;
         // css::uno::Reference<XOutputStream> rOutputStream;
         sal_Int32 nLength = aSourceData.getLength();
         for (sal_Int32 i = 0; i < nLength; i++)
             {
                 aName = aSourceData[i].Name;
-                if ( aName == "Indent" )
-                    aSourceData[i].Value >>= bIndent;
                 if ( aName == "DocType_Public" )
                     aSourceData[i].Value >>= aDoctypePublic;
-                if ( aName == "OutputStream" )
+                else if ( aName == "OutputStream" )
                     aSourceData[i].Value >>= m_rOutputStream;
                 else if ( aName == "URL" )
                     aSourceData[i].Value >>= sURL;
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 749562d29245..ae58c71deb72 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -2662,11 +2662,6 @@ IMPL_LINK_NOARG(LayoutManager, AsyncLayoutHdl, Timer *, void)
     if( !m_xContainerWindow.is() )
         return;
 
-    awt::Rectangle aDockingArea( m_aDockingArea );
-    ::Size         aStatusBarSize( implts_getStatusBarSize() );
-
-    // Subtract status bar height
-    aDockingArea.Height -= aStatusBarSize.Height();
     aReadLock.clear();
 
     implts_setDockingAreaWindowSizes();
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 530977a590f1..2638f9a8c022 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1415,7 +1415,6 @@ void MenuBarManager::FillMenu(
         Sequence< PropertyValue > aProp;
         OUString aCommandURL;
         OUString aLabel;
-        OUString aHelpURL;
         OUString aModuleIdentifier( rModuleIdentifier );
         sal_uInt16 nType = 0;
         Reference< XIndexAccess > xIndexContainer;
@@ -1433,8 +1432,6 @@ void MenuBarManager::FillMenu(
                     OUString aPropName = aProp[i].Name;
                     if ( aPropName == "CommandURL" )
                         aProp[i].Value >>= aCommandURL;
-                    else if ( aPropName == "HelpURL" )
-                        aProp[i].Value >>= aHelpURL;
                     else if ( aPropName == "ItemDescriptorContainer" )
                         aProp[i].Value >>= xIndexContainer;
                     else if ( aPropName == "Label" )
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index 0ab6b555ad9f..219f54cc2016 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -413,7 +413,6 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc
     {
         uno::Sequence< beans::PropertyValue >   aProp;
         OUString                                aCommandURL;
-        OUString                                aHelpURL;
         sal_Int16                               nOffset( 0 );
         sal_Int16                               nStyle( 0 );
         sal_Int16                               nWidth( 0 );
@@ -429,10 +428,6 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc
                     {
                         aProp[i].Value >>= aCommandURL;
                     }
-                    else if ( aProp[i].Name == "HelpURL" )
-                    {
-                        aProp[i].Value >>= aHelpURL;
-                    }
                     else if ( aProp[i].Name == "Style" )
                     {
                         aProp[i].Value >>= nStyle;
diff --git a/framework/source/uielement/toolbarmerger.cxx b/framework/source/uielement/toolbarmerger.cxx
index 75cce49b15a2..83416bc5daea 100644
--- a/framework/source/uielement/toolbarmerger.cxx
+++ b/framework/source/uielement/toolbarmerger.cxx
@@ -435,7 +435,6 @@ void ToolBarMerger::MergeItems(
 {
     const sal_Int32 nSize( rAddonToolbarItems.size() );
 
-    sal_uInt16 nIndex( 0 );
     for ( sal_Int32 i = 0; i < nSize; i++ )
     {
         const AddonToolbarItem& rItem = rAddonToolbarItems[i];
@@ -469,7 +468,6 @@ void ToolBarMerger::MergeItems(
                 ToolBarMerger::CreateToolbarItem( pToolbar, nInsPos, rItemId, rItem );
             }
 
-            ++nIndex;
             ++rItemId;
         }
     }
diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx
index 547a035b088e..02e41f47fcb3 100644
--- a/framework/source/uielement/uicommanddescription.cxx
+++ b/framework/source/uielement/uicommanddescription.cxx
@@ -182,8 +182,6 @@ ConfigurationAccess_UICommand::~ConfigurationAccess_UICommand()
 // XNameAccess
 Any ConfigurationAccess_UICommand::getByNameImpl( const OUString& rCommandURL )
 {
-    static sal_Int32 nRequests  = 0;
-
     osl::MutexGuard g(m_aMutex);
     if ( !m_bConfigAccessInitialized )
     {
@@ -210,7 +208,6 @@ Any ConfigurationAccess_UICommand::getByNameImpl( const OUString& rCommandURL )
     else
     {
         // SAFE
-        ++nRequests;
         return getInfoFromCommand( rCommandURL );
     }
 }
diff --git a/l10ntools/source/idxdict/idxdict.cxx b/l10ntools/source/idxdict/idxdict.cxx
index 38955a5b8258..0a4a6ddb0216 100644
--- a/l10ntools/source/idxdict/idxdict.cxx
+++ b/l10ntools/source/idxdict/idxdict.cxx
@@ -34,7 +34,6 @@ int main(int argc, char *argv[])
         multimap<string, size_t> entries;
         multimap<string,size_t>::iterator ret(entries.begin());
 
-        int line(1);
         cin.getline(inputBuffer, MAXLINE);
         const string encoding(inputBuffer);
         size_t currentOffset(encoding.size()+1);
@@ -70,7 +69,6 @@ int main(int argc, char *argv[])
                 {
                         cin.getline(inputBuffer, MAXLINE);
                         currentOffset += strlen(inputBuffer)+1;
-                        ++line;
                 }
         }
 
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index e16944af5b06..856aef4b3f9e 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -675,9 +675,7 @@ static void lcl_AnalyzeHandles( const uno::Sequence<beans::PropertyValues> & rHa
     sal_uInt16 nHandles = rHandles.getLength();
     for ( k = 0; k < nHandles ; k++ )
     {
-        const OUString sSwitched( "Switched"  );
         const OUString sPosition( "Position"  );
-        bool bSwitched = false;
         bool bPosition = false;
         EnhancedCustomShapeParameterPair aPosition;
         EnhancedCustomShapeParameterPair aPolar;
@@ -689,10 +687,6 @@ static void lcl_AnalyzeHandles( const uno::Sequence<beans::PropertyValues> & rHa
                 if ( rPropVal.Value >>= aPosition )
                     bPosition = true;
             }
-            else if ( rPropVal.Name == sSwitched )
-            {
-                rPropVal.Value >>= bSwitched ;
-            }
         }
         if ( bPosition )
         {
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index 077a0cdee96b..c1d1699d8835 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -2054,10 +2054,6 @@ uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstance( co
     {
         uno::Reference< style::XStyle> xStyle = new OStyle();
         xStyle->setName("Default");
-        uno::Reference<beans::XPropertySet> xProp(xStyle,uno::UNO_QUERY);
-        OUString sTray;
-        xProp->getPropertyValue("PrinterPaperTray")>>= sTray;
-
         return xStyle.get();
     }
     else if ( aServiceSpecifier == "com.sun.star.document.Settings" )
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index a97dbc389a90..d2395cdbb0fb 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1241,7 +1241,6 @@ void ScDocument::GetCellChangeTrackNote( const ScAddress &aCellPos, OUString &aT
         const ScChangeAction* pFound = nullptr;
         const ScChangeAction* pFoundContent = nullptr;
         const ScChangeAction* pFoundMove = nullptr;
-        long nModified = 0;
         const ScChangeAction* pAction = pTrack->GetFirst();
         while (pAction)
         {
@@ -1271,7 +1270,6 @@ void ScDocument::GetCellChangeTrackNote( const ScAddress &aCellPos, OUString &aT
                             default:
                                 break;
                         }
-                        ++nModified;
                     }
                 }
                 if ( eType == SC_CAT_MOVE )
@@ -1282,7 +1280,6 @@ void ScDocument::GetCellChangeTrackNote( const ScAddress &aCellPos, OUString &aT
                     if ( aRange.In( aCellPos ) )
                     {
                         pFound = pAction;
-                        ++nModified;
                     }
                 }
             }
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 0b5e07497a27..eb2d1d9c4857 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -3133,9 +3133,7 @@ SCSIZE ScTable::Query(const ScQueryParam& rParamOrg, bool bKeepSub)
                     aStr = aBuf.makeStringAndClear();
                 }
 
-                std::pair<StrSetType::iterator, bool> r = aStrSet.insert(aStr);
-                bool bIsUnique = r.second; // unique if inserted.
-                bResult = bIsUnique;
+                bResult = aStrSet.insert(aStr).second; // unique if inserted.
             }
         }
         else
diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
index b8e8eb73ce7d..c72ab042b4cf 100644
--- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx
+++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
@@ -197,13 +197,8 @@ uno::Reference<chart2::data::XDataSource> SAL_CALL
     if (!m_pDocument)
         throw uno::RuntimeException();
 
-    bool bLabel = true;
-    bool bCategories = false;
     bool bOrientCol = true;
     OUString aRangeRepresentation;
-    OUString sPivotTable;
-    uno::Sequence<sal_Int32> aSequenceMapping;
-    bool bTimeBased = false;
 
     for (beans::PropertyValue const & rProperty : aArguments)
     {
@@ -218,18 +213,8 @@ uno::Reference<chart2::data::XDataSource> SAL_CALL
             }
             bOrientCol = (eSource == chart::ChartDataRowSource_COLUMNS);
         }
-        else if (rProperty.Name == "FirstCellAsLabel")
-            rProperty.Value >>= bLabel;
-        else if (rProperty.Name == "HasCategories")
-            rProperty.Value >>= bCategories;
         else if (rProperty.Name == "CellRangeRepresentation")
             rProperty.Value >>= aRangeRepresentation;
-        else if (rProperty.Name == "SequenceMapping")
-            rProperty.Value >>= aSequenceMapping;
-        else if (rProperty.Name == "TimeBased")
-            rProperty.Value >>= bTimeBased;
-        else if (rProperty.Name == "ConnectedPivotTable")
-            rProperty.Value >>= sPivotTable;
     }
 
     uno::Reference<chart2::data::XDataSource> xResult;
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index 6793bf70bc66..57dfaddeccda 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -368,8 +368,6 @@ ScVbaWorkbook::SaveAs( const uno::Any& FileName, const uno::Any& FileFormat, con
     setFilterPropsFromFormat( nFileFormat, storeProps );
 
     uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW );
-    OUString sFilterName;
-    storeProps[0].Value >>= sFilterName;
     xStor->storeAsURL( sURL, storeProps );
 }
 
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 40f3bd722019..cf19422208d6 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -75,7 +75,6 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard )
         const ScChangeAction* pFound = nullptr;
         const ScChangeAction* pFoundContent = nullptr;
         const ScChangeAction* pFoundMove = nullptr;
-        long nModified = 0;
         const ScChangeAction* pAction = pTrack->GetFirst();
         while (pAction)
         {
@@ -109,7 +108,6 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard )
                                 // added to avoid warnings
                             }
                         }
-                        ++nModified;
                     }
                 }
                 if ( eType == SC_CAT_MOVE )
@@ -120,7 +118,6 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard )
                     if ( aRange.In( aCellPos ) )
                     {
                         pFound = pAction;
-                        ++nModified;
                     }
                 }
             }
diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx
index cd174d88ec3c..1f99c6f5d879 100644
--- a/scripting/source/dlgprov/dlgevtatt.cxx
+++ b/scripting/source/dlgprov/dlgevtatt.cxx
@@ -218,8 +218,6 @@ namespace dlgprov
 
             Reference< XControlModel > xControlModel = xControl->getModel();
             Reference< XPropertySet > xProps( xControlModel, uno::UNO_QUERY );
-            OUString sName;
-            xProps->getPropertyValue("Name") >>= sName;
             if ( xEventCont.is() )
             {
                 Sequence< OUString > aNames = xEventCont->getElementNames();
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index 54b4b47ceb5f..376074686ac6 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -364,8 +364,6 @@ uno::Sequence<beans::PropertyValue>
                 else
                 {
                     // Such specific path construction is grim.
-                    OUString aValue;
-                    aRet[i].Value >>= aValue;
 
                     OUStringBuffer aName( getNameOfType( t ) );
                     OUString aResult;
diff --git a/sdext/source/presenter/PresenterSlidePreview.cxx b/sdext/source/presenter/PresenterSlidePreview.cxx
index d49d5b4b79f0..1c8d813fa9b5 100644
--- a/sdext/source/presenter/PresenterSlidePreview.cxx
+++ b/sdext/source/presenter/PresenterSlidePreview.cxx
@@ -203,21 +203,6 @@ void PresenterSlidePreview::SetSlide (const Reference<drawing::XDrawPage>& rxPag
     mxCurrentSlide = rxPage;
     mxPreview = nullptr;
 
-    Reference<beans::XPropertySet> xPropertySet (mxCurrentSlide, UNO_QUERY);
-    if (xPropertySet.is())
-    {
-        awt::Size aSlideSize;
-        try
-        {
-            xPropertySet->getPropertyValue("Width") >>= aSlideSize.Width;
-            xPropertySet->getPropertyValue("Height") >>= aSlideSize.Height;
-        }
-        catch (beans::UnknownPropertyException&)
-        {
-            OSL_ASSERT(false);
-        }
-    }
-
     // The preview is not transparent, therefore only this window, not its
     // parent, has to be invalidated.
     mpPresenterController->GetPaintManager()->Invalidate(mxWindow);
diff --git a/sdext/source/presenter/PresenterTextView.cxx b/sdext/source/presenter/PresenterTextView.cxx
index b99a482cda82..c95cab1f72f7 100644
--- a/sdext/source/presenter/PresenterTextView.cxx
+++ b/sdext/source/presenter/PresenterTextView.cxx
@@ -460,15 +460,6 @@ PresenterTextParagraph::PresenterTextParagraph (
     if (rxTextRange.is())
     {
         Reference<beans::XPropertySet> xProperties (rxTextRange, UNO_QUERY);
-        lang::Locale aLocale;
-        try
-        {
-            xProperties->getPropertyValue("CharLocale") >>= aLocale;
-        }
-        catch(beans::UnknownPropertyException&)
-        {
-            // Ignore the exception.  Use the default value.
-        }
         try
         {
             xProperties->getPropertyValue("WritingMode") >>= mnWritingMode;
diff --git a/sdext/source/presenter/PresenterToolBar.cxx b/sdext/source/presenter/PresenterToolBar.cxx
index c20ece60019d..945573bacffd 100644
--- a/sdext/source/presenter/PresenterToolBar.cxx
+++ b/sdext/source/presenter/PresenterToolBar.cxx
@@ -632,9 +632,6 @@ void PresenterToolBar::ProcessEntry (
     if ( ! (PresenterConfigurationAccess::GetProperty(rxProperties, "Type") >>= sType))
         return;
 
-    OUString sName;
-    PresenterConfigurationAccess::GetProperty(rxProperties, "Name") >>= sName;
-
     // Read mode specific values.
     SharedElementMode pNormalMode (new ElementMode());
     SharedElementMode pMouseOverMode (new ElementMode());
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index f3ad18b29c09..e506de0bc734 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -909,7 +909,6 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
     // (attention: some information aren't available on filter directly ... you must search for corresponding type too!)
     SfxFilterFlags       nFlags          = SfxFilterFlags::NONE;
     SotClipboardFormatId nClipboardId    = SotClipboardFormatId::NONE;
-    sal_Int32       nDocumentIconId = 0 ;
     sal_Int32       nFormatVersion  = 0 ;
     OUString sMimeType           ;
     OUString sType               ;
@@ -989,10 +988,6 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
                     {
                         lTypeProperties[nTypeProperty].Value >>= sHumanName;
                     }
-                    else if ( lTypeProperties[nTypeProperty].Name == "DocumentIconID" )
-                    {
-                        lTypeProperties[nTypeProperty].Value >>= nDocumentIconId;
-                    }
                     else if ( lTypeProperties[nTypeProperty].Name == "MediaType" )
                     {
                         lTypeProperties[nTypeProperty].Value >>= sMimeType;
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 434450dbce41..5bd7ad19ded8 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -205,18 +205,6 @@ void BackingWindow::initControls()
 
     // collect the URLs of the entries in the File/New menu
     SvtModuleOptions    aModuleOptions;
-    std::set< OUString > aFileNewAppsAvailable;
-    SvtDynamicMenuOptions aOpt;
-    Sequence < Sequence < PropertyValue > > aNewMenu = aOpt.GetMenu( EDynamicMenuType::NewMenu );
-    const OUString sURLKey( "URL"  );
-
-    for ( auto const & newMenuProp : aNewMenu )
-    {
-        comphelper::SequenceAsHashMap aEntryItems( newMenuProp );
-        OUString sURL( aEntryItems.getUnpackedValueOrDefault( sURLKey, OUString() ) );
-        if ( !sURL.isEmpty() )
-            aFileNewAppsAvailable.insert( sURL );
-    }
 
     if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::WRITER))
         mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_WRITER;
diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
index 8066f36fc532..43421fdd9bd7 100644
--- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx
+++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
@@ -299,7 +299,6 @@ void NotebookbarTabControl::FillShortcutsToolBox(Reference<XComponentContext> co
             if ( xIndex->getByIndex( i ) >>= aPropSequence )
             {
                 OUString aCommandURL;
-                OUString aLabel;
                 sal_uInt16 nType = ItemType::DEFAULT;
                 bool bVisible = true;
 
@@ -307,8 +306,6 @@ void NotebookbarTabControl::FillShortcutsToolBox(Reference<XComponentContext> co
                 {
                     if ( aProp.Name == "CommandURL" )
                         aProp.Value >>= aCommandURL;
-                    else if ( aProp.Name == "Label" )
-                        aProp.Value >>= aLabel;
                     else if ( aProp.Name == "Type" )
                         aProp.Value >>= nType;
                     else if ( aProp.Name == "IsVisible" )
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk
index a83cf703793f..97c541885c75 100644
--- a/solenv/CompilerTest_compilerplugins_clang.mk
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -73,6 +73,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
     compilerplugins/clang/test/unusedvariablemore \
     compilerplugins/clang/test/useuniqueptr \
     compilerplugins/clang/test/vclwidgets \
+    compilerplugins/clang/test/writeonlyvars \
 ))
 
 $(eval $(call gb_CompilerTest_use_externals,compilerplugins_clang, \
diff --git a/soltools/mkdepend/main.c b/soltools/mkdepend/main.c
index ee1cfb8efc7d..844edb390ad2 100644
--- a/soltools/mkdepend/main.c
+++ b/soltools/mkdepend/main.c
@@ -127,8 +127,6 @@ char    *includedirs[ MAXDIRS + 1 ];
 char    *objprefix = "";
 char    *objsuffix = OBJSUFFIX;
 static char    *startat = "# DO NOT DELETE";
-static int width = 78;
-static boolean append = FALSE;
 boolean printed = FALSE;
 boolean verbose = FALSE;
 boolean show_where_not = FALSE;
@@ -274,16 +272,13 @@ int main(int argc, char    **argv)
         /* do not use if endmarker processing */
         case 'a':
             if (endmarker) break;
-            append = TRUE;
             break;
         case 'w':
             if (endmarker) break;
             if (argv[0][2] == '\0') {
                 argv++;
                 argc--;
-                width = atoi(argv[0]);
-            } else
-                width = atoi(argv[0]+2);
+            }
             break;
         case 'n':
             // Use "-n" switch to generate dependencies with windows-native slash style
diff --git a/soltools/mkdepend/pr.c b/soltools/mkdepend/pr.c
index 731b2f16626e..2b0825221df6 100644
--- a/soltools/mkdepend/pr.c
+++ b/soltools/mkdepend/pr.c
@@ -109,7 +109,6 @@ size_t pr(struct inclist *ip, char *file, char *base)
 {
     size_t ret;
     static char *lastfile;
-    static int  current_len;
     int    len, i;
     char    buf[ BUFSIZ ];
 
@@ -119,7 +118,7 @@ size_t pr(struct inclist *ip, char *file, char *base)
         lastfile = file;

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list