[Libreoffice-commits] core.git: compilerplugins/clang editeng/source include/editeng include/svl svl/source

Noel Grandin noel at peralex.com
Sun Jul 19 23:34:13 PDT 2015


 compilerplugins/clang/unusedmethods.cxx |    9 +++++
 compilerplugins/clang/unusedmethods.py  |   35 +++++++++++++++++-----
 editeng/source/items/xmlcnitm.cxx       |    7 ----
 include/editeng/xmlcnitm.hxx            |    2 -
 include/svl/cintitem.hxx                |   12 -------
 include/svl/ctypeitm.hxx                |    2 -
 include/svl/custritm.hxx                |    2 -
 include/svl/documentlockfile.hxx        |    3 -
 include/svl/eitem.hxx                   |    3 -
 include/svl/int64item.hxx               |    2 -
 include/svl/intitem.hxx                 |    3 -
 include/svl/poolitem.hxx                |    1 
 include/svl/style.hxx                   |    3 -
 include/svl/visitem.hxx                 |    3 -
 svl/source/items/cenumitm.cxx           |    8 -----
 svl/source/items/cintitem.cxx           |   49 --------------------------------
 svl/source/items/custritm.cxx           |   11 -------
 svl/source/items/int64item.cxx          |   13 --------
 svl/source/items/intitem.cxx            |   12 -------
 svl/source/items/poolitem.cxx           |    6 ---
 svl/source/items/visitem.cxx            |    8 -----
 21 files changed, 35 insertions(+), 159 deletions(-)

New commits:
commit 9f4f237a3834e5d58a87296424db5428f68d1550
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Jul 17 13:08:16 2015 +0200

    loplugin:unusedmethods svl
    
    Change-Id: If86cc43fda4d138cf7f678d81fa2b35f68f3c03b
    Reviewed-on: https://gerrit.libreoffice.org/17162
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx
index a137a21..6627fe9 100644
--- a/compilerplugins/clang/unusedmethods.cxx
+++ b/compilerplugins/clang/unusedmethods.cxx
@@ -124,12 +124,19 @@ static bool startsWith(const std::string& s, const char* other)
     return s.compare(0, strlen(other), other) == 0;
 }
 
-static bool isStandardStuff(const std::string& s)
+static bool isStandardStuff(const std::string& input)
 {
+    std::string s = input;
+    if (startsWith(s,"class "))
+        s = s.substr(6);
+    else if (startsWith(s,"struct "))
+        s = s.substr(7);
     // ignore UNO interface definitions, cannot change those
     return startsWith(s, "com::sun::star::")
           // ignore stuff in the C++ stdlib and boost
           || startsWith(s, "std::") || startsWith(s, "boost::") || startsWith(s, "class boost::") || startsWith(s, "__gnu_debug::")
+          // external library
+          || startsWith(s, "mdds::")
           // can't change our rtl layer
           || startsWith(s, "rtl::")
           // ignore anonymous namespace stuff, it is compilation-unit-local and the compiler will detect any
diff --git a/compilerplugins/clang/unusedmethods.py b/compilerplugins/clang/unusedmethods.py
index 2790408..27118b2 100755
--- a/compilerplugins/clang/unusedmethods.py
+++ b/compilerplugins/clang/unusedmethods.py
@@ -57,6 +57,7 @@ exclusionSet = set([
     # instantiated from templates, not sure why it is not being picked up
     "class basegfx::B2DPolygon OutputDevice::PixelToLogic(const class basegfx::B2DPolygon &,const class MapMode &) const",
     "type-parameter-0-0 * detail::cloner::clone(type-parameter-0-0 *const)",
+    "const class rtl::OUString writerperfect::DocumentHandlerFor::name()",
     # only used by OSX build
     "void StyleSettings::SetHideDisabledMenuItems(_Bool)",
     ])
@@ -87,20 +88,38 @@ for clazz in sorted(definitionSet - callSet - exclusionSet):
          or (clazz.find("::Type()") != -1)):
         continue
     # if this method is const, and there is a non-const variant of it, and the non-const variant is in use, then leave it alone
-    if (clazz.endswith(" const")
-        and clazz[6:len(clazz)-6] in definitionSet
-        and clazz[6:len(clazz)-6] in callSet):
-       continue
+    if (clazz.startswith("const ") and clazz.endswith(" const")):
+        clazz2 = clazz[6:len(clazz)-12]
+        if (clazz2 in callSet):
+           continue
+    elif (clazz.endswith(" const")):
+        clazz2 = clazz[:len(clazz)-6]
+        if (clazz2 in callSet):
+           continue
+    if (clazz.endswith(" const") and clazz.find("::iterator") != -1):
+        clazz2 = clazz.replace("::const_iterator", "::iterator")
+        clazz2 = clazz2[:len(clazz)-6] # strip off " const"
+        if (clazz2 in callSet):
+           continue
     # if this method is non-const, and there is a const variant of it, and the const variant is in use, then leave it alone
-    if ((not clazz.endswith(" const"))
-        and ("const " + clazz + " const") in definitionSet
-        and ("const " + clazz + " const") in callSet):
+    if ((not clazz.endswith(" const")) and ("const " + clazz + " const") in callSet):
        continue
+    if ((not clazz.endswith(" const")) and clazz.find("::iterator") != -1):
+        clazz2 = clazz.replace("::iterator", "::const_iterator") + " const"
+        if (clazz2 in callSet):
+           continue
     # There is lots of macro magic going on in /home/noel/libo4/include/sax/fshelper.hxx that should be using C++11 varag templates
     if clazz.startswith("void sax_fastparser::FastSerializerHelper::"):
        continue
     # used by Windows build
-    if clazz.find("DdeTopic::") != -1 or clazz.find("DdeData::") != -1 or clazz.find("DdeService::") != -1:
+    if (clazz.find("DdeTopic::") != -1 
+        or clazz.find("DdeData::") != -1
+        or clazz.find("DdeService::") != -1
+        or clazz.find("DdeTransaction::") != -1
+        or clazz.find("DdeConnection::") != -1
+        or clazz.find("DdeLink::") != -1
+        or clazz.find("DdeItem::") != -1
+        or clazz.find("DdeGetPutItem::") != -1):
        continue
     print clazz
 
diff --git a/editeng/source/items/xmlcnitm.cxx b/editeng/source/items/xmlcnitm.cxx
index 785c6fe..5ea505d 100644
--- a/editeng/source/items/xmlcnitm.cxx
+++ b/editeng/source/items/xmlcnitm.cxx
@@ -56,13 +56,6 @@ bool SvXMLAttrContainerItem::operator==( const SfxPoolItem& rItem ) const
     return *pImpl == *static_cast<const SvXMLAttrContainerItem&>(rItem).pImpl;
 }
 
-int SvXMLAttrContainerItem::Compare( const SfxPoolItem &/*rWith*/ ) const
-{
-    DBG_ASSERT( false, "not yet implemented" );
-
-    return 0;
-}
-
 bool SvXMLAttrContainerItem::GetPresentation(
                     SfxItemPresentation /*ePresentation*/,
                     SfxMapUnit /*eCoreMetric*/,
diff --git a/include/editeng/xmlcnitm.hxx b/include/editeng/xmlcnitm.hxx
index 25df0a4..c9725e4 100644
--- a/include/editeng/xmlcnitm.hxx
+++ b/include/editeng/xmlcnitm.hxx
@@ -41,8 +41,6 @@ public:
     virtual ~SvXMLAttrContainerItem();
 
     virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
-    using SfxPoolItem::Compare;
-    virtual int Compare( const SfxPoolItem &rWith ) const SAL_OVERRIDE;
 
     virtual bool GetPresentation(
                                 SfxItemPresentation ePresentation,
diff --git a/include/svl/cintitem.hxx b/include/svl/cintitem.hxx
index 710e5e4..022b3c2 100644
--- a/include/svl/cintitem.hxx
+++ b/include/svl/cintitem.hxx
@@ -42,9 +42,6 @@ public:
 
     virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
 
-    using SfxPoolItem::Compare;
-    virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
-
     virtual bool GetPresentation(SfxItemPresentation,
                                                 SfxMapUnit, SfxMapUnit,
                                                 OUString & rText,
@@ -95,9 +92,6 @@ public:
 
     virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
 
-    using SfxPoolItem::Compare;
-    virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
-
     virtual bool GetPresentation(SfxItemPresentation,
                                                 SfxMapUnit, SfxMapUnit,
                                                 OUString & rText,
@@ -148,9 +142,6 @@ public:
 
     virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
 
-    using SfxPoolItem::Compare;
-    virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
-
     virtual bool GetPresentation(SfxItemPresentation,
                                                 SfxMapUnit, SfxMapUnit,
                                                 OUString & rText,
@@ -201,9 +192,6 @@ public:
 
     virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
 
-    using SfxPoolItem::Compare;
-    virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
-
     virtual bool GetPresentation(SfxItemPresentation,
                                                 SfxMapUnit, SfxMapUnit,
                                                 OUString & rText,
diff --git a/include/svl/ctypeitm.hxx b/include/svl/ctypeitm.hxx
index 11a4e97..83ca3e4 100644
--- a/include/svl/ctypeitm.hxx
+++ b/include/svl/ctypeitm.hxx
@@ -49,8 +49,6 @@ public:
 
     void SetValue( const OUString& rNewVal );
 
-    using SfxPoolItem::Compare;
-
     virtual bool GetPresentation( SfxItemPresentation ePres,
                                                  SfxMapUnit eCoreMetric,
                                                  SfxMapUnit ePresMetric,
diff --git a/include/svl/custritm.hxx b/include/svl/custritm.hxx
index e8e321c..ab2b23e 100644
--- a/include/svl/custritm.hxx
+++ b/include/svl/custritm.hxx
@@ -46,8 +46,6 @@ public:
 
     virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
 
-    virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
-
     virtual bool GetPresentation(SfxItemPresentation,
                                                 SfxMapUnit, SfxMapUnit,
                                                 OUString & rText,
diff --git a/include/svl/documentlockfile.hxx b/include/svl/documentlockfile.hxx
index 9449994..23403c8 100644
--- a/include/svl/documentlockfile.hxx
+++ b/include/svl/documentlockfile.hxx
@@ -50,9 +50,6 @@ public:
     bool OverwriteOwnLockFile();
     void RemoveFile();
 
-    // the methods allow to control whether UI interaction regarding the locked document file is allowed
-    // this is a workaround for automated tests
-    static void AllowInteraction( bool bAllow ) { m_bAllowInteraction = bAllow; }
     static bool IsInteractionAllowed() { return m_bAllowInteraction; }
 };
 
diff --git a/include/svl/eitem.hxx b/include/svl/eitem.hxx
index d01ce77..add2a5f 100644
--- a/include/svl/eitem.hxx
+++ b/include/svl/eitem.hxx
@@ -88,9 +88,6 @@ public:
     // SfxPoolItem
     virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
 
-    using SfxPoolItem::Compare;
-    virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
-
     virtual bool GetPresentation(SfxItemPresentation,
                                                 SfxMapUnit, SfxMapUnit,
                                                 OUString & rText,
diff --git a/include/svl/int64item.hxx b/include/svl/int64item.hxx
index 45e6a8a..662b8e8 100644
--- a/include/svl/int64item.hxx
+++ b/include/svl/int64item.hxx
@@ -26,8 +26,6 @@ public:
 
     virtual bool operator== ( const SfxPoolItem& rItem ) const SAL_OVERRIDE;
 
-    virtual int Compare( const SfxPoolItem& r ) const SAL_OVERRIDE;
-
     virtual bool GetPresentation(
         SfxItemPresentation, SfxMapUnit, SfxMapUnit,
         OUString& rText, const IntlWrapper* pIntlWrapper = NULL ) const SAL_OVERRIDE;
diff --git a/include/svl/intitem.hxx b/include/svl/intitem.hxx
index 12536c4..546084b 100644
--- a/include/svl/intitem.hxx
+++ b/include/svl/intitem.hxx
@@ -59,9 +59,6 @@ public:
 
     virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
 
-    using SfxPoolItem::Compare;
-    virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
-
     virtual bool GetPresentation(SfxItemPresentation,
                                                 SfxMapUnit, SfxMapUnit,
                                                 OUString & rText,
diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx
index 06c7f7f..57e9749 100644
--- a/include/svl/poolitem.hxx
+++ b/include/svl/poolitem.hxx
@@ -169,7 +169,6 @@ public:
     virtual bool             operator==( const SfxPoolItem& ) const = 0;
     bool                     operator!=( const SfxPoolItem& rItem ) const
                              { return !(*this == rItem); }
-    virtual int              Compare( const SfxPoolItem &rWith ) const;
 
     /**  @return true if it has a valid string representation */
     virtual bool             GetPresentation( SfxItemPresentation ePresentation,
diff --git a/include/svl/style.hxx b/include/svl/style.hxx
index 43849dd..dafa95e 100644
--- a/include/svl/style.hxx
+++ b/include/svl/style.hxx
@@ -75,7 +75,6 @@ class SVL_DLLPUBLIC SfxStyleSheetBase : public comphelper::OWeakTypeObject
 {
 private:
     friend class SfxStyleSheetBasePool;
-    SVL_DLLPRIVATE static SfxStyleSheetBasePool& implGetStaticPool();
 
 protected:
     SfxStyleSheetBasePool*  pPool;          // related pool
@@ -218,8 +217,6 @@ public:
                                 SfxStyleSheetBasePool( SfxItemPool& );
                                 SfxStyleSheetBasePool( const SfxStyleSheetBasePool& );
 
-    const OUString&             GetAppName() const { return aAppName;   }
-
     SfxItemPool&                GetPool() { return rPool;}
     const SfxItemPool&          GetPool() const { return rPool;}
 
diff --git a/include/svl/visitem.hxx b/include/svl/visitem.hxx
index 109b631..cceef29 100644
--- a/include/svl/visitem.hxx
+++ b/include/svl/visitem.hxx
@@ -47,9 +47,6 @@ public:
 
     virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
 
-    using SfxPoolItem::Compare;
-    virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
-
     virtual bool GetPresentation(SfxItemPresentation,
                                                 SfxMapUnit, SfxMapUnit,
                                                 OUString & rText,
diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx
index a5525be..d7e88a9 100644
--- a/svl/source/items/cenumitm.cxx
+++ b/svl/source/items/cenumitm.cxx
@@ -165,14 +165,6 @@ bool SfxBoolItem::operator ==(const SfxPoolItem & rItem) const
 }
 
 // virtual
-int SfxBoolItem::Compare(const SfxPoolItem & rWith) const
-{
-    DBG_ASSERT(rWith.ISA(SfxBoolItem), "SfxBoolItem::Compare(): Bad type");
-    return (m_bValue == static_cast<SfxBoolItem const*>(&rWith)->m_bValue) ?
-               0 : m_bValue ? -1 : 1;
-}
-
-// virtual
 bool SfxBoolItem::GetPresentation(SfxItemPresentation,
                                                  SfxMapUnit, SfxMapUnit,
                                                  OUString & rText,
diff --git a/svl/source/items/cintitem.cxx b/svl/source/items/cintitem.cxx
index 0fde0d9..24fb8c7 100644
--- a/svl/source/items/cintitem.cxx
+++ b/svl/source/items/cintitem.cxx
@@ -33,17 +33,6 @@ bool CntByteItem::operator ==(const SfxPoolItem & rItem) const
 }
 
 // virtual
-int CntByteItem::Compare(const SfxPoolItem & rWith) const
-{
-    DBG_ASSERT(rWith.ISA(CntByteItem), "CntByteItem::Compare(): Bad type");
-    return (static_cast< const CntByteItem * >(&rWith))->m_nValue < m_nValue ?
-            -1 :
-           (static_cast< const CntByteItem * >(&rWith))->m_nValue
-             == m_nValue ?
-            0 : 1;
-}
-
-// virtual
 bool CntByteItem::GetPresentation(SfxItemPresentation,
                                                  SfxMapUnit, SfxMapUnit,
                                                  OUString & rText,
@@ -116,19 +105,6 @@ bool CntUInt16Item::operator ==(const SfxPoolItem & rItem) const
 }
 
 // virtual
-int CntUInt16Item::Compare(const SfxPoolItem & rWith) const
-{
-    DBG_ASSERT(rWith.ISA(CntUInt16Item),
-               "CntUInt16Item::Compare(): Bad type");
-    return (static_cast< const CntUInt16Item * >(&rWith))->m_nValue
-             < m_nValue ?
-            -1 :
-           (static_cast< const CntUInt16Item * >(&rWith))->m_nValue
-             == m_nValue ?
-            0 : 1;
-}
-
-// virtual
 bool CntUInt16Item::GetPresentation(SfxItemPresentation,
                                                    SfxMapUnit, SfxMapUnit,
                                                    OUString & rText,
@@ -200,18 +176,6 @@ bool CntInt32Item::operator ==(const SfxPoolItem & rItem) const
 }
 
 // virtual
-int CntInt32Item::Compare(const SfxPoolItem & rWith) const
-{
-    DBG_ASSERT(rWith.ISA(CntInt32Item), "CntInt32Item::Compare(): Bad type");
-    return (static_cast< const CntInt32Item * >(&rWith))->m_nValue
-             < m_nValue ?
-            -1 :
-           (static_cast< const CntInt32Item * >(&rWith))->m_nValue
-             == m_nValue ?
-            0 : 1;
-}
-
-// virtual
 bool CntInt32Item::GetPresentation(SfxItemPresentation,
                                                   SfxMapUnit, SfxMapUnit,
                                                   OUString & rText,
@@ -282,19 +246,6 @@ bool CntUInt32Item::operator ==(const SfxPoolItem & rItem) const
 }
 
 // virtual
-int CntUInt32Item::Compare(const SfxPoolItem & rWith) const
-{
-    DBG_ASSERT(rWith.ISA(CntUInt32Item),
-               "CntUInt32Item::operator ==(): Bad type");
-    return (static_cast< const CntUInt32Item * >(&rWith))->m_nValue
-             < m_nValue ?
-            -1 :
-           (static_cast< const CntUInt32Item * >(&rWith))->m_nValue
-             == m_nValue ?
-            0 : 1;
-}
-
-// virtual
 bool CntUInt32Item::GetPresentation(SfxItemPresentation,
                                                    SfxMapUnit, SfxMapUnit,
                                                    OUString & rText,
diff --git a/svl/source/items/custritm.cxx b/svl/source/items/custritm.cxx
index 2ed6d6a..1182ae5 100644
--- a/svl/source/items/custritm.cxx
+++ b/svl/source/items/custritm.cxx
@@ -37,17 +37,6 @@ bool CntUnencodedStringItem::operator ==(const SfxPoolItem & rItem) const
 }
 
 // virtual
-int CntUnencodedStringItem::Compare(SfxPoolItem const & rWith) const
-{
-    OSL_FAIL("CntUnencodedStringItem::Compare(): No international");
-    DBG_ASSERT(rWith.ISA(CntUnencodedStringItem),
-                "CntUnencodedStringItem::Compare(): Bad type");
-    sal_Int32 nCmp = m_aValue.compareTo(
-        static_cast< CntUnencodedStringItem const * >(&rWith)->m_aValue);
-    return (nCmp == 0) ? 0 : (nCmp < 0) ? -1 : 1;
-}
-
-// virtual
 bool CntUnencodedStringItem::GetPresentation(SfxItemPresentation, SfxMapUnit,
                                         SfxMapUnit, OUString & rText,
                                         const IntlWrapper *) const
diff --git a/svl/source/items/int64item.cxx b/svl/source/items/int64item.cxx
index f884106..7875690b 100644
--- a/svl/source/items/int64item.cxx
+++ b/svl/source/items/int64item.cxx
@@ -33,19 +33,6 @@ bool SfxInt64Item::operator== ( const SfxPoolItem& rItem ) const
     return mnValue == static_cast<const SfxInt64Item&>(rItem).mnValue;
 }
 
-int SfxInt64Item::Compare( const SfxPoolItem& r ) const
-{
-    sal_Int64 nOther = static_cast<const SfxInt64Item&>(r).mnValue;
-
-    if (mnValue < nOther)
-        return -1;
-
-    if (mnValue > nOther)
-        return 1;
-
-    return 0;
-}
-
 bool SfxInt64Item::GetPresentation(
     SfxItemPresentation, SfxMapUnit, SfxMapUnit, OUString& rText,
     const IntlWrapper* /*pIntlWrapper*/ ) const
diff --git a/svl/source/items/intitem.cxx b/svl/source/items/intitem.cxx
index e596d4a..735648e 100644
--- a/svl/source/items/intitem.cxx
+++ b/svl/source/items/intitem.cxx
@@ -59,18 +59,6 @@ bool SfxInt16Item::operator ==(const SfxPoolItem & rItem) const
 }
 
 // virtual
-int SfxInt16Item::Compare(const SfxPoolItem & rWith) const
-{
-    DBG_ASSERT(SfxPoolItem::operator ==(rWith), "unequal type");
-    return (static_cast< const SfxInt16Item * >(&rWith))->m_nValue
-             < m_nValue ?
-            -1 :
-           (static_cast< const SfxInt16Item * >(&rWith))->m_nValue
-             == m_nValue ?
-            0 : 1;
-}
-
-// virtual
 bool SfxInt16Item::GetPresentation(SfxItemPresentation,
                                                   SfxMapUnit, SfxMapUnit,
                                                   OUString & rText,
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index ef6c7fe..f55d7a2 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -123,12 +123,6 @@ SfxPoolItem::~SfxPoolItem()
 }
 
 
-int SfxPoolItem::Compare( const SfxPoolItem& ) const
-{
-    return 0;
-}
-
-
 bool SfxPoolItem::operator==( const SfxPoolItem& rCmp ) const
 {
     return rCmp.Type() == Type();
diff --git a/svl/source/items/visitem.cxx b/svl/source/items/visitem.cxx
index a8a92cd..a73f5b0 100644
--- a/svl/source/items/visitem.cxx
+++ b/svl/source/items/visitem.cxx
@@ -41,14 +41,6 @@ bool SfxVisibilityItem::operator ==(const SfxPoolItem & rItem) const
 }
 
 // virtual
-int SfxVisibilityItem::Compare(const SfxPoolItem & rWith) const
-{
-    DBG_ASSERT(rWith.ISA(SfxVisibilityItem), "SfxVisibilityItem::Compare(): Bad type");
-    return m_nValue.bVisible == static_cast< SfxVisibilityItem const * >(&rWith)->m_nValue.bVisible ?
-               0 : m_nValue.bVisible ? -1 : 1;
-}
-
-// virtual
 bool SfxVisibilityItem::GetPresentation(SfxItemPresentation,
                                                   SfxMapUnit, SfxMapUnit,
                                                   OUString & rText,


More information about the Libreoffice-commits mailing list