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 /framework | |
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 'framework')
7 files changed, 16 insertions, 16 deletions
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index 0d931fbc0f66..3fd201ddeaf3 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -59,7 +59,7 @@ namespace framework const char CFG_ENTRY_SECONDARY[] = "SecondaryKeys"; const char CFG_PROP_COMMAND[] = "Command"; - OUString lcl_getKeyString(const css::awt::KeyEvent& aKeyEvent) + static OUString lcl_getKeyString(const css::awt::KeyEvent& aKeyEvent) { const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of a identifier... OUStringBuffer sKeyBuffer((KeyMapping::get().mapCodeToIdentifier(aKeyEvent.KeyCode)).copy(nBeginIndex)); @@ -664,7 +664,7 @@ css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfigurati return comphelper::containerToSequence(lKeys); } -AcceleratorCache::TKeyList::const_iterator lcl_getPreferredKey(const AcceleratorCache::TKeyList& lKeys) +static AcceleratorCache::TKeyList::const_iterator lcl_getPreferredKey(const AcceleratorCache::TKeyList& lKeys) { AcceleratorCache::TKeyList::const_iterator pIt; for ( pIt = lKeys.begin (); diff --git a/framework/source/fwe/helper/actiontriggerhelper.cxx b/framework/source/fwe/helper/actiontriggerhelper.cxx index b672a497635e..8d00b23a9e6e 100644 --- a/framework/source/fwe/helper/actiontriggerhelper.cxx +++ b/framework/source/fwe/helper/actiontriggerhelper.cxx @@ -44,7 +44,7 @@ namespace framework // implementation helper ( menu => ActionTrigger ) -bool IsSeparator( const Reference< XPropertySet >& xPropertySet ) +static bool IsSeparator( const Reference< XPropertySet >& xPropertySet ) { Reference< XServiceInfo > xServiceInfo( xPropertySet, UNO_QUERY ); try @@ -58,7 +58,7 @@ bool IsSeparator( const Reference< XPropertySet >& xPropertySet ) return false; } -void GetMenuItemAttributes( const Reference< XPropertySet >& xActionTriggerPropertySet, +static void GetMenuItemAttributes( const Reference< XPropertySet >& xActionTriggerPropertySet, OUString& aMenuLabel, OUString& aCommandURL, OUString& aHelpURL, @@ -94,7 +94,7 @@ void GetMenuItemAttributes( const Reference< XPropertySet >& xActionTriggerPrope } } -void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, const Reference< XIndexContainer >& xActionTriggerContainer ) +static void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, const Reference< XIndexContainer >& xActionTriggerContainer ) { if ( xActionTriggerContainer.is() ) { @@ -236,7 +236,7 @@ void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, const Reference< X // implementation helper ( ActionTrigger => menu ) /// @throws RuntimeException -Reference< XPropertySet > CreateActionTrigger( sal_uInt16 nItemId, const Menu* pMenu, const Reference< XIndexContainer >& rActionTriggerContainer ) +static Reference< XPropertySet > CreateActionTrigger( sal_uInt16 nItemId, const Menu* pMenu, const Reference< XIndexContainer >& rActionTriggerContainer ) { Reference< XPropertySet > xPropSet; @@ -283,7 +283,7 @@ Reference< XPropertySet > CreateActionTrigger( sal_uInt16 nItemId, const Menu* p } /// @throws RuntimeException -Reference< XPropertySet > CreateActionTriggerSeparator( const Reference< XIndexContainer >& rActionTriggerContainer ) +static Reference< XPropertySet > CreateActionTriggerSeparator( const Reference< XIndexContainer >& rActionTriggerContainer ) { Reference< XMultiServiceFactory > xMultiServiceFactory( rActionTriggerContainer, UNO_QUERY ); if ( xMultiServiceFactory.is() ) @@ -297,7 +297,7 @@ Reference< XPropertySet > CreateActionTriggerSeparator( const Reference< XIndexC } /// @throws RuntimeException -Reference< XIndexContainer > CreateActionTriggerContainer( const Reference< XIndexContainer >& rActionTriggerContainer ) +static Reference< XIndexContainer > CreateActionTriggerContainer( const Reference< XIndexContainer >& rActionTriggerContainer ) { Reference< XMultiServiceFactory > xMultiServiceFactory( rActionTriggerContainer, UNO_QUERY ); if ( xMultiServiceFactory.is() ) @@ -310,7 +310,7 @@ Reference< XIndexContainer > CreateActionTriggerContainer( const Reference< XInd return Reference< XIndexContainer >(); } -void FillActionTriggerContainerWithMenu( const Menu* pMenu, Reference< XIndexContainer > const & rActionTriggerContainer ) +static void FillActionTriggerContainerWithMenu( const Menu* pMenu, Reference< XIndexContainer > const & rActionTriggerContainer ) { SolarMutexGuard aGuard; diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx index 7fccf820b0a2..823541875399 100644 --- a/framework/source/jobs/jobdata.cxx +++ b/framework/source/jobs/jobdata.cxx @@ -441,7 +441,7 @@ void JobData::disableJob() aConfig.close(); } -bool isEnabled( const OUString& sAdminTime , +static bool isEnabled( const OUString& sAdminTime , const OUString& sUserTime ) { /*Attention! diff --git a/framework/source/recording/dispatchrecorder.cxx b/framework/source/recording/dispatchrecorder.cxx index 658229302c33..a395cef82978 100644 --- a/framework/source/recording/dispatchrecorder.cxx +++ b/framework/source/recording/dispatchrecorder.cxx @@ -51,7 +51,7 @@ DEFINE_INIT_SERVICE( ) -void flatten_struct_members( +static void flatten_struct_members( ::std::vector< Any > * vec, void const * data, typelib_CompoundTypeDescription * pTD ) { @@ -66,7 +66,7 @@ void flatten_struct_members( } } -Sequence< Any > make_seq_out_of_struct( +static Sequence< Any > make_seq_out_of_struct( Any const & val ) { Type const & type = val.getValueType(); diff --git a/framework/source/services/ContextChangeEventMultiplexer.cxx b/framework/source/services/ContextChangeEventMultiplexer.cxx index f8f68a1c8a14..2ee8a298ed4e 100644 --- a/framework/source/services/ContextChangeEventMultiplexer.cxx +++ b/framework/source/services/ContextChangeEventMultiplexer.cxx @@ -333,7 +333,7 @@ struct Singleton: namespace framework { // right now we assume there's one matching listener -uno::Reference<ui::XContextChangeEventListener> GetFirstListenerWith_ImplImpl( +static uno::Reference<ui::XContextChangeEventListener> GetFirstListenerWith_ImplImpl( uno::Reference<uno::XInterface> const& xEventFocus, std::function<bool (uno::Reference<ui::XContextChangeEventListener> const&)> const& rPredicate) { diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index fc22ed4cc279..39a4e787cea6 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -85,14 +85,14 @@ struct ToolBarEntry const CollatorWrapper* pCollatorWrapper; }; -bool CompareToolBarEntry( const ToolBarEntry& aOne, const ToolBarEntry& aTwo ) +static bool CompareToolBarEntry( const ToolBarEntry& aOne, const ToolBarEntry& aTwo ) { sal_Int32 nComp = aOne.pCollatorWrapper->compareString( aOne.aUIName, aTwo.aUIName ); return nComp < 0; } -Reference< XLayoutManager > getLayoutManagerFromFrame( const Reference< XFrame >& rFrame ) +static Reference< XLayoutManager > getLayoutManagerFromFrame( const Reference< XFrame >& rFrame ) { Reference< XPropertySet > xPropSet( rFrame, UNO_QUERY ); Reference< XLayoutManager > xLayoutManager; diff --git a/framework/source/uifactory/factoryconfiguration.cxx b/framework/source/uifactory/factoryconfiguration.cxx index 778195be2942..c3a2f964b2e2 100644 --- a/framework/source/uifactory/factoryconfiguration.cxx +++ b/framework/source/uifactory/factoryconfiguration.cxx @@ -45,7 +45,7 @@ using namespace com::sun::star::container; namespace framework { -OUString getHashKeyFromStrings( const OUString& aCommandURL, const OUString& aModuleName ) +static OUString getHashKeyFromStrings( const OUString& aCommandURL, const OUString& aModuleName ) { OUStringBuffer aKey( aCommandURL ); aKey.append( "-" ); |