summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-07-17 13:08:16 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-07-20 06:33:44 +0000
commit9f4f237a3834e5d58a87296424db5428f68d1550 (patch)
tree9e3e2fa55dc1a4d673d4c12e2af297bf32140204
parentcheck np bounds again (diff)
downloadcore-9f4f237a3834e5d58a87296424db5428f68d1550.tar.gz
core-9f4f237a3834e5d58a87296424db5428f68d1550.zip
loplugin:unusedmethods svl
Change-Id: If86cc43fda4d138cf7f678d81fa2b35f68f3c03b Reviewed-on: https://gerrit.libreoffice.org/17162 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--compilerplugins/clang/unusedmethods.cxx9
-rwxr-xr-xcompilerplugins/clang/unusedmethods.py35
-rw-r--r--editeng/source/items/xmlcnitm.cxx7
-rw-r--r--include/editeng/xmlcnitm.hxx2
-rw-r--r--include/svl/cintitem.hxx12
-rw-r--r--include/svl/ctypeitm.hxx2
-rw-r--r--include/svl/custritm.hxx2
-rw-r--r--include/svl/documentlockfile.hxx3
-rw-r--r--include/svl/eitem.hxx3
-rw-r--r--include/svl/int64item.hxx2
-rw-r--r--include/svl/intitem.hxx3
-rw-r--r--include/svl/poolitem.hxx1
-rw-r--r--include/svl/style.hxx3
-rw-r--r--include/svl/visitem.hxx3
-rw-r--r--svl/source/items/cenumitm.cxx8
-rw-r--r--svl/source/items/cintitem.cxx49
-rw-r--r--svl/source/items/custritm.cxx11
-rw-r--r--svl/source/items/int64item.cxx13
-rw-r--r--svl/source/items/intitem.cxx12
-rw-r--r--svl/source/items/poolitem.cxx6
-rw-r--r--svl/source/items/visitem.cxx8
21 files changed, 35 insertions, 159 deletions
diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx
index a137a216cfc6..6627fe90a0cc 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 2790408d89aa..27118b286c8b 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 785c6fe01b68..5ea505d86040 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 25df0a420cdc..c9725e4ad912 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 710e5e43e897..022b3c236bae 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 11a4e97f8129..83ca3e404de2 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 e8e321caf1e5..ab2b23ea13b2 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 944999450281..23403c85dbcd 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 d01ce77a3367..add2a5f87ce3 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 45e6a8aabd76..662b8e8f7768 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 12536c4c9de7..546084b7fbbc 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 06c7f7f6d323..57e9749c93d4 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 43849dd4977c..dafa95ecf30b 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 109b631f93fc..cceef2925629 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 a5525bedd27d..d7e88a905d99 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 0fde0d94003e..24fb8c755ca6 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 2ed6d6a4ba94..1182ae576adc 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 f884106aa3db..7875690b2c2f 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 e596d4a5a8f9..735648e787dd 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 ef6c7fe61ba3..f55d7a2712b1 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 a8a92cd80487..a73f5b00ed69 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,