diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-09-15 19:13:19 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-09-17 09:05:38 +0200 |
commit | 206b5b2661be37efdff3c6aedb6f248c4636be79 (patch) | |
tree | af385e5b4725dcfea23988d9113cced8e9ccaf3c /sw/source/core/unocore | |
parent | a85d3ba1c0de313b60324b9ecfa488bb99d69d06 (diff) |
New loplugin:external
...warning about (for now only) functions and variables with external linkage
that likely don't need it.
The problems with moving entities into unnamed namespacs and breaking ADL
(as alluded to in comments in compilerplugins/clang/external.cxx) are
illustrated by the fact that while
struct S1 { int f() { return 0; } };
int f(S1 s) { return s.f(); }
namespace N {
struct S2: S1 { int f() { return 1; } };
int f(S2 s) { return s.f(); }
}
int main() { return f(N::S2()); }
returns 1, both moving just the struct S2 into an nunnamed namespace,
struct S1 { int f() { return 0; } };
int f(S1 s) { return s.f(); }
namespace N {
namespace { struct S2: S1 { int f() { return 1; } }; }
int f(S2 s) { return s.f(); }
}
int main() { return f(N::S2()); }
as well as moving just the function f overload into an unnamed namespace,
struct S1 { int f() { return 0; } };
int f(S1 s) { return s.f(); }
namespace N {
struct S2: S1 { int f() { return 1; } };
namespace { int f(S2 s) { return s.f(); } }
}
int main() { return f(N::S2()); }
would each change the program to return 0 instead.
Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c
Reviewed-on: https://gerrit.libreoffice.org/60539
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r-- | sw/source/core/unocore/unofield.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unoidx.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unosett.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 2 |
6 files changed, 13 insertions, 13 deletions
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 05d70e6d5807..b6335a7b6a36 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -317,7 +317,7 @@ static sal_Int32 lcl_PropName2TokenPos(const OUString& rPropertyName) return SAL_MAX_INT32; } -sal_uInt16 GetFieldTypeMId( const OUString& rProperty, const SwFieldType& rTyp ) +static sal_uInt16 GetFieldTypeMId( const OUString& rProperty, const SwFieldType& rTyp ) { sal_uInt16 nId = lcl_GetPropMapIdForFieldType( rTyp.Which() ); const SfxItemPropertySet* pSet = aSwMapProvider.GetPropertySet( nId ); diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index aded66619adf..9f5a070d4611 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -105,7 +105,7 @@ lcl_AnyToBool(uno::Any const& rVal) /// @throws lang::IllegalArgumentException template<typename T> -void lcl_AnyToBitMask(uno::Any const& rValue, +static void lcl_AnyToBitMask(uno::Any const& rValue, T & rBitMask, const T nBit) { rBitMask = lcl_AnyToBool(rValue) @@ -114,7 +114,7 @@ void lcl_AnyToBitMask(uno::Any const& rValue, } template<typename T> -void lcl_BitMaskToAny(uno::Any & o_rValue, +static void lcl_BitMaskToAny(uno::Any & o_rValue, const T nBitMask, const T nBit) { const bool bRet(nBitMask & nBit); @@ -1230,7 +1230,7 @@ SwXDocumentIndex::removeVetoableChangeListener( OSL_FAIL("SwXDocumentIndex::removeVetoableChangeListener(): not implemented"); } -void lcl_CalcLayout(SwDoc *pDoc) +static void lcl_CalcLayout(SwDoc *pDoc) { SwViewShell *pViewShell = nullptr; SwEditShell* pEditShell = nullptr; diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index c1c91b365bf0..fdd42ce4c99f 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -1764,7 +1764,7 @@ void SwUnoCursorHelper::SetPropertyValue( // SwUnoCursorHelper::SetTextFormatColl, instead of extending item set. // We need to get them from nodes in next call to GetCursorAttr. // The rest could cause similar problems in theory, so we just list them here. -inline bool propertyCausesSideEffectsInNodes(sal_uInt16 nWID) +static inline bool propertyCausesSideEffectsInNodes(sal_uInt16 nWID) { return nWID == FN_UNO_PARA_STYLE || nWID == FN_UNO_CHARFMT_SEQUENCE || diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index c1b1529534a7..ee146bb68d7f 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -111,7 +111,7 @@ namespace #define WID_BEGIN_NOTICE 10 #define WID_ANCHOR_CHARACTER_STYLE 11 -const SfxItemPropertySet* GetFootnoteSet() +static const SfxItemPropertySet* GetFootnoteSet() { static const SfxItemPropertyMapEntry aFootnoteMap_Impl[] = { @@ -133,7 +133,7 @@ const SfxItemPropertySet* GetFootnoteSet() return &aFootnoteSet_Impl; } -const SfxItemPropertySet* GetEndnoteSet() +static const SfxItemPropertySet* GetEndnoteSet() { static const SfxItemPropertyMapEntry aEndnoteMap_Impl[] = { @@ -151,7 +151,7 @@ const SfxItemPropertySet* GetEndnoteSet() return &aEndnoteSet_Impl; } -const SfxItemPropertySet* GetNumberingRulesSet() +static const SfxItemPropertySet* GetNumberingRulesSet() { static const SfxItemPropertyMapEntry aNumberingRulesMap_Impl[] = { @@ -178,7 +178,7 @@ const SfxItemPropertySet* GetNumberingRulesSet() #define WID_COUNT_LINES_IN_FRAMES 9 #define WID_RESTART_AT_EACH_PAGE 10 -const SfxItemPropertySet* GetLineNumberingSet() +static const SfxItemPropertySet* GetLineNumberingSet() { static const SfxItemPropertyMapEntry aLineNumberingMap_Impl[] = { diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index e58c1f01e535..db28a9ad84f8 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1560,7 +1560,7 @@ const SwPageDesc* SwStyleBase_Impl::GetOldPageDesc() -sal_uInt8 lcl_TranslateMetric(const SfxItemPropertySimpleEntry& rEntry, SwDoc* pDoc, uno::Any& o_aValue) +static sal_uInt8 lcl_TranslateMetric(const SfxItemPropertySimpleEntry& rEntry, SwDoc* pDoc, uno::Any& o_aValue) { // check for needed metric translation if(!(rEntry.nMoreFlags & PropertyMoreFlags::METRIC_ITEM)) @@ -2458,7 +2458,7 @@ beans::PropertyState SwXStyle::getPropertyState(const OUString& rPropertyName) // allow to retarget the SfxItemSet working on, default correctly. Only // use pSourceSet below this point (except in header/footer processing) -const SfxItemSet* lcl_GetItemsetForProperty(const SfxItemSet& rSet, SfxStyleFamily eFamily, const OUString& rPropertyName) +static const SfxItemSet* lcl_GetItemsetForProperty(const SfxItemSet& rSet, SfxStyleFamily eFamily, const OUString& rPropertyName) { if(eFamily != SfxStyleFamily::Page) return &rSet; @@ -2572,7 +2572,7 @@ void SwXStyle::setPropertyToDefault(const OUString& rPropertyName) setPropertiesToDefault(aSequence); } -SwFormat* lcl_GetFormatForStyle(SwDoc const * pDoc, const rtl::Reference<SwDocStyleSheet>& xStyle, const SfxStyleFamily eFamily) +static SwFormat* lcl_GetFormatForStyle(SwDoc const * pDoc, const rtl::Reference<SwDocStyleSheet>& xStyle, const SfxStyleFamily eFamily) { if(!xStyle.is()) return nullptr; diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 7f832ac8e0d4..9725815c5ed0 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -532,7 +532,7 @@ OUString sw_GetCellName( sal_Int32 nColumn, sal_Int32 nRow ) @param i_bTopLeft if true, find top left box, otherwise find bottom right box */ -const SwTableBox* lcl_FindCornerTableBox(const SwTableLines& rTableLines, const bool i_bTopLeft) +static const SwTableBox* lcl_FindCornerTableBox(const SwTableLines& rTableLines, const bool i_bTopLeft) { const SwTableLines* pLines(&rTableLines); while(true) |