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 /chart2/source/tools | |
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 'chart2/source/tools')
-rw-r--r-- | chart2/source/tools/DiagramHelper.cxx | 4 | ||||
-rw-r--r-- | chart2/source/tools/ExplicitCategoriesProvider.cxx | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 5c8c534fb496..faaf3c1a4fdd 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -926,7 +926,7 @@ Reference< data::XLabeledDataSequence > return xResult; } -void lcl_generateAutomaticCategoriesFromChartType( +static void lcl_generateAutomaticCategoriesFromChartType( Sequence< OUString >& rRet, const Reference< XChartType >& xChartType ) { @@ -1598,7 +1598,7 @@ DiagramPositioningMode DiagramHelper::getDiagramPositioningMode( const uno::Refe return eMode; } -void lcl_ensureRange0to1( double& rValue ) +static void lcl_ensureRange0to1( double& rValue ) { if(rValue<0.0) rValue=0.0; diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index ced3f5204b10..835f5243488e 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -152,7 +152,7 @@ sal_Int32 ExplicitCategoriesProvider::getCategoryLevelCount() const return nCount; } -std::vector<sal_Int32> lcl_getLimitingBorders( const std::vector< ComplexCategory >& rComplexCategories ) +static std::vector<sal_Int32> lcl_getLimitingBorders( const std::vector< ComplexCategory >& rComplexCategories ) { std::vector<sal_Int32> aLimitingBorders; sal_Int32 nBorderIndex = 0; /*border below the index*/ @@ -250,7 +250,7 @@ uno::Sequence< OUString > SplitCategoriesProvider_ForLabeledDataSequences::getSt return aRet; } -std::vector< ComplexCategory > lcl_DataSequenceToComplexCategoryVector( +static std::vector< ComplexCategory > lcl_DataSequenceToComplexCategoryVector( const uno::Sequence< OUString >& rStrings , const std::vector<sal_Int32>& rLimitingBorders, bool bCreateSingleCategories ) { @@ -290,7 +290,7 @@ std::vector< ComplexCategory > lcl_DataSequenceToComplexCategoryVector( return aResult; } -sal_Int32 lcl_getCategoryCount( std::vector< ComplexCategory >& rComplexCategories ) +static sal_Int32 lcl_getCategoryCount( std::vector< ComplexCategory >& rComplexCategories ) { sal_Int32 nCount = 0; for (auto const& complexCategory : rComplexCategories) @@ -298,7 +298,7 @@ sal_Int32 lcl_getCategoryCount( std::vector< ComplexCategory >& rComplexCategori return nCount; } -Sequence< OUString > lcl_getExplicitSimpleCategories( +static Sequence< OUString > lcl_getExplicitSimpleCategories( const SplitCategoriesProvider& rSplitCategoriesProvider, std::vector< std::vector< ComplexCategory > >& rComplexCats ) { @@ -383,7 +383,7 @@ Sequence< OUString > ExplicitCategoriesProvider::getExplicitSimpleCategories( return lcl_getExplicitSimpleCategories( rSplitCategoriesProvider, aComplexCats ); } -bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& xDataSequence, std::vector< double >& rDateCategories, bool bIsAutoDate, ChartModel& rModel ) +static bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& xDataSequence, std::vector< double >& rDateCategories, bool bIsAutoDate, ChartModel& rModel ) { bool bOnlyDatesFound = true; bool bAnyDataFound = false; |