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 /basctl | |
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 'basctl')
-rw-r--r-- | basctl/source/basicide/baside3.cxx | 2 | ||||
-rw-r--r-- | basctl/source/basicide/bastypes.cxx | 2 | ||||
-rw-r--r-- | basctl/source/basicide/localizationmgr.cxx | 6 | ||||
-rw-r--r-- | basctl/source/dlged/dlged.cxx | 4 | ||||
-rw-r--r-- | basctl/source/dlged/dlgedview.cxx | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index dfa698a4a345..1e216698d1d9 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -744,7 +744,7 @@ void DialogWindow::SaveDialog() } } -std::vector< lang::Locale > implGetLanguagesOnlyContainedInFirstSeq +static std::vector< lang::Locale > implGetLanguagesOnlyContainedInFirstSeq ( const Sequence< lang::Locale >& aFirstSeq, const Sequence< lang::Locale >& aSecondSeq ) { std::vector< lang::Locale > avRet; diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index 47fee717fa00..916b72eca1fb 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -707,7 +707,7 @@ LibInfo::Item::Item ( LibInfo::Item::~Item () { } -bool QueryDel(const OUString& rName, const OUString &rStr, weld::Widget* pParent) +static bool QueryDel(const OUString& rName, const OUString &rStr, weld::Widget* pParent) { OUStringBuffer aNameBuf( rName ); aNameBuf.append('\''); diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx index 8822ee21c9ba..743e43089deb 100644 --- a/basctl/source/basicide/localizationmgr.cxx +++ b/basctl/source/basicide/localizationmgr.cxx @@ -97,7 +97,7 @@ void LocalizationMgr::handleTranslationbar () // TODO: -> export from toolkit -bool isLanguageDependentProperty( const OUString& aName ) +static bool isLanguageDependentProperty( const OUString& aName ) { static struct Prop { @@ -160,7 +160,7 @@ void LocalizationMgr::implEnableDisableResourceForAllLibraryDialogs( HandleResou } -OUString implCreatePureResourceId +static OUString implCreatePureResourceId ( const OUString& aDialogName, const OUString& aCtrlName, const OUString& aPropName, const Reference< XStringResourceManager >& xStringResourceManager ) @@ -770,7 +770,7 @@ void LocalizationMgr::handleBasicStopped() } -DialogWindow* FindDialogWindowForEditor( DlgEditor const * pEditor ) +static DialogWindow* FindDialogWindowForEditor( DlgEditor const * pEditor ) { Shell::WindowTable const& aWindowTable = GetShell()->GetWindowTable(); for (auto const& window : aWindowTable) diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 1e6b11d53a19..23f41d06e6e9 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -646,7 +646,7 @@ void DlgEditor::Cut() } -void implCopyStreamToByteSequence( const Reference< XInputStream >& xStream, +static void implCopyStreamToByteSequence( const Reference< XInputStream >& xStream, Sequence< sal_Int8 >& bytes ) { xStream->readBytes( bytes, xStream->available() ); @@ -1102,7 +1102,7 @@ namespace Print long const nBorder = 300; } -void lcl_PrintHeader( Printer* pPrinter, const OUString& rTitle ) // not working yet +static void lcl_PrintHeader( Printer* pPrinter, const OUString& rTitle ) // not working yet { pPrinter->Push(); diff --git a/basctl/source/dlged/dlgedview.cxx b/basctl/source/dlged/dlgedview.cxx index 12d2d57bb99a..b1a2603abb30 100644 --- a/basctl/source/dlged/dlgedview.cxx +++ b/basctl/source/dlged/dlgedview.cxx @@ -123,7 +123,7 @@ void DlgEdView::MakeVisible( const tools::Rectangle& rRect, vcl::Window& rWin ) } } -SdrObject* impLocalHitCorrection(SdrObject* pRetval, const Point& rPnt, sal_uInt16 nTol) +static SdrObject* impLocalHitCorrection(SdrObject* pRetval, const Point& rPnt, sal_uInt16 nTol) { DlgEdObj* pDlgEdObj = dynamic_cast< DlgEdObj* >(pRetval); |