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 /oox/source/drawingml | |
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 'oox/source/drawingml')
-rw-r--r-- | oox/source/drawingml/customshapegeometry.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/diagram/diagram.cxx | 6 | ||||
-rw-r--r-- | oox/source/drawingml/table/tablecell.cxx | 8 | ||||
-rw-r--r-- | oox/source/drawingml/table/tableproperties.cxx | 8 | ||||
-rw-r--r-- | oox/source/drawingml/textcharacterproperties.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/textliststyle.cxx | 2 |
6 files changed, 14 insertions, 14 deletions
diff --git a/oox/source/drawingml/customshapegeometry.cxx b/oox/source/drawingml/customshapegeometry.cxx index 5726ab425cff..bc4582cb7276 100644 --- a/oox/source/drawingml/customshapegeometry.cxx +++ b/oox/source/drawingml/customshapegeometry.cxx @@ -91,7 +91,7 @@ typedef std::unordered_map< OUString, FormularCommand > FormulaCommandHMap; static const FormulaCommandHMap* pCommandHashMap; -OUString GetFormulaParameter( const EnhancedCustomShapeParameter& rParameter ) +static OUString GetFormulaParameter( const EnhancedCustomShapeParameter& rParameter ) { OUString aRet; switch( rParameter.Type ) diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx index 7dbd454f1595..901995bc2039 100644 --- a/oox/source/drawingml/diagram/diagram.cxx +++ b/oox/source/drawingml/diagram/diagram.cxx @@ -344,7 +344,7 @@ uno::Sequence<beans::PropertyValue> Diagram::getDomsAsPropertyValues() const return aValue; } -uno::Reference<xml::dom::XDocument> loadFragment( +static uno::Reference<xml::dom::XDocument> loadFragment( core::XmlFilterBase& rFilter, const OUString& rFragmentPath ) { @@ -353,14 +353,14 @@ uno::Reference<xml::dom::XDocument> loadFragment( return rFilter.importFragment( rFragmentPath ); } -uno::Reference<xml::dom::XDocument> loadFragment( +static uno::Reference<xml::dom::XDocument> loadFragment( core::XmlFilterBase& rFilter, const rtl::Reference< core::FragmentHandler >& rxHandler ) { return loadFragment( rFilter, rxHandler->getFragmentPath() ); } -void importFragment( core::XmlFilterBase& rFilter, +static void importFragment( core::XmlFilterBase& rFilter, const uno::Reference<xml::dom::XDocument>& rXDom, const char* pDocName, const DiagramPtr& pDiagram, diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx index 7639743842b2..bfcf750f51e0 100644 --- a/oox/source/drawingml/table/tablecell.cxx +++ b/oox/source/drawingml/table/tablecell.cxx @@ -69,7 +69,7 @@ TableCell::~TableCell() { } -void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase, +static void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase, Reference< XPropertySet > const & rxPropSet, oox::drawingml::LineProperties& rLineProperties, sal_Int32 nPropId ) { @@ -135,7 +135,7 @@ void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase, aPropSet.setProperty( nPropId, aBorderLine ); } -void applyBorder( const ::oox::core::XmlFilterBase& rFilterBase, TableStylePart& rTableStylePart, sal_Int32 nLineType, oox::drawingml::LineProperties& rLineProperties ) +static void applyBorder( const ::oox::core::XmlFilterBase& rFilterBase, TableStylePart& rTableStylePart, sal_Int32 nLineType, oox::drawingml::LineProperties& rLineProperties ) { std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& rPartLineBorders( rTableStylePart.getLineBorders() ); ::oox::drawingml::ShapeStyleRef& rLineStyleRef = rTableStylePart.getStyleRefs()[ nLineType ]; @@ -153,7 +153,7 @@ void applyBorder( const ::oox::core::XmlFilterBase& rFilterBase, TableStylePart& } } -void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase, +static void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase, oox::drawingml::FillProperties& rFillProperties, TextCharacterProperties& aTextCharProps, oox::drawingml::LineProperties& rLeftBorder, @@ -201,7 +201,7 @@ void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase, aTextCharProps.moItalic = *rTableStylePart.getTextItalicStyle(); } -void applyTableCellProperties( const Reference < css::table::XCell >& rxCell, const TableCell& rTableCell ) +static void applyTableCellProperties( const Reference < css::table::XCell >& rxCell, const TableCell& rTableCell ) { Reference< XPropertySet > xPropSet( rxCell, UNO_QUERY_THROW ); xPropSet->setPropertyValue( "TextUpperDistance", Any( static_cast< sal_Int32 >( rTableCell.getTopMargin() / 360 ) ) ); diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx index 00c5b765cfca..3701e1ecac9b 100644 --- a/oox/source/drawingml/table/tableproperties.cxx +++ b/oox/source/drawingml/table/tableproperties.cxx @@ -49,7 +49,7 @@ TableProperties::TableProperties() { } -void CreateTableRows( const uno::Reference< XTableRows >& xTableRows, const std::vector< TableRow >& rvTableRows ) +static void CreateTableRows( const uno::Reference< XTableRows >& xTableRows, const std::vector< TableRow >& rvTableRows ) { if ( rvTableRows.size() > 1 ) xTableRows->insertByIndex( 0, rvTableRows.size() - 1 ); @@ -64,7 +64,7 @@ void CreateTableRows( const uno::Reference< XTableRows >& xTableRows, const std: } } -void CreateTableColumns( const Reference< XTableColumns >& xTableColumns, const std::vector< sal_Int32 >& rvTableGrid ) +static void CreateTableColumns( const Reference< XTableColumns >& xTableColumns, const std::vector< sal_Int32 >& rvTableGrid ) { if ( rvTableGrid.size() > 1 ) xTableColumns->insertByIndex( 0, rvTableGrid.size() - 1 ); @@ -78,7 +78,7 @@ void CreateTableColumns( const Reference< XTableColumns >& xTableColumns, const } } -void MergeCells( const uno::Reference< XTable >& xTable, sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_Int32 nRowSpan ) +static void MergeCells( const uno::Reference< XTable >& xTable, sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_Int32 nRowSpan ) { if( xTable.is() ) try { @@ -140,7 +140,7 @@ static void SetTableStyleProperties(TableStyle* &pTableStyle , sal_Int32 tblFill pTableStyle->getLastCol().getTextBoldStyle() = textBoldStyle; } -TableStyle* CreateTableStyle(const OUString& styleId) +static TableStyle* CreateTableStyle(const OUString& styleId) { TableStyle* pTableStyle = nullptr; diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index 77ab07b50423..6443064e40d2 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -155,7 +155,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil // TODO If bUnderlineFillFollowText uFillTx (CT_TextUnderlineFillFollowText) is set, fill color of the underline should be the same color as the text } -void pushToGrabBag( PropertySet& rPropSet, const std::vector<PropertyValue>& aVectorOfProperyValues ) +static void pushToGrabBag( PropertySet& rPropSet, const std::vector<PropertyValue>& aVectorOfProperyValues ) { if (!rPropSet.hasProperty(PROP_CharInteropGrabBag) || aVectorOfProperyValues.empty()) return; diff --git a/oox/source/drawingml/textliststyle.cxx b/oox/source/drawingml/textliststyle.cxx index 879fdea363d2..15475ddcacb0 100644 --- a/oox/source/drawingml/textliststyle.cxx +++ b/oox/source/drawingml/textliststyle.cxx @@ -63,7 +63,7 @@ TextListStyle& TextListStyle::operator=(const TextListStyle& rStyle) return *this; } -void applyStyleList( const TextParagraphPropertiesVector& rSourceListStyle, TextParagraphPropertiesVector& rDestListStyle ) +static void applyStyleList( const TextParagraphPropertiesVector& rSourceListStyle, TextParagraphPropertiesVector& rDestListStyle ) { TextParagraphPropertiesVector::iterator aDestListStyleIter( rDestListStyle.begin() ); for (auto const& elemSource : rSourceListStyle) |