summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-11-19 16:32:49 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-11-22 12:57:32 +0100
commitf853ec317f6af1b8c65cc5bd758371689c75118d (patch)
treeb86d729bf9a9465ee619ead3b5635efa62a1804e /slideshow
parentf31d36966bceb90e261cbecd42634bde4448d527 (diff)
Extend loplugin:external to warn about classes
...following up on 314f15bff08b76bf96acf99141776ef64d2f1355 "Extend loplugin:external to warn about enums". Cases where free functions were moved into an unnamed namespace along with a class, to not break ADL, are in: filter/source/svg/svgexport.cxx sc/source/filter/excel/xelink.cxx sc/source/filter/excel/xilink.cxx svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx All other free functions mentioning moved classes appear to be harmless and not give rise to (silent, even) ADL breakage. (One remaining TODO in compilerplugins/clang/external.cxx is that derived classes are not covered by computeAffectedTypes, even though they could also be affected by ADL-breakage--- but don't seem to be in any acutal case across the code base.) For friend declarations using elaborate type specifiers, like class C1 {}; class C2 { friend class C1; }; * If C2 (but not C1) is moved into an unnamed namespace, the friend declaration must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither qualified nor a template-id and the declaration is a function or an elaborated-type-specifier, the lookup to determine whether the entity has been previously declared shall not consider any scopes outside the innermost enclosing namespace.") * If C1 (but not C2) is moved into an unnamed namespace, the friend declaration must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882> "elaborated-type-specifier friend not looked up in unnamed namespace". Apart from that, to keep changes simple and mostly mechanical (which should help avoid regressions), out-of-line definitions of class members have been left in the enclosing (named) namespace. But explicit specializations of class templates had to be moved into the unnamed namespace to appease <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of template from unnamed namespace using unqualified-id in enclosing namespace". Also, accompanying declarations (of e.g. typedefs or static variables) that could arguably be moved into the unnamed namespace too have been left alone. And in some cases, mention of affected types in blacklists in other loplugins needed to be adapted. And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is not moved into an unnamed namespace (because it is declared in sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is. GCC warns about such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler doesn’t give this warning for types defined in the main .C file, as those are unlikely to have multiple definitions." (<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>) The warned-about classes also don't have multiple definitions in the given test, so disable the warning when including the .cxx. Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4 Reviewed-on: https://gerrit.libreoffice.org/83239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/animationnodes/animationaudionode.cxx4
-rw-r--r--slideshow/source/engine/eventmultiplexer.cxx6
-rw-r--r--slideshow/source/engine/shapes/appletshape.cxx4
-rw-r--r--slideshow/source/engine/shapes/backgroundshape.cxx3
-rw-r--r--slideshow/source/engine/shapes/intrinsicanimationactivity.cxx3
-rw-r--r--slideshow/source/engine/shapes/mediashape.cxx3
-rw-r--r--slideshow/source/engine/usereventqueue.cxx4
-rw-r--r--slideshow/test/testshape.cxx4
-rw-r--r--slideshow/test/testview.cxx4
9 files changed, 35 insertions, 0 deletions
diff --git a/slideshow/source/engine/animationnodes/animationaudionode.cxx b/slideshow/source/engine/animationnodes/animationaudionode.cxx
index b5e6f53a6210..571af6c7b773 100644
--- a/slideshow/source/engine/animationnodes/animationaudionode.cxx
+++ b/slideshow/source/engine/animationnodes/animationaudionode.cxx
@@ -99,6 +99,8 @@ void AnimationAudioNode::activate_st()
// TODO(F2): generate deactivation event, when sound
// is over
+namespace {
+
// libc++ and MSVC std::bind doesn't cut it here, and it's not possible to use
// a lambda because the preprocessor thinks that comma in capture list
// separates macro parameters
@@ -116,6 +118,8 @@ struct NotifyAudioStopped
}
};
+}
+
void AnimationAudioNode::deactivate_st( NodeState /*eDestState*/ )
{
AnimationEventHandlerSharedPtr aHandler(
diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx
index b583bd42c151..7aa09adf1ac9 100644
--- a/slideshow/source/engine/eventmultiplexer.cxx
+++ b/slideshow/source/engine/eventmultiplexer.cxx
@@ -129,6 +129,8 @@ struct slideshow::internal::ListenerOperations<ViewEventHandlerWeakPtrWrapper>
namespace slideshow {
namespace internal {
+namespace {
+
template <typename HandlerT>
class PrioritizedHandlerEntry
{
@@ -161,11 +163,14 @@ public:
}
};
+}
typedef cppu::WeakComponentImplHelper<
awt::XMouseListener,
awt::XMouseMotionListener > Listener_UnoBase;
+namespace {
+
/** Listener class, to decouple UNO lifetime from EventMultiplexer
This class gets registered as the XMouse(Motion)Listener on the
@@ -208,6 +213,7 @@ private:
EventMultiplexerImpl* mpEventMultiplexer;
};
+}
struct EventMultiplexerImpl
{
diff --git a/slideshow/source/engine/shapes/appletshape.cxx b/slideshow/source/engine/shapes/appletshape.cxx
index 46f75e18f417..1fac5a42739d 100644
--- a/slideshow/source/engine/shapes/appletshape.cxx
+++ b/slideshow/source/engine/shapes/appletshape.cxx
@@ -36,6 +36,8 @@ namespace slideshow
{
namespace internal
{
+ namespace {
+
/** Represents an applet shape.
This implementation offers support for applet shapes (both
@@ -105,6 +107,8 @@ namespace slideshow
bool mbIsPlaying;
};
+ }
+
AppletShape::AppletShape( const uno::Reference< drawing::XShape >& xShape,
double nPrio,
const OUString& rServiceName,
diff --git a/slideshow/source/engine/shapes/backgroundshape.cxx b/slideshow/source/engine/shapes/backgroundshape.cxx
index 11c4ed1c1e0f..704e7cb9598e 100644
--- a/slideshow/source/engine/shapes/backgroundshape.cxx
+++ b/slideshow/source/engine/shapes/backgroundshape.cxx
@@ -48,6 +48,8 @@ namespace slideshow
{
namespace internal
{
+ namespace {
+
/** Representation of a draw document's background shape.
This class implements the Shape interface for the
@@ -114,6 +116,7 @@ namespace slideshow
ViewBackgroundShapeVector maViewShapes;
};
+ }
BackgroundShape::BackgroundShape( const uno::Reference< drawing::XDrawPage >& xDrawPage,
const uno::Reference< drawing::XDrawPage >& xMasterPage,
diff --git a/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx b/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx
index 5461299beb2e..cf3748f4a4d5 100644
--- a/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx
+++ b/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx
@@ -33,6 +33,8 @@ namespace slideshow
{
namespace internal
{
+ namespace {
+
/** Activity for intrinsic shape animations
This is an Activity interface implementation for intrinsic
@@ -108,6 +110,7 @@ namespace slideshow
IntrinsicAnimationActivity& mrActivity;
};
+ }
IntrinsicAnimationActivity::IntrinsicAnimationActivity( const SlideShowContext& rContext,
const DrawShapeSharedPtr& rDrawShape,
diff --git a/slideshow/source/engine/shapes/mediashape.cxx b/slideshow/source/engine/shapes/mediashape.cxx
index 5cabfe623bff..17a82c4392a1 100644
--- a/slideshow/source/engine/shapes/mediashape.cxx
+++ b/slideshow/source/engine/shapes/mediashape.cxx
@@ -39,6 +39,8 @@ namespace slideshow
{
namespace internal
{
+ namespace {
+
/** Represents a media shape.
This implementation offers support for media shapes.
@@ -89,6 +91,7 @@ namespace slideshow
bool mbIsPlaying;
};
+ }
MediaShape::MediaShape( const uno::Reference< drawing::XShape >& xShape,
double nPrio,
diff --git a/slideshow/source/engine/usereventqueue.cxx b/slideshow/source/engine/usereventqueue.cxx
index 935c0976db55..e0ff40f4f545 100644
--- a/slideshow/source/engine/usereventqueue.cxx
+++ b/slideshow/source/engine/usereventqueue.cxx
@@ -277,6 +277,8 @@ private:
bool mbSkipTriggersNextEffect;
};
+namespace {
+
/** Base class to share some common code between
ShapeClickEventHandler and MouseMoveHandler
@@ -373,6 +375,8 @@ private:
ImpShapeEventMap maShapeEventMap;
};
+}
+
class ShapeClickEventHandler : public MouseHandlerBase
{
public:
diff --git a/slideshow/test/testshape.cxx b/slideshow/test/testshape.cxx
index e9926218d283..f00ae08cbb59 100644
--- a/slideshow/test/testshape.cxx
+++ b/slideshow/test/testshape.cxx
@@ -37,6 +37,9 @@ using namespace ::com::sun::star;
// our test shape subject
typedef ::cppu::WeakComponentImplHelper< drawing::XShape > ShapeBase;
+
+namespace {
+
class ImplTestShape : public TestShape,
private cppu::BaseMutex,
public ShapeBase
@@ -193,6 +196,7 @@ private:
}
};
+}
TestShapeSharedPtr createTestShape(const basegfx::B2DRange& rRect,
double nPrio)
diff --git a/slideshow/test/testview.cxx b/slideshow/test/testview.cxx
index f391059722e2..99a385681e17 100644
--- a/slideshow/test/testview.cxx
+++ b/slideshow/test/testview.cxx
@@ -46,6 +46,9 @@ using namespace ::com::sun::star;
// our test view subject
typedef ::cppu::WeakComponentImplHelper< presentation::XSlideShowView > ViewBase;
+
+namespace {
+
class ImplTestView : public TestView,
private cppu::BaseMutex,
public ViewBase
@@ -270,6 +273,7 @@ public:
}
};
+}
TestViewSharedPtr createTestView()
{