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 /sdext/source/minimizer/impoptimizer.cxx | |
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 'sdext/source/minimizer/impoptimizer.cxx')
-rw-r--r-- | sdext/source/minimizer/impoptimizer.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sdext/source/minimizer/impoptimizer.cxx b/sdext/source/minimizer/impoptimizer.cxx index a04cf0f93ebc..15de3f86a8ab 100644 --- a/sdext/source/minimizer/impoptimizer.cxx +++ b/sdext/source/minimizer/impoptimizer.cxx @@ -73,7 +73,7 @@ using namespace ::com::sun::star::document; using namespace ::com::sun::star::container; using namespace ::com::sun::star::presentation; -void ImpExtractCustomShow( const Reference< XModel >& rxModel, const OUString& rCustomShowName ) +static void ImpExtractCustomShow( const Reference< XModel >& rxModel, const OUString& rCustomShowName ) { vector< Reference< XDrawPage > > vNonUsedPageList; try @@ -91,7 +91,7 @@ void ImpExtractCustomShow( const Reference< XModel >& rxModel, const OUString& r } } -void ImpDeleteUnusedMasterPages( const Reference< XModel >& rxModel ) +static void ImpDeleteUnusedMasterPages( const Reference< XModel >& rxModel ) { vector< PageCollector::MasterPageEntity > aMasterPageList; PageCollector::CollectMasterPages( rxModel, aMasterPageList ); @@ -108,7 +108,7 @@ void ImpDeleteUnusedMasterPages( const Reference< XModel >& rxModel ) } } -void ImpDeleteHiddenSlides( const Reference< XModel >& rxModel ) +static void ImpDeleteHiddenSlides( const Reference< XModel >& rxModel ) { try { @@ -135,7 +135,7 @@ void ImpDeleteHiddenSlides( const Reference< XModel >& rxModel ) } } -void ImpDeleteNotesPages( const Reference< XModel >& rxModel ) +static void ImpDeleteNotesPages( const Reference< XModel >& rxModel ) { try { @@ -158,7 +158,7 @@ void ImpDeleteNotesPages( const Reference< XModel >& rxModel ) } } -void ImpConvertOLE( const Reference< XModel >& rxModel, sal_Int32 nOLEOptimizationType ) +static void ImpConvertOLE( const Reference< XModel >& rxModel, sal_Int32 nOLEOptimizationType ) { try { @@ -206,7 +206,7 @@ void ImpConvertOLE( const Reference< XModel >& rxModel, sal_Int32 nOLEOptimizati } } -void ImpCompressGraphic( Reference< XGraphicProvider > const & rxGraphicProvider, const Reference< XGraphic >& rxGraphic, Reference< XOutputStream > const & rxOutputStream, +static void ImpCompressGraphic( Reference< XGraphicProvider > const & rxGraphicProvider, const Reference< XGraphic >& rxGraphic, Reference< XOutputStream > const & rxOutputStream, const OUString& rDestMimeType, const awt::Size& rLogicalSize, sal_Int32 nJPEGQuality, sal_Int32 nImageResolution, bool bRemoveCropping, const text::GraphicCrop& rGraphicCropLogic ) { try @@ -247,7 +247,7 @@ void ImpCompressGraphic( Reference< XGraphicProvider > const & rxGraphicProvider } } -Reference< XGraphic > ImpCompressGraphic( const Reference< XComponentContext >& rxContext, +static Reference< XGraphic > ImpCompressGraphic( const Reference< XComponentContext >& rxContext, const Reference< XGraphic >& xGraphic, const awt::Size& aLogicalSize, const text::GraphicCrop& aGraphicCropLogic, const GraphicSettings& rGraphicSettings ) { @@ -371,7 +371,7 @@ Reference< XGraphic > ImpCompressGraphic( const Reference< XComponentContext >& return xNewGraphic; } -void CompressGraphics( ImpOptimizer& rOptimizer, const Reference< XComponentContext >& rxContext, const GraphicSettings& rGraphicSettings, +static void CompressGraphics( ImpOptimizer& rOptimizer, const Reference< XComponentContext >& rxContext, const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicList ) { try |