summaryrefslogtreecommitdiff
path: root/svx/source/unodraw
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 /svx/source/unodraw
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 'svx/source/unodraw')
-rw-r--r--svx/source/unodraw/UnoNamespaceMap.cxx7
-rw-r--r--svx/source/unodraw/XPropertyTable.cxx22
-rw-r--r--svx/source/unodraw/gluepts.cxx4
-rw-r--r--svx/source/unodraw/unobtabl.cxx4
-rw-r--r--svx/source/unodraw/unodtabl.cxx4
-rw-r--r--svx/source/unodraw/unogtabl.cxx4
-rw-r--r--svx/source/unodraw/unohtabl.cxx4
-rw-r--r--svx/source/unodraw/unomtabl.cxx4
-rw-r--r--svx/source/unodraw/unoprov.cxx4
-rw-r--r--svx/source/unodraw/unoshap3.cxx3
-rw-r--r--svx/source/unodraw/unoshape.cxx4
-rw-r--r--svx/source/unodraw/unottabl.cxx4
12 files changed, 68 insertions, 0 deletions
diff --git a/svx/source/unodraw/UnoNamespaceMap.cxx b/svx/source/unodraw/UnoNamespaceMap.cxx
index 3bf56c17707f..d9c196a2dda3 100644
--- a/svx/source/unodraw/UnoNamespaceMap.cxx
+++ b/svx/source/unodraw/UnoNamespaceMap.cxx
@@ -41,6 +41,8 @@ using namespace ::com::sun::star::lang;
namespace svx
{
+ namespace {
+
/** implements a component to export namespaces of all SvXMLAttrContainerItem inside
one or two pools with a variable count of which ids.
*/
@@ -68,6 +70,8 @@ namespace svx
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
};
+ }
+
Reference< XInterface > NamespaceMap_createInstance( sal_uInt16* pWhichIds, SfxItemPool* pPool )
{
return static_cast<XWeak*>(new NamespaceMap( pWhichIds, pPool ));
@@ -86,6 +90,7 @@ namespace svx
return "com.sun.star.comp.Svx.NamespaceMap";
}
+ namespace {
class NamespaceIteratorImpl
{
@@ -106,6 +111,8 @@ namespace svx
bool next( OUString& rPrefix, OUString& rURL );
};
+
+ }
}
using namespace ::svx;
diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx
index fc2ce754652f..68c1a27517fe 100644
--- a/svx/source/unodraw/XPropertyTable.cxx
+++ b/svx/source/unodraw/XPropertyTable.cxx
@@ -43,6 +43,8 @@
using namespace com::sun::star;
using namespace ::cppu;
+namespace {
+
class SvxUnoXPropertyTable : public WeakImplHelper< container::XNameContainer, lang::XServiceInfo >
{
private:
@@ -79,6 +81,8 @@ public:
virtual sal_Bool SAL_CALL hasElements( ) override;
};
+}
+
SvxUnoXPropertyTable::SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyList* pList ) throw()
: mpList( pList ), mnWhich( nWhich )
{
@@ -230,6 +234,7 @@ sal_Bool SAL_CALL SvxUnoXPropertyTable::hasElements( )
return getCount() != 0;
}
+namespace {
class SvxUnoXColorTable : public SvxUnoXPropertyTable
{
@@ -248,6 +253,8 @@ public:
virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
};
+}
+
uno::Reference< uno::XInterface > SvxUnoXColorTable_createInstance( XPropertyList* pList ) throw()
{
return static_cast<OWeakObject*>(new SvxUnoXColorTable( pList ));
@@ -285,6 +292,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoXColorTable::getSupportedServiceNames(
return { "com.sun.star.drawing.ColorTable" };
}
+namespace {
class SvxUnoXLineEndTable : public SvxUnoXPropertyTable
{
@@ -303,6 +311,8 @@ public:
virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
};
+}
+
uno::Reference< uno::XInterface > SvxUnoXLineEndTable_createInstance( XPropertyList* pTable ) throw()
{
return static_cast<OWeakObject*>(new SvxUnoXLineEndTable( pTable ));
@@ -350,6 +360,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoXLineEndTable::getSupportedServiceName
return { "com.sun.star.drawing.LineEndTable" };
}
+namespace {
class SvxUnoXDashTable : public SvxUnoXPropertyTable
{
@@ -368,6 +379,8 @@ public:
virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
};
+}
+
uno::Reference< uno::XInterface > SvxUnoXDashTable_createInstance( XPropertyList* pTable ) throw()
{
return static_cast<OWeakObject*>(new SvxUnoXDashTable( pTable ));
@@ -425,6 +438,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoXDashTable::getSupportedServiceNames(
return { "com.sun.star.drawing.DashTable" };
}
+namespace {
class SvxUnoXHatchTable : public SvxUnoXPropertyTable
{
@@ -443,6 +457,8 @@ public:
virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
};
+}
+
uno::Reference< uno::XInterface > SvxUnoXHatchTable_createInstance( XPropertyList* pTable ) throw()
{
return static_cast<OWeakObject*>(new SvxUnoXHatchTable( pTable ));
@@ -495,6 +511,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoXHatchTable::getSupportedServiceNames(
return { "com.sun.star.drawing.HatchTable" };
}
+namespace {
class SvxUnoXGradientTable : public SvxUnoXPropertyTable
{
@@ -513,6 +530,8 @@ public:
virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
};
+}
+
uno::Reference< uno::XInterface > SvxUnoXGradientTable_createInstance( XPropertyList* pTable ) throw()
{
return static_cast<OWeakObject*>(new SvxUnoXGradientTable( pTable ));
@@ -577,6 +596,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoXGradientTable::getSupportedServiceNam
return { "com.sun.star.drawing.GradientTable" };
}
+namespace {
class SvxUnoXBitmapTable : public SvxUnoXPropertyTable
{
@@ -595,6 +615,8 @@ public:
virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
};
+}
+
uno::Reference< uno::XInterface > SvxUnoXBitmapTable_createInstance( XPropertyList* pTable ) throw()
{
return static_cast<OWeakObject*>(new SvxUnoXBitmapTable( pTable ));
diff --git a/svx/source/unodraw/gluepts.cxx b/svx/source/unodraw/gluepts.cxx
index 2b1ba019292e..575c9ecc189a 100644
--- a/svx/source/unodraw/gluepts.cxx
+++ b/svx/source/unodraw/gluepts.cxx
@@ -37,6 +37,8 @@ using namespace ::cppu;
const sal_uInt16 NON_USER_DEFINED_GLUE_POINTS = 4;
+namespace {
+
class SvxUnoGluePointAccess : public WeakImplHelper< container::XIndexContainer, container::XIdentifierContainer >
{
private:
@@ -75,6 +77,8 @@ public:
virtual sal_Bool SAL_CALL hasElements( ) override;
};
+}
+
static void convert( const SdrGluePoint& rSdrGlue, drawing::GluePoint2& rUnoGlue ) throw()
{
rUnoGlue.Position.X = rSdrGlue.GetPos().X();
diff --git a/svx/source/unodraw/unobtabl.cxx b/svx/source/unodraw/unobtabl.cxx
index c80ffcb69f10..f94369907f73 100644
--- a/svx/source/unodraw/unobtabl.cxx
+++ b/svx/source/unodraw/unobtabl.cxx
@@ -36,6 +36,8 @@
using namespace ::com::sun::star;
using namespace ::cppu;
+namespace {
+
class SvxUnoBitmapTable : public SvxUnoNameItemTable
{
public:
@@ -52,6 +54,8 @@ public:
virtual uno::Type SAL_CALL getElementType( ) override;
};
+}
+
SvxUnoBitmapTable::SvxUnoBitmapTable( SdrModel* pModel ) throw()
: SvxUnoNameItemTable( pModel, XATTR_FILLBITMAP, MID_BITMAP )
{
diff --git a/svx/source/unodraw/unodtabl.cxx b/svx/source/unodraw/unodtabl.cxx
index c827a288fafe..f285ac30c7d1 100644
--- a/svx/source/unodraw/unodtabl.cxx
+++ b/svx/source/unodraw/unodtabl.cxx
@@ -33,6 +33,8 @@
using namespace ::com::sun::star;
using namespace ::cppu;
+namespace {
+
class SvxUnoDashTable : public SvxUnoNameItemTable
{
public:
@@ -48,6 +50,8 @@ public:
virtual uno::Type SAL_CALL getElementType( ) override;
};
+}
+
SvxUnoDashTable::SvxUnoDashTable( SdrModel* pModel ) throw()
: SvxUnoNameItemTable( pModel, XATTR_LINEDASH, MID_LINEDASH )
{
diff --git a/svx/source/unodraw/unogtabl.cxx b/svx/source/unodraw/unogtabl.cxx
index f33d947fcd08..4b3842c9d026 100644
--- a/svx/source/unodraw/unogtabl.cxx
+++ b/svx/source/unodraw/unogtabl.cxx
@@ -32,6 +32,8 @@
using namespace ::com::sun::star;
using namespace ::cppu;
+namespace {
+
class SvxUnoGradientTable : public SvxUnoNameItemTable
{
public:
@@ -47,6 +49,8 @@ public:
virtual uno::Type SAL_CALL getElementType( ) override;
};
+}
+
SvxUnoGradientTable::SvxUnoGradientTable( SdrModel* pModel ) throw()
: SvxUnoNameItemTable( pModel, XATTR_FILLGRADIENT, MID_FILLGRADIENT )
{
diff --git a/svx/source/unodraw/unohtabl.cxx b/svx/source/unodraw/unohtabl.cxx
index 8e21de8229bd..ec114ba91b10 100644
--- a/svx/source/unodraw/unohtabl.cxx
+++ b/svx/source/unodraw/unohtabl.cxx
@@ -32,6 +32,8 @@
using namespace ::com::sun::star;
using namespace ::cppu;
+namespace {
+
class SvxUnoHatchTable : public SvxUnoNameItemTable
{
public:
@@ -47,6 +49,8 @@ public:
virtual uno::Type SAL_CALL getElementType( ) override;
};
+}
+
SvxUnoHatchTable::SvxUnoHatchTable( SdrModel* pModel ) throw()
: SvxUnoNameItemTable( pModel, XATTR_FILLHATCH, MID_FILLHATCH )
{
diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx
index a6d56f20d479..ec1d0d4cbfe1 100644
--- a/svx/source/unodraw/unomtabl.cxx
+++ b/svx/source/unodraw/unomtabl.cxx
@@ -51,6 +51,8 @@ using namespace ::cppu;
typedef std::vector<std::unique_ptr<SfxItemSet>> ItemPoolVector;
+namespace {
+
class SvxUnoMarkerTable : public WeakImplHelper< container::XNameContainer, lang::XServiceInfo >,
public SfxListener
{
@@ -93,6 +95,8 @@ public:
virtual sal_Bool SAL_CALL hasElements( ) override;
};
+}
+
SvxUnoMarkerTable::SvxUnoMarkerTable( SdrModel* pModel ) throw()
: mpModel( pModel ),
mpModelPool( pModel ? &pModel->GetItemPool() : nullptr )
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 06bd11bda42e..891423952aff 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -861,11 +861,15 @@ sal_uInt32 UHashMap::getId( const OUString& rCompareString )
return it->second;
}
+namespace {
+
struct theSvxMapProvider :
public rtl::Static<SvxUnoPropertyMapProvider, theSvxMapProvider>
{
};
+}
+
SvxUnoPropertyMapProvider& getSvxMapProvider()
{
return theSvxMapProvider::get();
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx
index 10ab55650102..aaa66de99511 100644
--- a/svx/source/unodraw/unoshap3.cxx
+++ b/svx/source/unodraw/unoshap3.cxx
@@ -246,6 +246,7 @@ static void ConvertObjectToHomogenMatric( E3dObject const * pObject, Any& rValue
rValue <<= aHomMat;
}
+namespace {
struct ImpRememberTransAndRect
{
@@ -253,6 +254,8 @@ struct ImpRememberTransAndRect
tools::Rectangle maRect;
};
+}
+
bool Svx3DSceneObject::setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue )
{
switch( pProperty->nWID )
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 6ebb7a090f36..37283fa085f6 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -142,6 +142,8 @@ struct SvxShapeImpl
}
};
+namespace {
+
class ShapePositionProvider : public PropertyValueProvider
{
public:
@@ -173,6 +175,8 @@ protected:
}
};
+}
+
SvxShape::SvxShape( SdrObject* pObject )
: maSize(100,100)
, mpImpl( new SvxShapeImpl( *this, maMutex ) )
diff --git a/svx/source/unodraw/unottabl.cxx b/svx/source/unodraw/unottabl.cxx
index 2ad927a35716..9653f36360bb 100644
--- a/svx/source/unodraw/unottabl.cxx
+++ b/svx/source/unodraw/unottabl.cxx
@@ -32,6 +32,8 @@
using namespace ::com::sun::star;
using namespace ::cppu;
+namespace {
+
class SvxUnoTransGradientTable : public SvxUnoNameItemTable
{
public:
@@ -47,6 +49,8 @@ public:
virtual uno::Type SAL_CALL getElementType( ) override;
};
+}
+
SvxUnoTransGradientTable::SvxUnoTransGradientTable( SdrModel* pModel ) throw()
: SvxUnoNameItemTable( pModel, XATTR_FILLFLOATTRANSPARENCE, MID_FILLGRADIENT )
{