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 /sot/source | |
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 'sot/source')
-rw-r--r-- | sot/source/sdstor/storage.cxx | 2 | ||||
-rw-r--r-- | sot/source/sdstor/ucbstorage.cxx | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index 93215f6ccd0b..cb484cca4215 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -44,7 +44,7 @@ using namespace ::com::sun::star; -SvLockBytesRef MakeLockBytes_Impl( const OUString & rName, StreamMode nMode ) +static SvLockBytesRef MakeLockBytes_Impl( const OUString & rName, StreamMode nMode ) { SvLockBytesRef xLB; if( !rName.isEmpty() ) diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index d36381c5b8eb..23eeca1d531c 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -303,7 +303,7 @@ void FileStreamWrapper_Impl::checkError() #define COMMIT_RESULT_NOTHING_TO_DO 1 #define COMMIT_RESULT_SUCCESS 2 -SotClipboardFormatId GetFormatId_Impl( const SvGlobalName& aName ) +static SotClipboardFormatId GetFormatId_Impl( const SvGlobalName& aName ) { if ( aName == SvGlobalName( SO3_SW_CLASSID_60 ) ) return SotClipboardFormatId::STARWRITER_60; @@ -335,7 +335,7 @@ SotClipboardFormatId GetFormatId_Impl( const SvGlobalName& aName ) } -SvGlobalName GetClassId_Impl( SotClipboardFormatId nFormat ) +static SvGlobalName GetClassId_Impl( SotClipboardFormatId nFormat ) { switch ( nFormat ) { @@ -1824,7 +1824,7 @@ sal_Int32 UCBStorage_Impl::GetObjectCount() return nCount; } -OUString Find_Impl( const Sequence < Sequence < PropertyValue > >& rSequence, const OUString& rPath ) +static OUString Find_Impl( const Sequence < Sequence < PropertyValue > >& rSequence, const OUString& rPath ) { bool bFound = false; for ( sal_Int32 nSeqs=0; nSeqs<rSequence.getLength(); nSeqs++ ) |