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 /drawinglayer/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 'drawinglayer/source')
4 files changed, 25 insertions, 23 deletions
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx index 56a85cd65038..4c7bf9743628 100644 --- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx @@ -89,7 +89,7 @@ namespace drawinglayer } // helper to add a centered, maybe stroked line primitive to rContainer - void addPolygonStrokePrimitive2D( + static void addPolygonStrokePrimitive2D( Primitive2DContainer& rContainer, const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd, diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index 2350f28699fc..ea2e9c9aede6 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -28,6 +28,8 @@ #include <com/sun/star/drawing/LineCap.hpp> #include <comphelper/random.hxx> +#include <converters.hxx> + using namespace com::sun::star; using namespace std; diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 9d07e1683d2f..ccef3e685cbb 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -133,7 +133,7 @@ namespace drawinglayer namespace primitive2d { // static methods here - VirtualDevice& acquireGlobalVirtualDevice() + static VirtualDevice& acquireGlobalVirtualDevice() { scoped_timed_RefDev& rStdRefDevice = the_scoped_timed_RefDev::get(); @@ -143,7 +143,7 @@ namespace drawinglayer return rStdRefDevice->acquireVirtualDevice(); } - void releaseGlobalVirtualDevice() + static void releaseGlobalVirtualDevice() { scoped_timed_RefDev& rStdRefDevice = the_scoped_timed_RefDev::get(); diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx index 2576bfdf510c..265c7e0d6703 100644 --- a/drawinglayer/source/tools/wmfemfhelper.cxx +++ b/drawinglayer/source/tools/wmfemfhelper.cxx @@ -435,7 +435,7 @@ namespace namespace wmfemfhelper { /** helper to create a PointArrayPrimitive2D based on current context */ - void createPointArrayPrimitive( + static void createPointArrayPrimitive( const std::vector< basegfx::B2DPoint >& rPositions, TargetHolder& rTarget, PropertyHolder const & rProperties, @@ -468,7 +468,7 @@ namespace wmfemfhelper } /** helper to create a PolygonHairlinePrimitive2D based on current context */ - void createHairlinePrimitive( + static void createHairlinePrimitive( const basegfx::B2DPolygon& rLinePolygon, TargetHolder& rTarget, PropertyHolder const & rProperties) @@ -485,7 +485,7 @@ namespace wmfemfhelper } /** helper to create a PolyPolygonColorPrimitive2D based on current context */ - void createFillPrimitive( + static void createFillPrimitive( const basegfx::B2DPolyPolygon& rFillPolyPolygon, TargetHolder& rTarget, PropertyHolder const & rProperties) @@ -502,7 +502,7 @@ namespace wmfemfhelper } /** helper to create a PolygonStrokePrimitive2D based on current context */ - void createLinePrimitive( + static void createLinePrimitive( const basegfx::B2DPolygon& rLinePolygon, const LineInfo& rLineInfo, TargetHolder& rTarget, @@ -569,7 +569,7 @@ namespace wmfemfhelper } /** helper to create needed line and fill primitives based on current context */ - void createHairlineAndFillPrimitive( + static void createHairlineAndFillPrimitive( const basegfx::B2DPolygon& rPolygon, TargetHolder& rTarget, PropertyHolder const & rProperties) @@ -586,7 +586,7 @@ namespace wmfemfhelper } /** helper to create needed line and fill primitives based on current context */ - void createHairlineAndFillPrimitive( + static void createHairlineAndFillPrimitive( const basegfx::B2DPolyPolygon& rPolyPolygon, TargetHolder& rTarget, PropertyHolder const & rProperties) @@ -611,7 +611,7 @@ namespace wmfemfhelper position and size in pixels. At the end it will create a view-dependent transformed embedding of a BitmapPrimitive2D. */ - void createBitmapExPrimitive( + static void createBitmapExPrimitive( const BitmapEx& rBitmapEx, const Point& rPoint, TargetHolder& rTarget, @@ -630,7 +630,7 @@ namespace wmfemfhelper } /** helper to create BitmapPrimitive2D based on current context */ - void createBitmapExPrimitive( + static void createBitmapExPrimitive( const BitmapEx& rBitmapEx, const Point& rPoint, const Size& rSize, @@ -659,7 +659,7 @@ namespace wmfemfhelper which use a bitmap without transparence but define one of the colors as transparent) */ - BitmapEx createMaskBmpEx(const Bitmap& rBitmap, const Color& rMaskColor) + static BitmapEx createMaskBmpEx(const Bitmap& rBitmap, const Color& rMaskColor) { const Color aWhite(COL_WHITE); BitmapPalette aBiLevelPalette(2); @@ -678,7 +678,7 @@ namespace wmfemfhelper /** helper to convert from a VCL Gradient definition to the corresponding data for primitive representation */ - drawinglayer::attribute::FillGradientAttribute createFillGradientAttribute(const Gradient& rGradient) + static drawinglayer::attribute::FillGradientAttribute createFillGradientAttribute(const Gradient& rGradient) { const Color aStartColor(rGradient.GetStartColor()); const sal_uInt16 nStartIntens(rGradient.GetStartIntensity()); @@ -750,7 +750,7 @@ namespace wmfemfhelper /** helper to convert from a VCL Hatch definition to the corresponding data for primitive representation */ - drawinglayer::attribute::FillHatchAttribute createFillHatchAttribute(const Hatch& rHatch) + static drawinglayer::attribute::FillHatchAttribute createFillHatchAttribute(const Hatch& rHatch) { drawinglayer::attribute::HatchStyle aHatchStyle(drawinglayer::attribute::HatchStyle::Single); @@ -870,7 +870,7 @@ namespace wmfemfhelper a changing RasterOp is used. Currently, RasterOp::Xor and RasterOp::Invert are supported using InvertPrimitive2D, and RasterOp::N0 by using a ModifiedColorPrimitive2D to force to black paint */ - void HandleNewRasterOp( + static void HandleNewRasterOp( RasterOp aRasterOp, TargetHolders& rTargetHolders, PropertyHolders& rPropertyHolders) @@ -923,7 +923,7 @@ namespace wmfemfhelper /** helper to create needed data to emulate the VCL Wallpaper Metafile action. It is a quite mighty action. This helper is for simple color filled background. */ - std::unique_ptr<drawinglayer::primitive2d::BasePrimitive2D> CreateColorWallpaper( + static std::unique_ptr<drawinglayer::primitive2d::BasePrimitive2D> CreateColorWallpaper( const basegfx::B2DRange& rRange, const basegfx::BColor& rColor, PropertyHolder const & rPropertyHolder) @@ -939,7 +939,7 @@ namespace wmfemfhelper /** helper to create needed data to emulate the VCL Wallpaper Metafile action. It is a quite mighty action. This helper is for gradient filled background. */ - std::unique_ptr<drawinglayer::primitive2d::BasePrimitive2D> CreateGradientWallpaper( + static std::unique_ptr<drawinglayer::primitive2d::BasePrimitive2D> CreateGradientWallpaper( const basegfx::B2DRange& rRange, const Gradient& rGradient, PropertyHolder const & rPropertyHolder) @@ -979,7 +979,7 @@ namespace wmfemfhelper WallpaperBitmapPrimitive2D. This primitive was created for this purpose and takes over all needed logic of orientations and tiling. */ - void CreateAndAppendBitmapWallpaper( + static void CreateAndAppendBitmapWallpaper( basegfx::B2DRange aWallpaperRange, const Wallpaper& rWallpaper, TargetHolder& rTarget, @@ -1043,7 +1043,7 @@ namespace wmfemfhelper } /** helper to decide UnderlineAbove for text primitives */ - bool isUnderlineAbove(const vcl::Font& rFont) + static bool isUnderlineAbove(const vcl::Font& rFont) { if(!rFont.IsVertical()) { @@ -1059,7 +1059,7 @@ namespace wmfemfhelper return false; } - void createFontAttributeTransformAndAlignment( + static void createFontAttributeTransformAndAlignment( drawinglayer::attribute::FontAttribute& rFontAttribute, basegfx::B2DHomMatrix& rTextTransform, basegfx::B2DVector& rAlignmentOffset, @@ -1106,7 +1106,7 @@ namespace wmfemfhelper /** helper which takes complete care for creating the needed text primitives. It takes care of decorated stuff and all the geometry adaptions needed */ - void processMetaTextAction( + static void processMetaTextAction( const Point& rTextStartPosition, const OUString& rText, sal_uInt16 nTextStart, @@ -1306,7 +1306,7 @@ namespace wmfemfhelper } /** helper which takes complete care for creating the needed textLine primitives */ - void proccessMetaTextLineAction( + static void proccessMetaTextLineAction( const MetaTextLineAction& rAction, TargetHolder& rTarget, PropertyHolder const & rProperty) @@ -1471,7 +1471,7 @@ namespace wmfemfhelper For more comments, see the single action implementations. */ - void implInterpretMetafile( + static void implInterpretMetafile( const GDIMetaFile& rMetaFile, TargetHolders& rTargetHolders, PropertyHolders& rPropertyHolders, |