[Libreoffice-commits] core.git: compilerplugins/clang sw/inc sw/source
Noel Grandin
noel at peralex.com
Tue Jan 19 01:02:30 PST 2016
compilerplugins/clang/unusedmethods.py | 28 ++++++++++++--------------
sw/inc/IMark.hxx | 24 ----------------------
sw/inc/SwNumberTree.hxx | 13 ------------
sw/inc/acmplwrd.hxx | 3 --
sw/inc/dbmgr.hxx | 4 ---
sw/inc/edimp.hxx | 2 -
sw/inc/fmtcol.hxx | 2 -
sw/inc/lineinfo.hxx | 1
sw/inc/ndindex.hxx | 12 -----------
sw/inc/redline.hxx | 3 --
sw/inc/tabcol.hxx | 1
sw/inc/tblafmt.hxx | 1
sw/source/core/bastyp/tabcol.cxx | 21 -------------------
sw/source/core/doc/docredln.cxx | 5 ----
sw/source/core/doc/docsort.cxx | 5 ----
sw/source/core/doc/lineinfo.cxx | 15 --------------
sw/source/core/inc/blink.hxx | 2 -
sw/source/core/inc/docsort.hxx | 1
sw/source/core/inc/noteurl.hxx | 2 -
sw/source/core/inc/swblocks.hxx | 1
sw/source/core/text/porlin.hxx | 9 --------
sw/source/filter/html/htmlfly.hxx | 1
sw/source/uibase/dbui/dbmgr.cxx | 35 ---------------------------------
23 files changed, 13 insertions(+), 178 deletions(-)
New commits:
commit 5fe99ea3ee7b33a80f1419f2a4c9c1ea56dd00ee
Author: Noel Grandin <noel at peralex.com>
Date: Tue Jan 19 09:40:25 2016 +0200
loplugin:unusedmethods in sw/
Change-Id: Id452bfac5c83f130a138e06984a0c79c37af70ac
diff --git a/compilerplugins/clang/unusedmethods.py b/compilerplugins/clang/unusedmethods.py
index fb2ad7f..d5c7946 100755
--- a/compilerplugins/clang/unusedmethods.py
+++ b/compilerplugins/clang/unusedmethods.py
@@ -178,15 +178,13 @@ for d in definitionSet:
continue
if d in callSet:
continue
- # ignore operators, they are normally called from inside STL code
- if "::operator" in d[1]:
+ if isOtherConstness(d, callSet):
continue
- # ignore the custom RTTI stuff
- if ( ("::CreateType()" in d[1])
- or ("::IsA(" in d[1])
- or ("::Type()" in d[1])):
+ # include assigment operators, if we remove them, the compiler creates a default one, which can have odd consequences
+ if "::operator=(" in d[1]:
continue
- if isOtherConstness(d, callSet):
+ # these are only invoked implicitly, so the plugin does not see the calls
+ if "::operator new(" in d[1] or "::operator delete(" in d[1]:
continue
# just ignore iterators, they normally occur in pairs, and we typically want to leave one constness version alone
# alone if the other one is in use.
@@ -198,9 +196,6 @@ for d in definitionSet:
# used by Windows build
if any(x in d[1] for x in ["DdeTopic::", "DdeData::", "DdeService::", "DdeTransaction::", "DdeConnection::", "DdeLink::", "DdeItem::", "DdeGetPutItem::"]):
continue
- # the include/tools/rtti.hxx stuff
- if ("::StaticType()" in d[1]) or ("::IsOf(void *(*)(void))" in d[1]):
- continue
# too much template magic here for my plugin
if ( ("cairocanvas::" in d[1])
or ("canvas::" in d[1])
@@ -231,6 +226,9 @@ for d in definitionSet:
continue
if d[0] == "basic_ostream<type-parameter-?-?, type-parameter-?-?> &" and d[1].startswith("operator<<(basic_ostream<type-parameter-?-?"):
continue
+ # ignore the SfxPoolItem CreateDefault methods for now
+ if d[1].endswith("::CreateDefault()"):
+ continue
tmp1set.add((clazz, definitionToSourceLocationMap[d]))
@@ -243,10 +241,10 @@ def natural_sort_key(s, _nsre=re.compile('([0-9]+)')):
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]
-
+for t in tmp1list:
+ print t[1]
+ print " ", t[0]
+sys.exit(0)
# -------------------------------------------
# Do the "unused return types" part
@@ -279,7 +277,7 @@ for d in definitionSet:
if definitionToSourceLocationMap[d].startswith("external/"):
continue
# ignore the SfxPoolItem CreateDefault methods for now
- if "::CreateDefault" in d[1]:
+ if d[1].endswith("::CreateDefault()"):
continue
tmp2set.add((clazz, definitionToSourceLocationMap[d]))
diff --git a/sw/inc/IMark.hxx b/sw/inc/IMark.hxx
index 5f891b8..0a8860e 100644
--- a/sw/inc/IMark.hxx
+++ b/sw/inc/IMark.hxx
@@ -137,18 +137,6 @@ namespace sw { namespace mark
{
return pMark->StartsAfter(rPos);
}
-#ifdef DBG_UTIL
- bool operator()(std::shared_ptr<sw::mark::IMark> const& pMark,
- SwPosition const& rPos)
- {
- return pMark->StartsBefore(rPos);
- }
- bool operator()(std::shared_ptr<sw::mark::IMark> const& pMark1,
- std::shared_ptr<sw::mark::IMark> const& pMark2)
- {
- return (*pMark1) < (*pMark2);
- }
-#endif
};
// MSVC 2008 with _DEBUG calls this with parameters in wrong order
@@ -160,18 +148,6 @@ namespace sw { namespace mark
{
return pMark->StartsBefore(rPos);
}
-#ifdef DBG_UTIL
- bool operator()(SwPosition const& rPos,
- std::shared_ptr<sw::mark::IMark> const& pMark)
- {
- return pMark->StartsAfter(rPos);
- }
- bool operator()(std::shared_ptr<sw::mark::IMark> const& pMark1,
- std::shared_ptr<sw::mark::IMark> const& pMark2)
- {
- return (*pMark1) < (*pMark2);
- }
-#endif
};
OUString ExpandFieldmark(IFieldmark* pBM);
diff --git a/sw/inc/SwNumberTree.hxx b/sw/inc/SwNumberTree.hxx
index 6a00a2c..6ed4db6 100644
--- a/sw/inc/SwNumberTree.hxx
+++ b/sw/inc/SwNumberTree.hxx
@@ -655,19 +655,6 @@ protected:
};
-/**
- Functor. Checks if a certain node is less than the functor's member.
- */
-struct SwNumberTreeNodeIsLessThan
-{
- const SwNumberTreeNode * pNode;
-
- SwNumberTreeNodeIsLessThan(const SwNumberTreeNode * _pNode)
- : pNode(_pNode) {}
-
- bool operator()(const SwNumberTreeNode * _pNode) const
- { return SwNumberTreeNodeLessThan(_pNode, pNode); }
-};
#endif // INCLUDED_SW_INC_SWNUMBERTREE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/acmplwrd.hxx b/sw/inc/acmplwrd.hxx
index 01d7ee1..d6101cc 100644
--- a/sw/inc/acmplwrd.hxx
+++ b/sw/inc/acmplwrd.hxx
@@ -54,9 +54,6 @@ public:
bool InsertWord( const OUString& rWord, SwDoc& rDoc );
- const OUString& operator[](size_t n) const
- { return m_WordList[n]->GetAutoCompleteString(); }
-
bool IsLockWordLstLocked() const { return bLockWordLst; }
void SetLockWordLstLocked( bool bFlag ) { bLockWordLst = bFlag; }
diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index 5218faf..c54712a 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -352,13 +352,9 @@ public:
SvNumberFormatter* pNFormatr,
long nLanguage );
- sal_Int32 GetRowCount(const OUString& rDBName, const OUString& rTableName);
-
static sal_Int32 GetRowCount(css::uno::Reference< css::sdbc::XConnection> xConnection,
const OUString& rTableName);
- sal_Int32 GetRowCount() const;
-
sal_uLong GetColumnFormat( const OUString& rDBName,
const OUString& rTableName,
const OUString& rColNm,
diff --git a/sw/inc/edimp.hxx b/sw/inc/edimp.hxx
index 6799149..20e891a 100644
--- a/sw/inc/edimp.hxx
+++ b/sw/inc/edimp.hxx
@@ -49,8 +49,6 @@ public:
size_t Count() const
{ return maVector.size(); }
- SwPamRange operator[]( size_t nPos ) const
- { return maVector[nPos]; }
private:
o3tl::sorted_vector<SwPamRange> maVector;
};
diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx
index 0ac5922..b31d1fc 100644
--- a/sw/inc/fmtcol.hxx
+++ b/sw/inc/fmtcol.hxx
@@ -197,8 +197,6 @@ private:
public:
bool operator==( const SwCollCondition& rCmp ) const;
- bool operator!=( const SwCollCondition& rCmp ) const
- { return ! (*this == rCmp); }
sal_uLong GetCondition() const { return m_nCondition; }
sal_uLong GetSubCondition() const { return m_aSubCondition.nSubCondition; }
diff --git a/sw/inc/lineinfo.hxx b/sw/inc/lineinfo.hxx
index 374c55b..341e560 100644
--- a/sw/inc/lineinfo.hxx
+++ b/sw/inc/lineinfo.hxx
@@ -57,7 +57,6 @@ public:
SwLineNumberInfo(const SwLineNumberInfo&);
SwLineNumberInfo& operator=(const SwLineNumberInfo&);
- bool operator==( const SwLineNumberInfo& rInf ) const;
SwCharFormat *GetCharFormat( IDocumentStylePoolAccess& rIDSPA ) const;
void SetCharFormat( SwCharFormat* );
diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx
index 9f658b4..f9e51d8 100644
--- a/sw/inc/ndindex.hxx
+++ b/sw/inc/ndindex.hxx
@@ -89,8 +89,6 @@ public:
inline sal_uLong operator+=( sal_uLong );
inline sal_uLong operator-=( sal_uLong );
- inline sal_uLong operator+=( const SwNodeIndex& );
- inline sal_uLong operator-=( const SwNodeIndex& );
inline bool operator< ( const SwNodeIndex& ) const;
inline bool operator<=( const SwNodeIndex& ) const;
@@ -248,16 +246,6 @@ inline sal_uLong SwNodeIndex::operator-=( sal_uLong const nOffset )
m_pNode = GetNodes()[ m_pNode->GetIndex() - nOffset ];
return m_pNode->GetIndex();
}
-inline sal_uLong SwNodeIndex::operator+=( const SwNodeIndex& rIndex )
-{
- m_pNode = GetNodes()[ m_pNode->GetIndex() + rIndex.GetIndex() ];
- return m_pNode->GetIndex();
-}
-inline sal_uLong SwNodeIndex::operator-=( const SwNodeIndex& rIndex )
-{
- m_pNode = GetNodes()[ m_pNode->GetIndex() - rIndex.GetIndex() ];
- return m_pNode->GetIndex();
-}
inline SwNodeIndex& SwNodeIndex::operator=( sal_uLong const nNew )
{
diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index 72d5909..6b3c2f5 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -227,8 +227,6 @@ public:
bool HasValidRange() const;
const SwRedlineData& GetRedlineData(sal_uInt16 nPos = 0) const;
- bool operator==( const SwRedlineData& rCmp ) const
- { return *pRedlineData == rCmp; }
bool operator!=( const SwRedlineData& rCmp ) const
{ return *pRedlineData != rCmp; }
void SetAutoFormatFlag() { pRedlineData->SetAutoFormatFlag(); }
@@ -292,7 +290,6 @@ public:
*/
OUString GetDescr(sal_uInt16 nPos = 0);
- bool operator==( const SwRangeRedline& ) const;
bool operator<( const SwRangeRedline& ) const;
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
};
diff --git a/sw/inc/tabcol.hxx b/sw/inc/tabcol.hxx
index aaf0548..07644cf 100644
--- a/sw/inc/tabcol.hxx
+++ b/sw/inc/tabcol.hxx
@@ -59,7 +59,6 @@ public:
SwTabCols( sal_uInt16 nSize = 0 );
SwTabCols( const SwTabCols& );
SwTabCols &operator=( const SwTabCols& );
- bool operator==( const SwTabCols& rCmp ) const;
long& operator[]( size_t nPos ) { return aData[nPos].nPos; }
long operator[]( size_t nPos ) const { return aData[nPos].nPos; }
size_t Count() const { return aData.size(); }
diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
index 129e358..38dbe06 100644
--- a/sw/inc/tblafmt.hxx
+++ b/sw/inc/tblafmt.hxx
@@ -115,7 +115,6 @@ public:
SwBoxAutoFormat( const SwBoxAutoFormat& rNew );
~SwBoxAutoFormat();
- int operator==( const SwBoxAutoFormat& rCmp ) const;
SwBoxAutoFormat& operator=( const SwBoxAutoFormat& rNew );
// The get-methods.
diff --git a/sw/source/core/bastyp/tabcol.cxx b/sw/source/core/bastyp/tabcol.cxx
index b6e4cd1..6bc07fe 100644
--- a/sw/source/core/bastyp/tabcol.cxx
+++ b/sw/source/core/bastyp/tabcol.cxx
@@ -55,27 +55,6 @@ SwTabCols &SwTabCols::operator=( const SwTabCols& rCpy )
return *this;
}
-bool SwTabCols::operator==( const SwTabCols& rCmp ) const
-{
- if ( !(nLeftMin == rCmp.GetLeftMin() &&
- nLeft == rCmp.GetLeft() &&
- nRight == rCmp.GetRight() &&
- nRightMax== rCmp.GetRightMax()&&
- bLastRowAllowedToChange== rCmp.IsLastRowAllowedToChange() &&
- Count()== rCmp.Count()) )
- return false;
-
- for ( size_t i = 0; i < Count(); ++i )
- {
- SwTabColsEntry aEntry1 = aData[i];
- SwTabColsEntry aEntry2 = rCmp.GetData()[i];
- if ( aEntry1.nPos != aEntry2.nPos || aEntry1.bHidden != aEntry2.bHidden )
- return false;
- }
-
- return true;
-}
-
void SwTabCols::Insert( long nValue, long nMin, long nMax,
bool bValue, size_t nPos )
{
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 936245a..07dc0e5 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1554,11 +1554,6 @@ const OUString& SwRangeRedline::GetComment( sal_uInt16 nPos ) const
return GetRedlineData(nPos).sComment;
}
-bool SwRangeRedline::operator==( const SwRangeRedline& rCmp ) const
-{
- return this == &rCmp;
-}
-
bool SwRangeRedline::operator<( const SwRangeRedline& rCmp ) const
{
if (*Start() < *rCmp.Start())
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index 5205000..e0d08de 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -158,11 +158,6 @@ int SwSortElement::keycompare(const SwSortElement& rCmp, sal_uInt16 nKey) const
return nCmp;
}
-bool SwSortElement::operator==(const SwSortElement& ) const
-{
- return false;
-}
-
bool SwSortElement::operator<(const SwSortElement& rCmp) const
{
// The actual comparison
diff --git a/sw/source/core/doc/lineinfo.cxx b/sw/source/core/doc/lineinfo.cxx
index 3413a4a..0b73cba 100644
--- a/sw/source/core/doc/lineinfo.cxx
+++ b/sw/source/core/doc/lineinfo.cxx
@@ -101,21 +101,6 @@ SwLineNumberInfo& SwLineNumberInfo::operator=(const SwLineNumberInfo &rCpy)
return *this;
}
-bool SwLineNumberInfo::operator==( const SwLineNumberInfo& rInf ) const
-{
- return GetRegisteredIn() == rInf.GetRegisteredIn() &&
- aType.GetNumberingType() == rInf.GetNumType().GetNumberingType() &&
- aDivider == rInf.GetDivider() &&
- nPosFromLeft == rInf.GetPosFromLeft() &&
- nCountBy == rInf.GetCountBy() &&
- nDividerCountBy == rInf.GetDividerCountBy() &&
- ePos == rInf.GetPos() &&
- bPaintLineNumbers == rInf.IsPaintLineNumbers() &&
- bCountBlankLines == rInf.IsCountBlankLines() &&
- bCountInFlys == rInf.IsCountInFlys() &&
- bRestartEachPage == rInf.IsRestartEachPage();
-}
-
SwCharFormat* SwLineNumberInfo::GetCharFormat( IDocumentStylePoolAccess& rIDSPA ) const
{
if ( !GetRegisteredIn() )
diff --git a/sw/source/core/inc/blink.hxx b/sw/source/core/inc/blink.hxx
index d9beba2..00b624a 100644
--- a/sw/source/core/inc/blink.hxx
+++ b/sw/source/core/inc/blink.hxx
@@ -60,8 +60,6 @@ public:
sal_uInt16 GetDirection() const { return nDir; }
bool operator<( const SwBlinkPortion& rBlinkPortion ) const
{ return reinterpret_cast<sal_IntPtr>(pPor) < reinterpret_cast<sal_IntPtr>(rBlinkPortion.pPor); }
- bool operator==( const SwBlinkPortion& rBlinkPortion ) const
- { return reinterpret_cast<sal_IntPtr>(pPor) == reinterpret_cast<sal_IntPtr>(rBlinkPortion.pPor); }
};
typedef std::set<std::unique_ptr<SwBlinkPortion>,
diff --git a/sw/source/core/inc/docsort.hxx b/sw/source/core/inc/docsort.hxx
index 54e94bb..a7a0191 100644
--- a/sw/source/core/inc/docsort.hxx
+++ b/sw/source/core/inc/docsort.hxx
@@ -82,7 +82,6 @@ struct SwSortElement
virtual OUString GetKey(sal_uInt16 nKey ) const = 0;
virtual double GetValue(sal_uInt16 nKey ) const;
- bool operator==(const SwSortElement& ) const;
bool operator<(const SwSortElement& ) const;
static double StrToDouble(const OUString& rStr);
diff --git a/sw/source/core/inc/noteurl.hxx b/sw/source/core/inc/noteurl.hxx
index 427802c..f137956 100644
--- a/sw/source/core/inc/noteurl.hxx
+++ b/sw/source/core/inc/noteurl.hxx
@@ -41,8 +41,6 @@ public:
const OUString& GetURL() const { return aURL; }
const OUString& GetTarget() const { return aTarget; }
const SwRect& GetRect() const { return aRect; }
- bool operator==( const SwURLNote& rSwURLNote ) const
- { return aRect == rSwURLNote.aRect; }
};
class SwNoteURL
diff --git a/sw/source/core/inc/swblocks.hxx b/sw/source/core/inc/swblocks.hxx
index 90bbb59..53127ee 100644
--- a/sw/source/core/inc/swblocks.hxx
+++ b/sw/source/core/inc/swblocks.hxx
@@ -43,7 +43,6 @@ public:
SwBlockName( const OUString& rShort, const OUString& rLong, const OUString& rPackageName );
/// For sorting in the array
- bool operator==( const SwBlockName& r ) const { return aShort == r.aShort; }
bool operator< ( const SwBlockName& r ) const { return aShort < r.aShort; }
};
diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx
index cf46070..4332bb0 100644
--- a/sw/source/core/text/porlin.hxx
+++ b/sw/source/core/text/porlin.hxx
@@ -80,7 +80,6 @@ public:
// Access methods
inline SwLinePortion *GetPortion() const { return pPortion; }
inline SwLinePortion &operator=(const SwLinePortion &rPortion);
- inline bool operator==( const SwLinePortion &rPortion ) const;
inline sal_Int32 GetLen() const { return nLineLength; }
inline void SetLen( const sal_Int32 nLen ) { nLineLength = nLen; }
inline void SetPortion( SwLinePortion *pNew ){ pPortion = pNew; }
@@ -193,14 +192,6 @@ inline SwLinePortion &SwLinePortion::operator=(const SwLinePortion &rPortion)
return *this;
}
-inline bool SwLinePortion::operator==(const SwLinePortion &rPortion ) const
-{
- return( Height() == rPortion.Height() &&
- Width() == rPortion.Width() &&
- nLineLength == rPortion.GetLen() &&
- nAscent == rPortion.GetAscent() );
-}
-
inline SwLinePortion::SwLinePortion(const SwLinePortion &rPortion) :
SwPosSize( rPortion ),
pPortion( nullptr ),
diff --git a/sw/source/filter/html/htmlfly.hxx b/sw/source/filter/html/htmlfly.hxx
index bf42b0f..49df7cf 100644
--- a/sw/source/filter/html/htmlfly.hxx
+++ b/sw/source/filter/html/htmlfly.hxx
@@ -96,7 +96,6 @@ public:
SwHTMLPosFlyFrame( const SwPosFlyFrame& rPosFly,
const SdrObject *pSdrObj, sal_uInt8 nOutMode );
- bool operator==( const SwHTMLPosFlyFrame& ) const { return false; }
bool operator<( const SwHTMLPosFlyFrame& ) const;
const SwFrameFormat& GetFormat() const { return *pFrameFormat; }
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 90c7e57..b4632ba 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -757,26 +757,6 @@ void SwDBManager::GetColumnNames(ListBox* pListBox,
}
-sal_Int32 SwDBManager::GetRowCount(const OUString& rDBName, const OUString& rTableName)
-{
- SwDBData aData;
- aData.sDataSource = rDBName;
- aData.sCommand = rTableName;
- aData.nCommandType = -1;
- SwDSParam* pParam = FindDSData(aData, false);
- uno::Reference<sdbc::XConnection> xConnection;
- if(pParam && pParam->xConnection.is())
- xConnection = pParam->xConnection;
- else
- {
- OUString sDBName(rDBName);
- xConnection = RegisterConnection( sDBName );
- }
-
- return GetRowCount(xConnection, rTableName);
-}
-
-
sal_Int32 SwDBManager::GetRowCount(uno::Reference<sdbc::XConnection> xConnection,
const OUString& rTableName)
{
@@ -791,21 +771,6 @@ sal_Int32 SwDBManager::GetRowCount(uno::Reference<sdbc::XConnection> xConnection
-sal_Int32 SwDBManager::GetRowCount() const
-{
- sal_Int32 nCnt = pImpl->pMergeData->aSelection.getLength();
-
- if(nCnt == 0)
- {
- uno::Reference<beans::XPropertySet> xProp(pImpl->pMergeData->xResultSet, uno::UNO_QUERY);
- if(xProp.is())
- xProp->getPropertyValue("RowCount") >>= nCnt;
- }
-
- return nCnt;
-}
-
-
SwDBManager::SwDBManager(SwDoc* pDoc)
: bCancel(false)
, bInitDBFields(false)
More information about the Libreoffice-commits
mailing list