diff --git a/compilerplugins/clang/unusedmethods.py b/compilerplugins/clang/unusedmethods.py index fb2ad7f15029..d5c7946da822 100755 --- a/compilerplugins/clang/unusedmethods.py +++ b/compilerplugins/clang/unusedmethods.py @@ -178,16 +178,14 @@ 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]: - continue - # ignore the custom RTTI stuff - if ( ("::CreateType()" in d[1]) - or ("::IsA(" in d[1]) - or ("::Type()" in d[1])): - continue if isOtherConstness(d, callSet): continue + # include assigment operators, if we remove them, the compiler creates a default one, which can have odd consequences + if "::operator=(" in d[1]: + continue + # 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. if d[1] == "begin() const" or d[1] == "begin()" or d[1] == "end()" or d[1] == "end() const": @@ -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 &" and d[1].startswith("operator<<(basic_ostreamStartsAfter(rPos); } -#ifdef DBG_UTIL - bool operator()(std::shared_ptr const& pMark, - SwPosition const& rPos) - { - return pMark->StartsBefore(rPos); - } - bool operator()(std::shared_ptr const& pMark1, - std::shared_ptr 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 const& pMark) - { - return pMark->StartsAfter(rPos); - } - bool operator()(std::shared_ptr const& pMark1, - std::shared_ptr const& pMark2) - { - return (*pMark1) < (*pMark2); - } -#endif }; OUString ExpandFieldmark(IFieldmark* pBM); diff --git a/sw/inc/SwNumberTree.hxx b/sw/inc/SwNumberTree.hxx index 6a00a2c6bd52..6ed4db6d1031 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 01d7ee14335c..d6101cc84e66 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 5218faf4231d..c54712abc765 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 67991490ff43..20e891a18718 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 maVector; }; diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx index 0ac5922a24a3..b31d1fc6db5d 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 374c55bdc8d3..341e560109c3 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 9f658b4c9c46..f9e51d8f4dbc 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 72d590928201..6b3c2f5b12ff 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 aaf05488be86..07644cfecf36 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 129e358053da..38dbe06aacab 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 b6e4cd1c76d4..6bc07fe80c3c 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 936245a4550f..07dc0e516fe6 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 520500047ef9..e0d08de2621c 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 3413a4a6ab0d..0b73cbac9b3d 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 d9beba2cb693..00b624a1b408 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(pPor) < reinterpret_cast(rBlinkPortion.pPor); } - bool operator==( const SwBlinkPortion& rBlinkPortion ) const - { return reinterpret_cast(pPor) == reinterpret_cast(rBlinkPortion.pPor); } }; typedef std::set, diff --git a/sw/source/core/inc/docsort.hxx b/sw/source/core/inc/docsort.hxx index 54e94bbecdeb..a7a01911c0e4 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 427802c2713e..f1379568b037 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 90bbb59bbccb..53127ee14b5a 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 cf46070c3b71..4332bb0c2a77 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 bf42b0f5ee46..49df7cfc6a13 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 90c7e57a6751..b4632ba4ae1e 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 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 xConnection, const OUString& rTableName) { @@ -791,21 +771,6 @@ sal_Int32 SwDBManager::GetRowCount(uno::Reference xConnection -sal_Int32 SwDBManager::GetRowCount() const -{ - sal_Int32 nCnt = pImpl->pMergeData->aSelection.getLength(); - - if(nCnt == 0) - { - uno::Reference xProp(pImpl->pMergeData->xResultSet, uno::UNO_QUERY); - if(xProp.is()) - xProp->getPropertyValue("RowCount") >>= nCnt; - } - - return nCnt; -} - - SwDBManager::SwDBManager(SwDoc* pDoc) : bCancel(false) , bInitDBFields(false)