summaryrefslogtreecommitdiff
path: root/xmloff/source/text/txtprhdl.cxx
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 /xmloff/source/text/txtprhdl.cxx
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 'xmloff/source/text/txtprhdl.cxx')
-rw-r--r--xmloff/source/text/txtprhdl.cxx61
1 files changed, 61 insertions, 0 deletions
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index 32644e5f7f1c..2a6e3a32c0d5 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -245,6 +245,8 @@ static SvXMLEnumMapEntry<drawing::TextVerticalAdjust> const pXML_VerticalAlign_E
{ XML_TOKEN_INVALID, drawing::TextVerticalAdjust(0) }
};
+namespace {
+
class XMLDropCapPropHdl_Impl : public XMLPropertyHandler
{
public:
@@ -263,6 +265,8 @@ public:
const SvXMLUnitConverter& ) const override;
};
+}
+
bool XMLDropCapPropHdl_Impl::equals(
const Any& r1,
const Any& r2 ) const
@@ -295,6 +299,8 @@ bool XMLDropCapPropHdl_Impl::exportXML(
return false;
}
+namespace {
+
class XMLOpaquePropHdl_Impl : public XMLPropertyHandler
{
public:
@@ -308,6 +314,8 @@ public:
const SvXMLUnitConverter& ) const override;
};
+}
+
bool XMLOpaquePropHdl_Impl::importXML(
const OUString& rStrImpValue,
Any& rValue,
@@ -339,6 +347,8 @@ bool XMLOpaquePropHdl_Impl::exportXML(
return true;
}
+namespace {
+
class XMLContourModePropHdl_Impl : public XMLPropertyHandler
{
public:
@@ -352,6 +362,8 @@ public:
const SvXMLUnitConverter& ) const override;
};
+}
+
bool XMLContourModePropHdl_Impl::importXML(
const OUString& rStrImpValue,
Any& rValue,
@@ -383,6 +395,8 @@ bool XMLContourModePropHdl_Impl::exportXML(
return true;
}
+namespace {
+
class XMLParagraphOnlyPropHdl_Impl : public XMLPropertyHandler
{
public:
@@ -396,6 +410,8 @@ public:
const SvXMLUnitConverter& ) const override;
};
+}
+
bool XMLParagraphOnlyPropHdl_Impl::importXML(
const OUString& rStrImpValue,
Any& rValue,
@@ -441,6 +457,8 @@ SvXMLEnumMapEntry<WrapTextMode> const pXML_Wrap_Enum[] =
{ XML_TOKEN_INVALID, WrapTextMode(0) }
};
+namespace {
+
class XMLWrapPropHdl_Impl : public XMLPropertyHandler
{
public:
@@ -454,6 +472,8 @@ public:
const SvXMLUnitConverter& ) const override;
};
+}
+
bool XMLWrapPropHdl_Impl::importXML(
const OUString& rStrImpValue,
Any& rValue,
@@ -486,6 +506,8 @@ bool XMLWrapPropHdl_Impl::exportXML(
return bRet;
}
+namespace {
+
class XMLFrameProtectPropHdl_Impl : public XMLPropertyHandler
{
const OUString sVal;
@@ -503,6 +525,8 @@ public:
const SvXMLUnitConverter& ) const override;
};
+}
+
bool XMLFrameProtectPropHdl_Impl::importXML(
const OUString& rStrImpValue,
Any& rValue,
@@ -661,6 +685,8 @@ bool XMLTextColumnsPropertyHandler::exportXML(
return false;
}
+namespace {
+
class XMLHoriMirrorPropHdl_Impl : public XMLPropertyHandler
{
public:
@@ -674,6 +700,8 @@ public:
const SvXMLUnitConverter& ) const override;
};
+}
+
bool XMLHoriMirrorPropHdl_Impl::importXML(
const OUString& rStrImpValue,
Any& rValue,
@@ -701,6 +729,8 @@ bool XMLHoriMirrorPropHdl_Impl::exportXML(
return false;
}
+namespace {
+
class XMLGrfMirrorPropHdl_Impl : public XMLPropertyHandler
{
const OUString sVal;
@@ -721,6 +751,8 @@ public:
const SvXMLUnitConverter& ) const override;
};
+}
+
bool XMLGrfMirrorPropHdl_Impl::importXML(
const OUString& rStrImpValue,
Any& rValue,
@@ -795,6 +827,9 @@ SvXMLEnumMapEntry<sal_uInt16> const pXML_Emphasize_Enum[] =
{ XML_ACCENT, FontEmphasis::ACCENT_ABOVE },
{ XML_TOKEN_INVALID, 0 }
};
+
+namespace {
+
class XMLTextEmphasizePropHdl_Impl : public XMLPropertyHandler
{
public:
@@ -810,6 +845,8 @@ public:
const SvXMLUnitConverter& ) const override;
};
+}
+
bool XMLTextEmphasizePropHdl_Impl::importXML(
const OUString& rStrImpValue,
Any& rValue,
@@ -891,6 +928,8 @@ bool XMLTextEmphasizePropHdl_Impl::exportXML(
return bRet;
}
+namespace {
+
class XMLTextCombineCharPropHdl_Impl : public XMLPropertyHandler
{
public:
@@ -906,6 +945,8 @@ public:
const SvXMLUnitConverter& ) const override;
};
+}
+
bool XMLTextCombineCharPropHdl_Impl::importXML(
const OUString& rStrImpValue,
Any& rValue,
@@ -930,6 +971,8 @@ bool XMLTextCombineCharPropHdl_Impl::exportXML(
return (1 == rStrExpValue.getLength());
}
+namespace {
+
class XMLTextRelWidthHeightPropHdl_Impl : public XMLPropertyHandler
{
public:
@@ -945,6 +988,8 @@ public:
const SvXMLUnitConverter& ) const override;
};
+}
+
bool XMLTextRelWidthHeightPropHdl_Impl::importXML(
const OUString& rStrImpValue,
Any& rValue,
@@ -977,6 +1022,8 @@ bool XMLTextRelWidthHeightPropHdl_Impl::exportXML(
return bRet;
}
+namespace {
+
class XMLTextSyncWidthHeightPropHdl_Impl : public XMLPropertyHandler
{
const OUString sValue;
@@ -995,6 +1042,8 @@ public:
const SvXMLUnitConverter& ) const override;
};
+}
+
bool XMLTextSyncWidthHeightPropHdl_Impl::importXML(
const OUString& rStrImpValue,
Any& rValue,
@@ -1020,6 +1069,8 @@ bool XMLTextSyncWidthHeightPropHdl_Impl::exportXML(
return bRet;
}
+namespace {
+
class XMLTextRotationAnglePropHdl_Impl : public XMLPropertyHandler
{
@@ -1036,6 +1087,8 @@ public:
const SvXMLUnitConverter& ) const override;
};
+}
+
bool XMLTextRotationAnglePropHdl_Impl::importXML(
const OUString& rStrImpValue,
Any& rValue,
@@ -1077,6 +1130,8 @@ bool XMLTextRotationAnglePropHdl_Impl::exportXML(
return bRet;
}
+namespace {
+
class XMLNumber8OneBasedHdl : public XMLPropertyHandler
{
@@ -1093,6 +1148,8 @@ public:
const SvXMLUnitConverter& ) const override;
};
+}
+
bool XMLNumber8OneBasedHdl::importXML(
const OUString& rStrImpValue,
Any& rValue,
@@ -1119,6 +1176,8 @@ bool XMLNumber8OneBasedHdl::exportXML(
return bRet;
}
+namespace {
+
class XMLGraphicPropertyHandler : public XMLPropertyHandler
{
public:
@@ -1139,6 +1198,8 @@ public:
virtual bool equals(const css::uno::Any& rAny1, const css::uno::Any& rAny2) const override;
};
+}
+
bool XMLGraphicPropertyHandler::equals(const Any& rAny1, const Any& rAny2) const
{
uno::Reference<graphic::XGraphic> xGraphic1;