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 /slideshow/source/engine/opengl | |
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 'slideshow/source/engine/opengl')
-rw-r--r-- | slideshow/source/engine/opengl/Operation.cxx | 2 | ||||
-rw-r--r-- | slideshow/source/engine/opengl/TransitionImpl.cxx | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/slideshow/source/engine/opengl/Operation.cxx b/slideshow/source/engine/opengl/Operation.cxx index a8f5bc892851..674eb0da00d8 100644 --- a/slideshow/source/engine/opengl/Operation.cxx +++ b/slideshow/source/engine/opengl/Operation.cxx @@ -115,7 +115,7 @@ makeRotateAndScaleDepthByHeight(const glm::vec3& Axis,const glm::vec3& Origin,do return std::make_shared<RotateAndScaleDepthByHeight>(Axis, Origin, Angle, bScale, bInter, T0, T1); } -inline double intervalInter(double t, double T0, double T1) +static inline double intervalInter(double t, double T0, double T1) { return ( t - T0 ) / ( T1 - T0 ); } diff --git a/slideshow/source/engine/opengl/TransitionImpl.cxx b/slideshow/source/engine/opengl/TransitionImpl.cxx index f7f694fc26e9..9d6b457ae7f1 100644 --- a/slideshow/source/engine/opengl/TransitionImpl.cxx +++ b/slideshow/source/engine/opengl/TransitionImpl.cxx @@ -923,20 +923,20 @@ std::shared_ptr<OGLTransitionImpl> makeRochade() return makeRochadeTransition(aLeavingSlide, aEnteringSlide, aSettings); } -inline double randFromNeg1to1() +static inline double randFromNeg1to1() { return comphelper::rng::uniform_real_distribution(-1.0, std::nextafter(1.0, DBL_MAX)); } // TODO(Q3): extract to basegfx -inline glm::vec3 randNormVectorInXYPlane() +static inline glm::vec3 randNormVectorInXYPlane() { glm::vec3 toReturn(randFromNeg1to1(),randFromNeg1to1(),0.0); return glm::normalize(toReturn); } template<typename T> -T clamp(const T& rIn) +static T clamp(const T& rIn) { return glm::clamp(rIn, T(-1.0), T(1.0)); } @@ -1085,12 +1085,12 @@ std::shared_ptr<OGLTransitionImpl> makeHelix( sal_uInt16 nRows ) return makeSimpleTransition(aLeavingSlide, aEnteringSlide); } -float fdiv(int a, int b) +static float fdiv(int a, int b) { return static_cast<float>(a)/b; } -glm::vec2 vec(float x, float y, float nx, float ny) +static glm::vec2 vec(float x, float y, float nx, float ny) { x = x < 0.0 ? 0.0 : x; x = std::min(x, nx); @@ -1939,7 +1939,7 @@ std::shared_ptr<OGLTransitionImpl> makeRipple() return makeRippleTransition(aLeavingSlide, aEnteringSlide, aSettings); } -void createHexagon(Primitive& aHexagon, const int x, const int y, const int NX, const int NY) +static void createHexagon(Primitive& aHexagon, const int x, const int y, const int NX, const int NY) { if (y % 4 == 0) { |