[Libreoffice-commits] core.git: compilerplugins/clang framework/inc framework/source

Noel Grandin noel at peralex.com
Fri Nov 20 00:13:37 PST 2015


 compilerplugins/clang/unusedfields.cxx                     |  202 +++++++++++++
 compilerplugins/clang/unusedfields.py                      |   79 +++++
 compilerplugins/clang/unusedfieldsremove.cxx               |  136 ++++++++
 framework/inc/classes/filtercache.hxx                      |    1 
 framework/inc/classes/filtercachedata.hxx                  |   93 -----
 framework/inc/dispatch/closedispatcher.hxx                 |    1 
 framework/inc/dispatch/startmoduledispatcher.hxx           |    7 
 framework/inc/uielement/statusbarmanager.hxx               |    4 
 framework/inc/uielement/toolbarmanager.hxx                 |    7 
 framework/inc/uielement/uicommanddescription.hxx           |    1 
 framework/inc/xml/acceleratorconfigurationreader.hxx       |    3 
 framework/inc/xml/saxnamespacefilter.hxx                   |    1 
 framework/source/dispatch/closedispatcher.cxx              |    1 
 framework/source/dispatch/dispatchprovider.cxx             |    2 
 framework/source/dispatch/startmoduledispatcher.cxx        |    5 
 framework/source/fwe/xml/saxnamespacefilter.cxx            |    1 
 framework/source/services/autorecovery.cxx                 |    3 
 framework/source/services/substitutepathvars.cxx           |   39 +-
 framework/source/uiconfiguration/imagemanagerimpl.cxx      |    1 
 framework/source/uiconfiguration/imagemanagerimpl.hxx      |    1 
 framework/source/uiconfiguration/uicategorydescription.cxx |    6 
 framework/source/uielement/statusbarmanager.cxx            |    3 
 framework/source/uielement/statusbarwrapper.cxx            |    2 
 framework/source/uielement/toolbarmanager.cxx              |    4 
 framework/source/uielement/uicommanddescription.cxx        |    2 
 25 files changed, 441 insertions(+), 164 deletions(-)

New commits:
commit 1d5c39192e81f950289dbdd7991a0e8a67c0aabc
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Nov 20 10:12:32 2015 +0200

    new loplugin:unusedfields
    
    run it over the framework module
    
    Change-Id: I1220a4be0936ba30136ce22ffd78633c8a7b9d35

diff --git a/compilerplugins/clang/unusedfields.cxx b/compilerplugins/clang/unusedfields.cxx
new file mode 100644
index 0000000..95bce5e
--- /dev/null
+++ b/compilerplugins/clang/unusedfields.cxx
@@ -0,0 +1,202 @@
+/* -*- 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/.
+ */
+
+#include <cassert>
+#include <string>
+#include <iostream>
+#include <fstream>
+#include <set>
+#include "plugin.hxx"
+#include "compat.hxx"
+
+/**
+Dump a list of calls to methods, and a list of field definitions.
+Then we will post-process the 2 lists and find the set of unused methods.
+
+Be warned that it produces around 5G of log file.
+
+The process goes something like this:
+  $ make check
+  $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='unusedfields' check
+  $ ./compilerplugins/clang/unusedfields.py unusedfields.log > result.txt
+
+and then
+  $ for dir in *; do make FORCE_COMPILE_ALL=1 UPDATE_FILES=$dir COMPILER_PLUGIN_TOOL='unusedfieldsremove' $dir; done
+to auto-remove the method declarations
+
+Note that the actual process may involve a fair amount of undoing, hand editing, and general messing around
+to get it to work :-)
+
+*/
+
+namespace {
+
+struct MyFieldInfo
+{
+    std::string parentClass;
+    std::string fieldName;
+    std::string sourceLocation;
+
+    bool operator < (const MyFieldInfo &other) const
+    {
+        if (parentClass < other.parentClass)
+            return true;
+        else if (parentClass == other.parentClass)
+            return fieldName < other.fieldName;
+        else
+            return false;
+    }
+};
+
+
+// try to limit the voluminous output a little
+static std::set<MyFieldInfo> touchedSet;
+static std::set<MyFieldInfo> definitionSet;
+
+
+class UnusedFields:
+    public RecursiveASTVisitor<UnusedFields>, public loplugin::Plugin
+{
+public:
+    explicit UnusedFields(InstantiationData const & data): Plugin(data) {}
+
+    virtual void run() override
+    {
+        TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+
+        // dump all our output in one write call - this is to try and limit IO "crosstalk" between multiple processes
+        // writing to the same logfile
+        std::string output;
+        for (const MyFieldInfo & s : touchedSet)
+            output += "touch:\t" + s.parentClass + "\t" + s.fieldName + "\n";
+        for (const MyFieldInfo & s : definitionSet)
+        {
+            output += "definition:\t" + s.parentClass + "\t" + s.fieldName + "\t" + s.sourceLocation + "\n";
+        }
+        ofstream myfile;
+        myfile.open( SRCDIR "/unusedfields.log", ios::app | ios::out);
+        myfile << output;
+        myfile.close();
+    }
+
+    bool shouldVisitTemplateInstantiations () const { return true; }
+
+    bool VisitCallExpr(CallExpr* );
+    bool VisitFieldDecl( const FieldDecl* );
+    bool VisitMemberExpr( const MemberExpr* );
+    bool VisitDeclRefExpr( const DeclRefExpr* );
+private:
+    MyFieldInfo niceName(const FieldDecl*);
+    std::string fullyQualifiedName(const FunctionDecl*);
+};
+
+MyFieldInfo UnusedFields::niceName(const FieldDecl* fieldDecl)
+{
+    MyFieldInfo aInfo;
+    aInfo.parentClass = fieldDecl->getParent()->getQualifiedNameAsString();
+    aInfo.fieldName = fieldDecl->getNameAsString();
+
+    SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( fieldDecl->getLocation() );
+    StringRef name = compiler.getSourceManager().getFilename(expansionLoc);
+    aInfo.sourceLocation = std::string(name.substr(strlen(SRCDIR)+1)) + ":" + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
+
+    return aInfo;
+}
+
+std::string UnusedFields::fullyQualifiedName(const FunctionDecl* functionDecl)
+{
+    std::string ret = compat::getReturnType(*functionDecl).getCanonicalType().getAsString();
+    ret += " ";
+    if (isa<CXXMethodDecl>(functionDecl)) {
+        const CXXRecordDecl* recordDecl = dyn_cast<CXXMethodDecl>(functionDecl)->getParent();
+        ret += recordDecl->getQualifiedNameAsString();
+        ret += "::";
+    }
+    ret += functionDecl->getNameAsString() + "(";
+    bool bFirst = true;
+    for (const ParmVarDecl *pParmVarDecl : functionDecl->params()) {
+        if (bFirst)
+            bFirst = false;
+        else
+            ret += ",";
+        ret += pParmVarDecl->getType().getCanonicalType().getAsString();
+    }
+    ret += ")";
+    if (isa<CXXMethodDecl>(functionDecl) && dyn_cast<CXXMethodDecl>(functionDecl)->isConst()) {
+        ret += " const";
+    }
+
+    return ret;
+}
+
+// prevent recursive templates from blowing up the stack
+static std::set<std::string> traversedFunctionSet;
+
+bool UnusedFields::VisitCallExpr(CallExpr* expr)
+{
+    // Note that I don't ignore ANYTHING here, because I want to get calls to my code that result
+    // from template instantiation deep inside the STL and other external code
+
+    FunctionDecl* calleeFunctionDecl = expr->getDirectCallee();
+    if (calleeFunctionDecl == nullptr) {
+        Expr* callee = expr->getCallee()->IgnoreParenImpCasts();
+        DeclRefExpr* dr = dyn_cast<DeclRefExpr>(callee);
+        if (dr) {
+            calleeFunctionDecl = dyn_cast<FunctionDecl>(dr->getDecl());
+            if (calleeFunctionDecl)
+                goto gotfunc;
+        }
+        return true;
+    }
+
+gotfunc:
+    // if we see a call to a function, it may effectively create new code,
+    // if the function is templated. However, if we are inside a template function,
+    // calling another function on the same template, the same problem occurs.
+    // Rather than tracking all of that, just traverse anything we have not already traversed.
+    if (traversedFunctionSet.insert(fullyQualifiedName(calleeFunctionDecl)).second)
+        TraverseFunctionDecl(calleeFunctionDecl);
+
+    return true;
+}
+
+bool UnusedFields::VisitFieldDecl( const FieldDecl* fieldDecl )
+{
+    fieldDecl = fieldDecl->getCanonicalDecl();
+
+    if( !ignoreLocation( fieldDecl ))
+        definitionSet.insert(niceName(fieldDecl));
+    return true;
+}
+
+bool UnusedFields::VisitMemberExpr( const MemberExpr* memberExpr )
+{
+    const ValueDecl* decl = memberExpr->getMemberDecl();
+    if (!isa<FieldDecl>(decl)) {
+        return true;
+    }
+    touchedSet.insert(niceName(dyn_cast<FieldDecl>(decl)));
+    return true;
+}
+
+bool UnusedFields::VisitDeclRefExpr( const DeclRefExpr* declRefExpr )
+{
+    const Decl* decl = declRefExpr->getDecl();
+    if (!isa<FieldDecl>(decl)) {
+        return true;
+    }
+    touchedSet.insert(niceName(dyn_cast<FieldDecl>(decl)));
+    return true;
+}
+
+loplugin::Plugin::Registration< UnusedFields > X("unusedfields", false);
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/compilerplugins/clang/unusedfields.py b/compilerplugins/clang/unusedfields.py
new file mode 100755
index 0000000..bade9a8
--- /dev/null
+++ b/compilerplugins/clang/unusedfields.py
@@ -0,0 +1,79 @@
+#!/usr/bin/python
+
+import sys
+import re
+import io
+
+definitionSet = set()
+definitionToSourceLocationMap = dict()
+callSet = set()
+sourceLocationSet = set()
+# things we need to exclude for reasons like :
+# - it's a weird template thingy that confuses the plugin
+exclusionSet = set([
+    ])
+
+# clang does not always use exactly the same numbers in the type-parameter vars it generates
+# so I need to substitute them to ensure we can match correctly.
+normalizeTypeParamsRegex = re.compile(r"type-parameter-\d+-\d+")
+def normalizeTypeParams( line ):
+    return normalizeTypeParamsRegex.sub("type-parameter-?-?", line)
+
+# The parsing here is designed to avoid grabbing stuff which is mixed in from gbuild.
+# I have not yet found a way of suppressing the gbuild output.
+with io.open(sys.argv[1], "rb", buffering=1024*1024) as txt:
+    for line in txt:
+        if line.startswith("definition:\t"):
+            idx1 = line.find("\t",12)
+            idx2 = line.find("\t",idx1+1)
+            funcInfo = (normalizeTypeParams(line[12:idx1]), normalizeTypeParams(line[idx1+1:idx2]))
+            definitionSet.add(funcInfo)
+            definitionToSourceLocationMap[funcInfo] = line[idx2+1:].strip()
+        elif line.startswith("touch:\t"):
+            idx1 = line.find("\t",7)
+            callInfo = (normalizeTypeParams(line[7:idx1]), normalizeTypeParams(line[idx1+1:].strip()))
+            callSet.add(callInfo)
+
+# Invert the definitionToSourceLocationMap
+# If we see more than one method at the same sourceLocation, it's being autogenerated as part of a template
+# and we should just ignore
+sourceLocationToDefinitionMap = {}
+for k, v in definitionToSourceLocationMap.iteritems():
+    sourceLocationToDefinitionMap[v] = sourceLocationToDefinitionMap.get(v, [])
+    sourceLocationToDefinitionMap[v].append(k)
+for k, definitions in sourceLocationToDefinitionMap.iteritems():
+    if len(definitions) > 1:
+        for d in definitions:
+            definitionSet.remove(d)
+    
+tmp1set = set()
+for d in definitionSet:
+    clazz = d[0] + " " + d[1]
+    if clazz in exclusionSet:
+        continue
+    if d in callSet:
+        continue
+    if (definitionToSourceLocationMap[d].startswith("include/")):
+        continue
+
+    tmp1set.add((clazz, definitionToSourceLocationMap[d]))
+
+# sort the results using a "natural order" so sequences like [item1,item2,item10] sort nicely
+def natural_sort_key(s, _nsre=re.compile('([0-9]+)')):
+    return [int(text) if text.isdigit() else text.lower()
+            for text in re.split(_nsre, s)]
+
+# sort results by name and line number
+tmp1list = sorted(tmp1set, key=lambda v: natural_sort_key(v[1]))
+
+# print out the results
+for t in tmp1list:
+    print t[1]
+    print "    ", t[0]
+
+    
+
+# add an empty line at the end to make it easier for the unusedFieldsremove plugin to mmap() the output file 
+print
+        
+
diff --git a/compilerplugins/clang/unusedfieldsremove.cxx b/compilerplugins/clang/unusedfieldsremove.cxx
new file mode 100644
index 0000000..8ea9a21
--- /dev/null
+++ b/compilerplugins/clang/unusedfieldsremove.cxx
@@ -0,0 +1,136 @@
+/* -*- 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/.
+ */
+
+#include <cassert>
+#include <string>
+#include <iostream>
+#include "plugin.hxx"
+#include "compat.hxx"
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <assert.h>
+#include <cstring>
+
+/**
+  This is intended to be run as the second stage of the "unusedfields" clang plugin.
+*/
+
+namespace {
+
+class UnusedFieldsRemove:
+    public RecursiveASTVisitor<UnusedFieldsRemove>, public loplugin::RewritePlugin
+{
+public:
+    explicit UnusedFieldsRemove(InstantiationData const & data);
+    ~UnusedFieldsRemove();
+
+    virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
+
+    bool VisitFieldDecl( const FieldDecl* var );
+private:
+    // I use a brute-force approach - mmap the results file and do a linear search on it
+    // It works surprisingly well, because the file is small enough to fit into L2 cache on modern CPU's
+    size_t mmapFilesize;
+    int mmapFD;
+    char* mmappedData;
+};
+
+static size_t getFilesize(const char* filename)
+{
+    struct stat st;
+    stat(filename, &st);
+    return st.st_size;
+}
+
+UnusedFieldsRemove::UnusedFieldsRemove(InstantiationData const & data): RewritePlugin(data)
+{
+    static const char sInputFile[] = SRCDIR "/result.txt";
+    mmapFilesize = getFilesize(sInputFile);
+    //Open file
+    mmapFD = open(sInputFile, O_RDONLY, 0);
+    assert(mmapFD != -1);
+    //Execute mmap
+    mmappedData = static_cast<char*>(mmap(NULL, mmapFilesize, PROT_READ, MAP_PRIVATE, mmapFD, 0));
+    assert(mmappedData != NULL);
+}
+
+UnusedFieldsRemove::~UnusedFieldsRemove()
+{
+    //Cleanup
+    int rc = munmap(mmappedData, mmapFilesize);
+    assert(rc == 0);
+    close(mmapFD);
+}
+
+static std::string niceName(const FieldDecl* fieldDecl)
+{
+    std::string s = fieldDecl->getParent()->getQualifiedNameAsString() + " " +
+        fieldDecl->getNameAsString();
+    if (s.find("m_xExternalProgress") != std::string::npos)
+            cout << s << endl;
+    return s;
+}
+
+bool UnusedFieldsRemove::VisitFieldDecl( const FieldDecl* fieldDecl )
+{
+    if (rewriter == nullptr) {
+        return true;
+    }
+    if (ignoreLocation(fieldDecl)) {
+        return true;
+    }
+    // ignore stuff that forms part of the stable URE interface
+    if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(
+                              fieldDecl->getCanonicalDecl()->getLocation()))) {
+        return true;
+    }
+
+    // don't mess with templates
+/*    if (isa<CXXRecordDecl>(fieldDecl->getParent())) {
+        if (dyn_cast<CXXRecordDecl>(fieldDecl->getParent())->getDescribedClassTemplate() != nullptr) {
+            return true;
+        }
+    }
+*/
+    std::string aNiceName = " " + niceName(fieldDecl) + "\n";
+    const char *aNiceNameStr = aNiceName.c_str();
+    char* found = std::search(mmappedData, mmappedData + mmapFilesize, aNiceNameStr, aNiceNameStr + strlen(aNiceNameStr));
+    if(!(found < mmappedData + mmapFilesize)) {
+        return true;
+    }
+    SourceRange replaceRange(fieldDecl->getSourceRange());
+    // sometimes the declaration has a semicolon just after it, and it's much neater to remove that too.
+    if (rewriter->getRewrittenText(SourceRange(replaceRange.getEnd(), replaceRange.getEnd().getLocWithOffset(1))) == ";") {
+        replaceRange.setEnd(replaceRange.getEnd().getLocWithOffset(1));
+    }
+    // remove leading spaces
+    while (rewriter->getRewrittenText(SourceRange(replaceRange.getBegin().getLocWithOffset(-1), replaceRange.getBegin())) == " ")
+    {
+        replaceRange.setBegin(replaceRange.getBegin().getLocWithOffset(-1));
+    }
+    if (!replaceText(replaceRange, "")) {
+        report(
+            DiagnosticsEngine::Warning,
+            "Could not remove unused field (" + niceName(fieldDecl) + ")",
+            fieldDecl->getLocStart())
+          << fieldDecl->getSourceRange();
+    }
+    return true;
+}
+
+
+
+loplugin::Plugin::Registration< UnusedFieldsRemove > X("unusedfieldsremove", false);
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/inc/classes/filtercache.hxx b/framework/inc/classes/filtercache.hxx
index f8f1da2..7d9e45e 100644
--- a/framework/inc/classes/filtercache.hxx
+++ b/framework/inc/classes/filtercache.hxx
@@ -84,7 +84,6 @@ class FilterCache   :   private TransactionBase
     private:
 
         static sal_Int32        m_nRefCount;
-        static DataContainer*   m_pData;
         static sal_Int32        m_nVersion;
         static sal_Int16        m_nMode;
 
diff --git a/framework/inc/classes/filtercachedata.hxx b/framework/inc/classes/filtercachedata.hxx
index e20b1a3..f41aeb5 100644
--- a/framework/inc/classes/filtercachedata.hxx
+++ b/framework/inc/classes/filtercachedata.hxx
@@ -315,12 +315,6 @@ class SetNodeHash : public std::unordered_map< OUString                    ,
                                                OUStringHash                  ,
                                                std::equal_to< OUString > >
 {
-    // member
-
-    public:
-        OUStringList  lAddedItems;
-        OUStringList  lChangedItems;
-        OUStringList  lRemovedItems;
 };
 
 // Use these hashes to implement different tables which assign types to frame loader or detect services.
@@ -335,93 +329,6 @@ class PerformanceHash   :   public  std::unordered_map< OUString,
 };
 
 
-// Use private static data container to hold all values of configuration!
-
-class DataContainer
-{
-    public:
-
-    /** @short  identifies different sets of the TypeDetection configuration package.
-
-        @descr  Most functions on top of this configuration package are the same ...
-                but must be executed on different places inside this configuration structures.
-                These enum values can be used ate some interface methods to specify, which
-                configuration set should be used.
-                Further it must be possible to start the same action for more than one cfg type.
-                That's why these values must be interpreted as flags. Means: its values must be
-                in range [2^n]!
-      */
-    enum ECFGType
-    {
-        E_TYPE           =  1,
-        E_FILTER         =  2,
-        E_DETECTSERVICE  =  4,
-        E_FRAMELOADER    =  8,
-        E_CONTENTHANDLER = 16,
-
-        E_ALL            = E_TYPE | E_FILTER | E_DETECTSERVICE | E_FRAMELOADER | E_CONTENTHANDLER
-    };
-
-    public:
-
-        DataContainer();
-
-        SetNodeHash< FileType > m_aTypeCache;               /// hold all information about registered file types
-        SetNodeHash< Filter >   m_aFilterCache;             /// hold all information about registered filters
-        SetNodeHash< Detector > m_aDetectorCache;           /// hold all information about registered detect services
-        SetNodeHash< Loader >   m_aLoaderCache;             /// hold all information about registered loader services
-        SetNodeHash< ContentHandler > m_aContentHandlerCache;     /// hold all information about registered content handler services
-        PerformanceHash         m_aFastFilterCache;         /// hold all registered filter for a special file type
-        PerformanceHash         m_aFastDetectorCache;       /// hold all registered detect services for a special file type
-        PerformanceHash         m_aFastLoaderCache;         /// hold all registered loader services for a special file type
-        PerformanceHash         m_aFastContentHandlerCache; /// hold all registered content handler services for a special file type
-        OUStringHashMap         m_aPreferredTypesCache;     /// assignment of extensions to preferred types for it
-        Loader                  m_aGenericLoader;           /// information about our default frame loader
-        OUString                m_sLocale;                  /// current set locale of configuration to handle right UIName from set of all UINames!
-        bool                    m_bTypesModified;
-        bool                    m_bFiltersModified;
-        bool                    m_bDetectorsModified;
-        bool                    m_bLoadersModified;
-        bool                    m_bHandlersModified;
-};
-
-/*-************************************************************************************************************
-    @short          capsulate configuration access for filter configuration
-    @descr          We use the ConfigItem mechanism to read/write values from/to configuration.
-                    This implementation could be used to handle standard AND additional filter configurations in the same way.
-                    We set a data container pointer for filling or reading ... this class use it temp.
-                    After successfully calling of read(), we can use filled container directly or merge it with an existing one.
-                    After successfully calling of write() all values of given data container are flushed to our configuration.
-    @base           ConfigItem
-
-    @devstatus      ready to use
-    @threadsafe     no
-*//*-*************************************************************************************************************/
-class FilterCFGAccess : public ::utl::ConfigItem
-{
-
-    //  interface
-
-    public:
-                                    FilterCFGAccess ( const OUString& sPath                                  ,
-                                                            sal_Int32        nVersion = DEFAULT_FILTERCACHE_VERSION ,
-                                                            ConfigItemMode   nMode    = DEFAULT_FILTERCACHE_MODE    ); // open configuration
-        virtual                     ~FilterCFGAccess(                                                               );
-
-    //  member
-
-    private:
-        EFilterPackage  m_ePackage;   // ... not really used yet! should split configuration in STANDARD and ADDITIONAL filter
-        sal_Int32       m_nVersion;   // file format version of configuration! (necessary for "xml2xcd" transformation!)
-        sal_Int32       m_nKeyCountTypes;   // follow key counts present count of configuration properties for types/filters ... and depends from m_nVersion - must be set right!
-        sal_Int32       m_nKeyCountFilters;
-        sal_Int32       m_nKeyCountDetectors;
-        sal_Int32       m_nKeyCountLoaders;
-        sal_Int32       m_nKeyCountContentHandlers;
-        OUString m_sProductName;
-        OUString m_sFormatVersion;
-};
-
 }       //  namespace framework
 
 #endif // INCLUDED_FRAMEWORK_INC_CLASSES_FILTERCACHEDATA_HXX
diff --git a/framework/inc/dispatch/closedispatcher.hxx b/framework/inc/dispatch/closedispatcher.hxx
index bf77143..523f3c9 100644
--- a/framework/inc/dispatch/closedispatcher.hxx
+++ b/framework/inc/dispatch/closedispatcher.hxx
@@ -100,7 +100,6 @@ class CloseDispatcher : public  ::cppu::WeakImplHelper<
 
         /** @short  list of registered status listener */
         osl::Mutex m_mutex;
-        ListenerHash m_lStatusListener;
 
         /** @short  holded alive for internally asynchronous operations! */
         css::uno::Reference< css::frame::XDispatchResultListener > m_xResultListener;
diff --git a/framework/inc/dispatch/startmoduledispatcher.hxx b/framework/inc/dispatch/startmoduledispatcher.hxx
index 31ecb62..dbb8d3f 100644
--- a/framework/inc/dispatch/startmoduledispatcher.hxx
+++ b/framework/inc/dispatch/startmoduledispatcher.hxx
@@ -58,12 +58,8 @@ class StartModuleDispatcher : public  ::cppu::WeakImplHelper<
                    uno resources. */
         css::uno::Reference< css::uno::XComponentContext > m_xContext;
 
-        /** @short  our "context" frame. */
-        css::uno::WeakReference< css::frame::XFrame > m_xOwner;
-
         /** @short  list of registered status listener */
         osl::Mutex m_mutex;
-        ListenerHash m_lStatusListener;
 
     // native interface
 
@@ -80,8 +76,7 @@ class StartModuleDispatcher : public  ::cppu::WeakImplHelper<
             @param  xFrame
                     the frame where the corresponding dispatch was started.
          */
-        StartModuleDispatcher(const css::uno::Reference< css::uno::XComponentContext >&     rxContext,
-                              const css::uno::Reference< css::frame::XFrame >&              xFrame);
+        StartModuleDispatcher(const css::uno::Reference< css::uno::XComponentContext >&     rxContext);
 
         /** @short  does nothing real. */
         virtual ~StartModuleDispatcher();
diff --git a/framework/inc/uielement/statusbarmanager.hxx b/framework/inc/uielement/statusbarmanager.hxx
index a80fea3..305da2c 100644
--- a/framework/inc/uielement/statusbarmanager.hxx
+++ b/framework/inc/uielement/statusbarmanager.hxx
@@ -54,7 +54,6 @@ class StatusBarManager : public ::cppu::WeakImplHelper<
     public:
         StatusBarManager( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
                           const css::uno::Reference< css::frame::XFrame >& rFrame,
-                          const OUString& rResourceName,
                           StatusBar* pStatusBar );
         virtual ~StatusBarManager();
 
@@ -100,12 +99,9 @@ class StatusBarManager : public ::cppu::WeakImplHelper<
         bool                                                                  m_bDisposed : 1,
                                                                               m_bFrameActionRegistered : 1,
                                                                               m_bUpdateControllers : 1;
-        bool                                                                  m_bModuleIdentified;
         VclPtr<StatusBar>                                                     m_pStatusBar;
         OUString                                                              m_aModuleIdentifier;
-        OUString                                                              m_aResourceName;
         css::uno::Reference< css::frame::XFrame >                             m_xFrame;
-        css::uno::Reference< css::container::XNameAccess >                    m_xUICommandLabels;
         StatusBarControllerMap                                                m_aControllerMap;
         osl::Mutex                                                            m_mutex;
         ::cppu::OMultiTypeInterfaceContainerHelper                            m_aListenerContainer;   /// container for ALL Listener
diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx
index 2f55097..655228a 100644
--- a/framework/inc/uielement/toolbarmanager.hxx
+++ b/framework/inc/uielement/toolbarmanager.hxx
@@ -118,11 +118,6 @@ class ToolBarManager : public ToolbarManager_Base
             css::uno::Reference< css::frame::XLayoutManager >   xLayoutManager;
             css::uno::Reference< css::awt::XWindow >            xWindow;
         };
-        struct ControllerParams
-        {
-            sal_Int16 nWidth;
-        };
-        typedef std::vector< ControllerParams > ControllerParamsVector;
 
     protected:
         DECL_LINK_TYPED( Command, CommandEvent const *, void );
@@ -173,7 +168,6 @@ class ToolBarManager : public ToolbarManager_Base
 
         bool m_bDisposed : 1,
              m_bSmallSymbols : 1,
-             m_bModuleIdentified : 1,
              m_bAddedToTaskPaneList : 1,
              m_bFrameActionRegistered : 1,
              m_bUpdateControllers : 1,
@@ -206,7 +200,6 @@ class ToolBarManager : public ToolbarManager_Base
         Timer                                                                                  m_aAsyncUpdateControllersTimer;
         OUString                                                                               m_sIconTheme;
         MenuDescriptionMap m_aMenuMap;
-        bool                                                                               m_bAcceleratorCfg;
         css::uno::Reference< css::ui::XAcceleratorConfiguration >    m_xDocAcceleratorManager;
         css::uno::Reference< css::ui::XAcceleratorConfiguration >    m_xModuleAcceleratorManager;
         css::uno::Reference< css::ui::XAcceleratorConfiguration >    m_xGlobalAcceleratorManager;
diff --git a/framework/inc/uielement/uicommanddescription.hxx b/framework/inc/uielement/uicommanddescription.hxx
index d57ae4a..9e837cb 100644
--- a/framework/inc/uielement/uicommanddescription.hxx
+++ b/framework/inc/uielement/uicommanddescription.hxx
@@ -95,7 +95,6 @@ public:
         UICommandDescription( const css::uno::Reference< css::uno::XComponentContext>& rxContext, bool  );
         void impl_fillElements(const sal_Char* _pName);
 
-        bool                                                      m_bConfigRead;
         OUString                                                  m_aPrivateResourceURL;
         css::uno::Reference< css::uno::XComponentContext >        m_xContext;
         ModuleToCommandFileMap                                    m_aModuleToCommandFileMap;
diff --git a/framework/inc/xml/acceleratorconfigurationreader.hxx b/framework/inc/xml/acceleratorconfigurationreader.hxx
index a865729..2067842 100644
--- a/framework/inc/xml/acceleratorconfigurationreader.hxx
+++ b/framework/inc/xml/acceleratorconfigurationreader.hxx
@@ -71,9 +71,6 @@ class AcceleratorConfigurationReader : public ::cppu::WeakImplHelper< css::xml::
 
     private:
 
-        /** @short  needed to read the xml configuration. */
-        css::uno::Reference< css::xml::sax::XDocumentHandler > m_xReader;
-
         /** @short  reference to the outside container, where this
                     reader/writer must work on. */
         AcceleratorCache& m_rContainer;
diff --git a/framework/inc/xml/saxnamespacefilter.hxx b/framework/inc/xml/saxnamespacefilter.hxx
index c5ddc91..cd4c30a 100644
--- a/framework/inc/xml/saxnamespacefilter.hxx
+++ b/framework/inc/xml/saxnamespacefilter.hxx
@@ -84,7 +84,6 @@ class FWE_DLLPUBLIC SaxNamespaceFilter :
         css::uno::Reference< css::xml::sax::XLocator >          m_xLocator;
         css::uno::Reference< css::xml::sax::XDocumentHandler>   xDocumentHandler;
         NamespaceStack                                          m_aNamespaceStack;
-        sal_Int32                                               m_nDepth;
 
         OUString m_aXMLAttributeNamespace;
         OUString m_aXMLAttributeType;
diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx
index 401bde5..0915738 100644
--- a/framework/source/dispatch/closedispatcher.cxx
+++ b/framework/source/dispatch/closedispatcher.cxx
@@ -60,7 +60,6 @@ CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::uno::XComponent
     , m_aAsyncCallback(
         new vcl::EventPoster(LINK(this, CloseDispatcher, impl_asyncCallback)))
     , m_eOperation(E_CLOSE_DOC)
-    , m_lStatusListener(m_mutex)
     , m_pSysWindow(nullptr)
 {
     uno::Reference<frame::XFrame> xTarget = static_impl_searchRightTargetFrame(xFrame, sTarget);
diff --git a/framework/source/dispatch/dispatchprovider.cxx b/framework/source/dispatch/dispatchprovider.cxx
index bed75e2..c26328e 100644
--- a/framework/source/dispatch/dispatchprovider.cxx
+++ b/framework/source/dispatch/dispatchprovider.cxx
@@ -594,7 +594,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat
 
         case E_STARTMODULEDISPATCHER :
                 {
-                    StartModuleDispatcher* pDispatcher = new StartModuleDispatcher( m_xContext, xOwner );
+                    StartModuleDispatcher* pDispatcher = new StartModuleDispatcher( m_xContext );
                     xDispatchHelper.set( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
                 }
                 break;
diff --git a/framework/source/dispatch/startmoduledispatcher.cxx b/framework/source/dispatch/startmoduledispatcher.cxx
index 726802c..ff9fdb6 100644
--- a/framework/source/dispatch/startmoduledispatcher.cxx
+++ b/framework/source/dispatch/startmoduledispatcher.cxx
@@ -48,11 +48,8 @@ namespace framework{
 #endif
 namespace fpf = ::framework::pattern::frame;
 
-StartModuleDispatcher::StartModuleDispatcher(const css::uno::Reference< css::uno::XComponentContext >&     rxContext,
-                                             const css::uno::Reference< css::frame::XFrame >&              xFrame)
+StartModuleDispatcher::StartModuleDispatcher(const css::uno::Reference< css::uno::XComponentContext >&     rxContext)
     : m_xContext         (rxContext                         )
-    , m_xOwner           (xFrame                        )
-    , m_lStatusListener  (m_mutex)
 {
 }
 
diff --git a/framework/source/fwe/xml/saxnamespacefilter.cxx b/framework/source/fwe/xml/saxnamespacefilter.cxx
index 4971462..07b1f6c 100644
--- a/framework/source/fwe/xml/saxnamespacefilter.cxx
+++ b/framework/source/fwe/xml/saxnamespacefilter.cxx
@@ -38,7 +38,6 @@ namespace framework{
 SaxNamespaceFilter::SaxNamespaceFilter( Reference< XDocumentHandler >& rSax1DocumentHandler ) :
      m_xLocator( nullptr ),
      xDocumentHandler( rSax1DocumentHandler ),
-     m_nDepth( 0 ),
      m_aXMLAttributeNamespace( "xmlns" ),
      m_aXMLAttributeType( "CDATA" )
 {
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 9c90fae..8e765f0 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -443,9 +443,6 @@ private:
     sal_Bool m_dbg_bMakeItFaster;
     #endif
 
-    // HACK ... TODO
-    css::uno::Reference< css::task::XStatusIndicator > m_xExternalProgress;
-
 // interface
 
 public:
diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx
index 7ddb164..3bf6c89 100644
--- a/framework/source/services/substitutepathvars.cxx
+++ b/framework/source/services/substitutepathvars.cxx
@@ -292,7 +292,6 @@ private:
 struct FixedVariable
 {
     const char*     pVarName;
-    sal_Int32       nStrLen;
     PreDefVariable  nEnumValue;
     bool            bAbsPath;
 };
@@ -344,25 +343,25 @@ static const sal_Int16 aEnvPrioTable[ET_COUNT] =
 // Table with all fixed/predefined variables supported.
 static const FixedVariable aFixedVarTable[] =
 {
-    { RTL_CONSTASCII_STRINGPARAM("$(inst)"),        PREDEFVAR_INST,         true  },
-    { RTL_CONSTASCII_STRINGPARAM("$(prog)"),        PREDEFVAR_PROG,         true  },
-    { RTL_CONSTASCII_STRINGPARAM("$(user)"),        PREDEFVAR_USER,         true  },
-    { RTL_CONSTASCII_STRINGPARAM("$(work)"),        PREDEFVAR_WORK,         true  },      // Special variable (transient)!
-    { RTL_CONSTASCII_STRINGPARAM("$(home)"),        PREDEFVAR_HOME,         true  },
-    { RTL_CONSTASCII_STRINGPARAM("$(temp)"),        PREDEFVAR_TEMP,         true  },
-    { RTL_CONSTASCII_STRINGPARAM("$(path)"),        PREDEFVAR_PATH,         true  },
-    { RTL_CONSTASCII_STRINGPARAM("$(langid)"),      PREDEFVAR_LANGID,       false },
-    { RTL_CONSTASCII_STRINGPARAM("$(vlang)"),       PREDEFVAR_VLANG,        false },
-    { RTL_CONSTASCII_STRINGPARAM("$(instpath)"),    PREDEFVAR_INSTPATH,     true  },
-    { RTL_CONSTASCII_STRINGPARAM("$(progpath)"),    PREDEFVAR_PROGPATH,     true  },
-    { RTL_CONSTASCII_STRINGPARAM("$(userpath)"),    PREDEFVAR_USERPATH,     true  },
-    { RTL_CONSTASCII_STRINGPARAM("$(insturl)"),     PREDEFVAR_INSTURL,      true  },
-    { RTL_CONSTASCII_STRINGPARAM("$(progurl)"),     PREDEFVAR_PROGURL,      true  },
-    { RTL_CONSTASCII_STRINGPARAM("$(userurl)"),     PREDEFVAR_USERURL,      true  },
-    { RTL_CONSTASCII_STRINGPARAM("$(workdirurl)"),  PREDEFVAR_WORKDIRURL,   true  },  // Special variable (transient) and don't use for resubstitution!
-    { RTL_CONSTASCII_STRINGPARAM("$(baseinsturl)"), PREDEFVAR_BASEINSTURL,  true  },
-    { RTL_CONSTASCII_STRINGPARAM("$(userdataurl)"), PREDEFVAR_USERDATAURL,  true  },
-    { RTL_CONSTASCII_STRINGPARAM("$(brandbaseurl)"),PREDEFVAR_BRANDBASEURL, true  }
+    { "$(inst)",        PREDEFVAR_INST,         true  },
+    { "$(prog)",        PREDEFVAR_PROG,         true  },
+    { "$(user)",        PREDEFVAR_USER,         true  },
+    { "$(work)",        PREDEFVAR_WORK,         true  },      // Special variable (transient)!
+    { "$(home)",        PREDEFVAR_HOME,         true  },
+    { "$(temp)",        PREDEFVAR_TEMP,         true  },
+    { "$(path)",        PREDEFVAR_PATH,         true  },
+    { "$(langid)",      PREDEFVAR_LANGID,       false },
+    { "$(vlang)",       PREDEFVAR_VLANG,        false },
+    { "$(instpath)",    PREDEFVAR_INSTPATH,     true  },
+    { "$(progpath)",    PREDEFVAR_PROGPATH,     true  },
+    { "$(userpath)",    PREDEFVAR_USERPATH,     true  },
+    { "$(insturl)",     PREDEFVAR_INSTURL,      true  },
+    { "$(progurl)",     PREDEFVAR_PROGURL,      true  },
+    { "$(userurl)",     PREDEFVAR_USERURL,      true  },
+    { "$(workdirurl)",  PREDEFVAR_WORKDIRURL,   true  },  // Special variable (transient) and don't use for resubstitution!
+    { "$(baseinsturl)", PREDEFVAR_BASEINSTURL,  true  },
+    { "$(userdataurl)", PREDEFVAR_USERDATAURL,  true  },
+    { "$(brandbaseurl)",PREDEFVAR_BRANDBASEURL, true  }
 };
 
 //      Implementation helper classes
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index 5b5c0f5..caea44e 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -507,7 +507,6 @@ ImageManagerImpl::ImageManagerImpl( const uno::Reference< uno::XComponentContext
     m_xContext( rxContext )
     , m_pOwner(pOwner)
     , m_pDefaultImageList( nullptr )
-    , m_aXMLPostfix( ".xml" )
     , m_aResourceString( ModuleImageList )
     , m_aListenerContainer( m_mutex )
     , m_bUseGlobal(_bUseGlobal)
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.hxx b/framework/source/uiconfiguration/imagemanagerimpl.hxx
index f9c36ea..f756f0b 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.hxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.hxx
@@ -166,7 +166,6 @@ namespace framework
             ::cppu::OWeakObject*                                                            m_pOwner;
             rtl::Reference< GlobalImageList >                                               m_pGlobalImageList;
             CmdImageList*                                                                   m_pDefaultImageList;
-            OUString                                                                   m_aXMLPostfix;
             OUString                                                                   m_aModuleIdentifier;
             OUString                                                                   m_aResourceString;
             osl::Mutex m_mutex;
diff --git a/framework/source/uiconfiguration/uicategorydescription.cxx b/framework/source/uiconfiguration/uicategorydescription.cxx
index 0f89271..4b90243 100644
--- a/framework/source/uiconfiguration/uicategorydescription.cxx
+++ b/framework/source/uiconfiguration/uicategorydescription.cxx
@@ -51,12 +51,6 @@ using namespace framework;
 
 namespace {
 
-struct ModuleToCategory
-{
-    const char* pModuleId;
-    const char* pCommands;
-};
-
 static const char GENERIC_MODULE_NAME[]                     = "generic";
 static const char CONFIGURATION_ROOT_ACCESS[]               = "/org.openoffice.Office.UI.";
 static const char CONFIGURATION_CATEGORY_ELEMENT_ACCESS[]   = "/Commands/Categories";
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index 92673de..13f0691 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -131,14 +131,11 @@ static sal_uInt16 impl_convertItemStyleToItemBits( sal_Int16 nStyle )
 StatusBarManager::StatusBarManager(
     const uno::Reference< uno::XComponentContext >& rxContext,
     const uno::Reference< frame::XFrame >& rFrame,
-    const OUString& rResourceName,
     StatusBar* pStatusBar ) :
     m_bDisposed( false ),
     m_bFrameActionRegistered( false ),
     m_bUpdateControllers( false ),
-    m_bModuleIdentified( false ),
     m_pStatusBar( pStatusBar ),
-    m_aResourceName( rResourceName ),
     m_xFrame( rFrame ),
     m_aListenerContainer( m_mutex ),
     m_xContext( rxContext )
diff --git a/framework/source/uielement/statusbarwrapper.cxx b/framework/source/uielement/statusbarwrapper.cxx
index 7c3b82a..6557ee1 100644
--- a/framework/source/uielement/statusbarwrapper.cxx
+++ b/framework/source/uielement/statusbarwrapper.cxx
@@ -111,7 +111,7 @@ void SAL_CALL StatusBarWrapper::initialize( const Sequence< Any >& aArguments )
                     sal_uLong nStyles = WinBits( WB_LEFT | WB_3DLOOK );
 
                     pStatusBar = VclPtr<FrameworkStatusBar>::Create( pWindow, nStyles );
-                    pStatusBarManager = new StatusBarManager( m_xContext, xFrame, m_aResourceURL, pStatusBar );
+                    pStatusBarManager = new StatusBarManager( m_xContext, xFrame, pStatusBar );
                     static_cast<FrameworkStatusBar*>(pStatusBar)->SetStatusBarManager( pStatusBarManager );
                     m_xStatusBarManager.set( static_cast< OWeakObject *>( pStatusBarManager ), UNO_QUERY );
                     pStatusBar->SetUniqueId( HID_STATUSBAR );
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index c1c23a6..ce608f7 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -177,7 +177,6 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext,
                                 ToolBox* pToolBar ) :
     m_bDisposed( false ),
     m_bSmallSymbols( !SvtMiscOptions().AreCurrentSymbolsLarge() ),
-    m_bModuleIdentified( false ),
     m_bAddedToTaskPaneList( true ),
     m_bFrameActionRegistered( false ),
     m_bUpdateControllers( false ),
@@ -189,8 +188,7 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext,
     m_xFrame( rFrame ),
     m_aListenerContainer( m_mutex ),
     m_xContext( rxContext ),
-    m_sIconTheme( SvtMiscOptions().GetIconTheme() ),
-    m_bAcceleratorCfg( false )
+    m_sIconTheme( SvtMiscOptions().GetIconTheme() )
 {
     OSL_ASSERT( m_xContext.is() );
 
diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx
index 926f5c0..01e9285 100644
--- a/framework/source/uielement/uicommanddescription.cxx
+++ b/framework/source/uielement/uicommanddescription.cxx
@@ -614,7 +614,6 @@ void SAL_CALL ConfigurationAccess_UICommand::disposing( const EventObject& aEven
 
 UICommandDescription::UICommandDescription(const Reference< XComponentContext >& rxContext)
     : UICommandDescription_BASE(m_aMutex)
-    , m_bConfigRead(false)
     , m_aPrivateResourceURL(PRIVATE_RESOURCE_URL)
     , m_xContext(rxContext)
 {
@@ -632,7 +631,6 @@ UICommandDescription::UICommandDescription(const Reference< XComponentContext >&
 
 UICommandDescription::UICommandDescription(const Reference< XComponentContext >& rxContext, bool)
     : UICommandDescription_BASE(m_aMutex)
-    , m_bConfigRead(false)
     , m_xContext(rxContext)
 {
 }


More information about the Libreoffice-commits mailing list