From b14224fe97b8a44232c9c1401d3a49771f46582e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 2 Feb 2016 16:15:51 +0200 Subject: loplugin:unusedmethods using an idea from dtardon: noelgrandin, hi. could you try to run the unusedmethods clang plugin with "make build-nocheck"? that would catch functions that are only used in tests. e.g., i just removed the whole o3tl::range class, which has not been used in many years, but htere was a test for it... dtardon, interesting idea! Sure, I can do that. Change-Id: I5653953a426a2186a1e43017212d87ffce520387 Reviewed-on: https://gerrit.libreoffice.org/22041 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- sc/inc/address.hxx | 31 ------------------------------- sc/inc/bigrange.hxx | 2 -- sc/inc/chartpos.hxx | 2 -- sc/qa/unit/ucalc_sharedformula.cxx | 27 +++++++++++++++++++++++++-- sc/source/core/data/bcaslot.cxx | 24 ------------------------ sc/source/core/inc/bcaslot.hxx | 5 ----- sc/source/core/tool/chartpos.cxx | 7 ------- 7 files changed, 25 insertions(+), 73 deletions(-) (limited to 'sc') diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index 9853a40157d4..78498537e4fd 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -319,8 +319,6 @@ public: inline bool operator!=( const ScAddress& rAddress ) const; inline bool operator<( const ScAddress& rAddress ) const; inline bool operator<=( const ScAddress& rAddress ) const; - inline bool operator>( const ScAddress& rAddress ) const; - inline bool operator>=( const ScAddress& rAddress ) const; inline size_t hash() const; @@ -396,16 +394,6 @@ inline bool ScAddress::operator<=( const ScAddress& rAddress ) const return operator<( rAddress ) || operator==( rAddress ); } -inline bool ScAddress::operator>( const ScAddress& rAddress ) const -{ - return !operator<=( rAddress ); -} - -inline bool ScAddress::operator>=( const ScAddress& rAddress ) const -{ - return !operator<( rAddress ); -} - inline size_t ScAddress::hash() const { // Assume that there are not that many addresses with row > 2^16 AND column @@ -572,8 +560,6 @@ public: inline bool operator!=( const ScRange& rRange ) const; inline bool operator<( const ScRange& rRange ) const; inline bool operator<=( const ScRange& rRange ) const; - inline bool operator>( const ScRange& rRange ) const; - inline bool operator>=( const ScRange& rRange ) const; /// Hash 2D area ignoring table number. inline size_t hashArea() const; @@ -621,16 +607,6 @@ inline bool ScRange::operator<=( const ScRange& rRange ) const return operator<( rRange ) || operator==( rRange ); } -inline bool ScRange::operator>( const ScRange& rRange ) const -{ - return !operator<=( rRange ); -} - -inline bool ScRange::operator>=( const ScRange& rRange ) const -{ - return !operator<( rRange ); -} - inline bool ScRange::In( const ScAddress& rAddress ) const { return @@ -708,7 +684,6 @@ public: { return aRange[n]; } - inline bool operator==( const ScRangePair& ) const; }; inline ScRangePair& ScRangePair::operator= ( const ScRangePair& rRange ) @@ -718,12 +693,6 @@ inline ScRangePair& ScRangePair::operator= ( const ScRangePair& rRange ) return *this; } -inline bool ScRangePair::operator==( const ScRangePair& rRange ) const -{ - return (aRange[0] == rRange.aRange[0]) && - (aRange[1] == rRange.aRange[1]); -} - // ScRefAddress class ScRefAddress { diff --git a/sc/inc/bigrange.hxx b/sc/inc/bigrange.hxx index c677df19aa4a..9dfbe2e073df 100644 --- a/sc/inc/bigrange.hxx +++ b/sc/inc/bigrange.hxx @@ -69,8 +69,6 @@ public: { nCol = r.Col(); nRow = r.Row(); nTab = r.Tab(); return *this; } bool operator==( const ScBigAddress& r ) const { return nCol == r.nCol && nRow == r.nRow && nTab == r.nTab; } - bool operator!=( const ScBigAddress& r ) const - { return !operator==( r ); } }; inline void ScBigAddress::PutInOrder( ScBigAddress& r ) diff --git a/sc/inc/chartpos.hxx b/sc/inc/chartpos.hxx index 75e2e14bcadc..7bf2e556cfc9 100644 --- a/sc/inc/chartpos.hxx +++ b/sc/inc/chartpos.hxx @@ -133,8 +133,6 @@ public: bool HasColHeaders() const { return bColHeaders; } bool HasRowHeaders() const { return bRowHeaders; } - bool operator==(const ScChartPositioner& rCmp) const; - void InvalidateGlue() { eGlue = SC_CHARTGLUE_NA; diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 656bce67b436..ba4d8dd63f80 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -603,6 +603,29 @@ void Test::testSharedFormulasRefUpdateRange() m_pDoc->DeleteTab(0); } +struct SortByArea : std::binary_function +{ + bool operator ()( const sc::AreaListener& rLeft, const sc::AreaListener& rRight ) const + { + if (rLeft.maArea.aStart.Tab() != rRight.maArea.aStart.Tab()) + return rLeft.maArea.aStart.Tab() < rRight.maArea.aStart.Tab(); + + if (rLeft.maArea.aStart.Col() != rRight.maArea.aStart.Col()) + return rLeft.maArea.aStart.Col() < rRight.maArea.aStart.Col(); + + if (rLeft.maArea.aStart.Row() != rRight.maArea.aStart.Row()) + return rLeft.maArea.aStart.Row() < rRight.maArea.aStart.Row(); + + if (rLeft.maArea.aEnd.Tab() != rRight.maArea.aEnd.Tab()) + return rLeft.maArea.aEnd.Tab() < rRight.maArea.aEnd.Tab(); + + if (rLeft.maArea.aEnd.Col() != rRight.maArea.aEnd.Col()) + return rLeft.maArea.aEnd.Col() < rRight.maArea.aEnd.Col(); + + return rLeft.maArea.aEnd.Row() < rRight.maArea.aEnd.Row(); + } +}; + void Test::testSharedFormulasRefUpdateRangeDeleteRow() { sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc. @@ -630,7 +653,7 @@ void Test::testSharedFormulasRefUpdateRangeDeleteRow() ScBroadcastAreaSlotMachine* pBASM = m_pDoc->GetBASM(); CPPUNIT_ASSERT(pBASM); std::vector aListeners = pBASM->GetAllListeners(aWholeArea, sc::AreaInside); - std::sort(aListeners.begin(), aListeners.end(), sc::AreaListener::SortByArea()); + std::sort(aListeners.begin(), aListeners.end(), SortByArea()); // This check makes only sense if group listeners are activated. #if !defined(USE_FORMULA_GROUP_LISTENER) || USE_FORMULA_GROUP_LISTENER @@ -696,7 +719,7 @@ void Test::testSharedFormulasRefUpdateRangeDeleteRow() CPPUNIT_ASSERT_EQUAL(15.0, m_pDoc->GetValue(ScAddress(2,4,0))); aListeners = pBASM->GetAllListeners(aWholeArea, sc::AreaInside); - std::sort(aListeners.begin(), aListeners.end(), sc::AreaListener::SortByArea()); + std::sort(aListeners.begin(), aListeners.end(), SortByArea()); // This check makes only sense if group listeners are activated. #if !defined(USE_FORMULA_GROUP_LISTENER) || USE_FORMULA_GROUP_LISTENER diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx index 5fc786a089c4..6e9c640105be 100644 --- a/sc/source/core/data/bcaslot.cxx +++ b/sc/source/core/data/bcaslot.cxx @@ -64,30 +64,6 @@ #error BCA_SLOTS_DEFINE DOOMed! #endif -namespace sc { - -bool AreaListener::SortByArea::operator ()( const AreaListener& rLeft, const AreaListener& rRight ) const -{ - if (rLeft.maArea.aStart.Tab() != rRight.maArea.aStart.Tab()) - return rLeft.maArea.aStart.Tab() < rRight.maArea.aStart.Tab(); - - if (rLeft.maArea.aStart.Col() != rRight.maArea.aStart.Col()) - return rLeft.maArea.aStart.Col() < rRight.maArea.aStart.Col(); - - if (rLeft.maArea.aStart.Row() != rRight.maArea.aStart.Row()) - return rLeft.maArea.aStart.Row() < rRight.maArea.aStart.Row(); - - if (rLeft.maArea.aEnd.Tab() != rRight.maArea.aEnd.Tab()) - return rLeft.maArea.aEnd.Tab() < rRight.maArea.aEnd.Tab(); - - if (rLeft.maArea.aEnd.Col() != rRight.maArea.aEnd.Col()) - return rLeft.maArea.aEnd.Col() < rRight.maArea.aEnd.Col(); - - return rLeft.maArea.aEnd.Row() < rRight.maArea.aEnd.Row(); -} - -} - struct ScSlotData { SCROW nStartRow; // first row of this segment diff --git a/sc/source/core/inc/bcaslot.hxx b/sc/source/core/inc/bcaslot.hxx index 745fc0261a25..0f606d741173 100644 --- a/sc/source/core/inc/bcaslot.hxx +++ b/sc/source/core/inc/bcaslot.hxx @@ -43,11 +43,6 @@ struct AreaListener ScRange maArea; bool mbGroupListening; SvtListener* mpListener; - - struct SortByArea : std::binary_function - { - bool operator() ( const AreaListener& rLeft, const AreaListener& rRight ) const; - }; }; } diff --git a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx index c1f1c9859d9d..81b1d960ba47 100644 --- a/sc/source/core/tool/chartpos.cxx +++ b/sc/source/core/tool/chartpos.cxx @@ -89,13 +89,6 @@ ScChartPositioner::~ScChartPositioner() delete pPositionMap; } -bool ScChartPositioner::operator==(const ScChartPositioner& rCmp) const -{ - return bColHeaders == rCmp.bColHeaders - && bRowHeaders == rCmp.bRowHeaders - && *aRangeListRef == *rCmp.aRangeListRef; -} - void ScChartPositioner::SetRangeList( const ScRange& rRange ) { aRangeListRef = new ScRangeList; -- cgit