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 /toolkit | |
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 'toolkit')
-rw-r--r-- | toolkit/source/awt/vclxwindow.cxx | 2 | ||||
-rw-r--r-- | toolkit/source/controls/stdtabcontrollermodel.cxx | 4 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrolcontainer.cxx | 2 | ||||
-rw-r--r-- | toolkit/source/helper/property.cxx | 6 | ||||
-rw-r--r-- | toolkit/source/helper/unowrapper.cxx | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 65b14459e8bd..9edf3ed9086c 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -314,7 +314,7 @@ Reference< XStyleSettings > VCLXWindowImpl::getStyleSettings() // Uses an out-parameter instead of return value, due to the object reference -void ImplInitWindowEvent( css::awt::WindowEvent& rEvent, vcl::Window const * pWindow ) +static void ImplInitWindowEvent( css::awt::WindowEvent& rEvent, vcl::Window const * pWindow ) { Point aPos = pWindow->GetPosPixel(); Size aSz = pWindow->GetSizePixel(); diff --git a/toolkit/source/controls/stdtabcontrollermodel.cxx b/toolkit/source/controls/stdtabcontrollermodel.cxx index ca35f7fad168..47bf8072e44a 100644 --- a/toolkit/source/controls/stdtabcontrollermodel.cxx +++ b/toolkit/source/controls/stdtabcontrollermodel.cxx @@ -155,7 +155,7 @@ sal_uInt32 StdTabControllerModel::ImplGetControlPos( const css::uno::Reference< return CONTROLPOS_NOTFOUND; } -void ImplWriteControls( const css::uno::Reference< css::io::XObjectOutputStream > & OutStream, const css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& rCtrls ) +static void ImplWriteControls( const css::uno::Reference< css::io::XObjectOutputStream > & OutStream, const css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& rCtrls ) { css::uno::Reference< css::io::XMarkableStream > xMark( OutStream, css::uno::UNO_QUERY ); DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" ); @@ -186,7 +186,7 @@ void ImplWriteControls( const css::uno::Reference< css::io::XObjectOutputStream xMark->deleteMark(nDataBeginMark); } -css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > > ImplReadControls( const css::uno::Reference< css::io::XObjectInputStream > & InStream ) +static css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > > ImplReadControls( const css::uno::Reference< css::io::XObjectInputStream > & InStream ) { css::uno::Reference< css::io::XMarkableStream > xMark( InStream, css::uno::UNO_QUERY ); DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" ); diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx index be64fb6eee17..b704b0dd01cb 100644 --- a/toolkit/source/controls/unocontrolcontainer.cxx +++ b/toolkit/source/controls/unocontrolcontainer.cxx @@ -299,7 +299,7 @@ OUString UnoControlHolderList::impl_getFreeName_throw() // Function to set the controls' visibility according // to the dialog's "Step" property -void implUpdateVisibility +static void implUpdateVisibility ( sal_Int32 nDialogStep, const uno::Reference< awt::XControlContainer >& xControlContainer diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index 1a5c0a6b1ed9..f29ca532293a 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -88,7 +88,7 @@ struct ImplPropertyInfo #define DECL_DEP_PROP_3( asciiname, id, type, attrib1, attrib2, attrib3 ) \ ImplPropertyInfo( asciiname, BASEPROPERTY_##id, cppu::UnoType<type>::get(), css::beans::PropertyAttribute::attrib1 | css::beans::PropertyAttribute::attrib2 | css::beans::PropertyAttribute::attrib3, true ) -ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) +static ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) { static ImplPropertyInfo* pPropertyInfos = nullptr; static sal_uInt16 nElements = 0; @@ -304,7 +304,7 @@ struct ImplPropertyInfoCompareFunctor } }; -void ImplAssertValidPropertyArray() +static void ImplAssertValidPropertyArray() { static bool bSorted = false; if( !bSorted ) @@ -331,7 +331,7 @@ sal_uInt16 GetPropertyId( const OUString& rPropertyName ) return ( pInf && pInf != (pInfo+nElements) && pInf->aName == rPropertyName) ? pInf->nPropId: 0; } -const ImplPropertyInfo* ImplGetImplPropertyInfo( sal_uInt16 nPropertyId ) +static const ImplPropertyInfo* ImplGetImplPropertyInfo( sal_uInt16 nPropertyId ) { ImplAssertValidPropertyArray(); diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index b38ceeded3ab..f0e2c2dc0e66 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -38,7 +38,7 @@ using namespace ::com::sun::star; -css::uno::Reference< css::awt::XWindowPeer > CreateXWindow( vcl::Window const * pWindow ) +static css::uno::Reference< css::awt::XWindowPeer > CreateXWindow( vcl::Window const * pWindow ) { switch ( pWindow->GetType() ) { |