summaryrefslogtreecommitdiff
path: root/xmloff/source/text
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-11-16 21:00:53 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-11-17 00:28:17 +0100
commit314f15bff08b76bf96acf99141776ef64d2f1355 (patch)
tree842f7b109d9c4a57fa47fc5089f5818b2610368b /xmloff/source/text
parent46920005f74edcb70acfb8dd1a0ffb9553e5c2b2 (diff)
Extend loplugin:external to warn about enums
To mitigate the dangers of silently breaking ADL when moving enums into unnamed namespaces (see the commit message of 206b5b2661be37efdff3c6aedb6f248c4636be79 "New loplugin:external"), note all functions that are affected. (The plan is to extend loplugin:external further to also warn about classes and class templates, and the code to identify affected functions already takes that into account, so some parts of that code are not actually relevant for enums.) But it appears that none of the functions that are actually affected by the changes in this commit relied on being found through ADL, so no adaptions were necessary for them. (clang::DeclContext::collectAllContexts is non-const, which recursively means that External's Visit... functions must take non-const Decl*. Which required compilerplugins/clang/sharedvisitor/analyzer.cxx to be generalized to support such Visit... functions with non-const Decl* parameters.) Change-Id: Ia215291402bf850d43defdab3cff4db5b270d1bd Reviewed-on: https://gerrit.libreoffice.org/83001 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'xmloff/source/text')
-rw-r--r--xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx4
-rw-r--r--xmloff/source/text/XMLFootnoteImportContext.cxx3
-rw-r--r--xmloff/source/text/XMLIndexTemplateContext.cxx3
-rw-r--r--xmloff/source/text/XMLSectionExport.cxx3
-rw-r--r--xmloff/source/text/XMLSectionImportContext.cxx3
-rw-r--r--xmloff/source/text/XMLSectionSourceDDEImportContext.cxx4
-rw-r--r--xmloff/source/text/XMLSectionSourceImportContext.cxx3
-rw-r--r--xmloff/source/text/XMLTextColumnsContext.cxx4
-rw-r--r--xmloff/source/text/XMLTextMarkImportContext.cxx4
-rw-r--r--xmloff/source/text/txtdropi.cxx3
-rw-r--r--xmloff/source/text/txtfldi.cxx3
-rw-r--r--xmloff/source/text/txtparae.cxx8
-rw-r--r--xmloff/source/text/txtvfldi.cxx3
13 files changed, 47 insertions, 1 deletions
diff --git a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
index d9ce1134ca1f..cf3beb02918f 100644
--- a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
+++ b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
@@ -159,6 +159,8 @@ XMLFootnoteConfigurationImportContext::~XMLFootnoteConfigurationImportContext()
{
}
+namespace {
+
enum XMLFtnConfigToken
{
XML_TOK_FTNCONFIG_CITATION_STYLENAME,
@@ -174,6 +176,8 @@ enum XMLFtnConfigToken
XML_TOK_FTNCONFIG_POSITION
};
+}
+
static const SvXMLTokenMapEntry aTextFieldAttrTokenMap[] =
{
{ XML_NAMESPACE_TEXT, XML_CITATION_STYLE_NAME, XML_TOK_FTNCONFIG_CITATION_STYLENAME },
diff --git a/xmloff/source/text/XMLFootnoteImportContext.cxx b/xmloff/source/text/XMLFootnoteImportContext.cxx
index 9569d4119a84..4361417f28f6 100644
--- a/xmloff/source/text/XMLFootnoteImportContext.cxx
+++ b/xmloff/source/text/XMLFootnoteImportContext.cxx
@@ -42,12 +42,15 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::xml::sax;
using namespace ::xmloff::token;
+namespace {
enum XMLFootnoteChildToken {
XML_TOK_FTN_NOTE_CITATION,
XML_TOK_FTN_NOTE_BODY
};
+}
+
static const SvXMLTokenMapEntry aFootnoteChildTokenMap[] =
{
{ XML_NAMESPACE_TEXT, XML_NOTE_CITATION,
diff --git a/xmloff/source/text/XMLIndexTemplateContext.cxx b/xmloff/source/text/XMLIndexTemplateContext.cxx
index 02d545cdd871..66be9d7a576e 100644
--- a/xmloff/source/text/XMLIndexTemplateContext.cxx
+++ b/xmloff/source/text/XMLIndexTemplateContext.cxx
@@ -185,7 +185,7 @@ void XMLIndexTemplateContext::EndElement()
}
}
-
+namespace {
/// template token types; used for aTokenTypeMap parameter
enum TemplateTokenType
{
@@ -199,6 +199,7 @@ enum TemplateTokenType
XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
};
+}
SvXMLEnumMapEntry<TemplateTokenType> const aTemplateTokenTypeMap[] =
{
diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx
index 2ae5b7520bde..db936652cea4 100644
--- a/xmloff/source/text/XMLSectionExport.cxx
+++ b/xmloff/source/text/XMLSectionExport.cxx
@@ -1041,6 +1041,7 @@ bool XMLSectionExport::ExportIndexTemplate(
return true;
}
+namespace {
enum TemplateTypeEnum
{
@@ -1070,6 +1071,8 @@ enum TemplateParamEnum
TOK_TPARAM_BIBLIOGRAPHY_DATA
};
+}
+
SvXMLEnumStringMapEntry<TemplateTypeEnum> const aTemplateTypeMap[] =
{
ENUM_STRING_MAP_ENTRY( "TokenEntryNumber", TOK_TTYPE_ENTRY_NUMBER ),
diff --git a/xmloff/source/text/XMLSectionImportContext.cxx b/xmloff/source/text/XMLSectionImportContext.cxx
index e7754047aacd..d5783a26fcc3 100644
--- a/xmloff/source/text/XMLSectionImportContext.cxx
+++ b/xmloff/source/text/XMLSectionImportContext.cxx
@@ -47,6 +47,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::text;
using namespace ::xmloff::token;
+namespace {
enum XMLSectionToken
{
@@ -60,6 +61,8 @@ enum XMLSectionToken
XML_TOK_SECTION_IS_HIDDEN
};
+}
+
static const SvXMLTokenMapEntry aSectionTokenMap[] =
{
{ XML_NAMESPACE_XML , XML_ID, XML_TOK_SECTION_XMLID },
diff --git a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
index beecdbb5b396..3969baba9cc0 100644
--- a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
+++ b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
@@ -53,6 +53,8 @@ XMLSectionSourceDDEImportContext::~XMLSectionSourceDDEImportContext()
{
}
+namespace {
+
enum XMLSectionSourceDDEToken
{
XML_TOK_SECTION_DDE_APPLICATION,
@@ -61,6 +63,8 @@ enum XMLSectionSourceDDEToken
XML_TOK_SECTION_IS_AUTOMATIC_UPDATE
};
+}
+
static const SvXMLTokenMapEntry aSectionSourceDDETokenMap[] =
{
{ XML_NAMESPACE_OFFICE, XML_DDE_APPLICATION,
diff --git a/xmloff/source/text/XMLSectionSourceImportContext.cxx b/xmloff/source/text/XMLSectionSourceImportContext.cxx
index 006fbe5b076e..ec6bd06dec27 100644
--- a/xmloff/source/text/XMLSectionSourceImportContext.cxx
+++ b/xmloff/source/text/XMLSectionSourceImportContext.cxx
@@ -52,6 +52,7 @@ XMLSectionSourceImportContext::~XMLSectionSourceImportContext()
{
}
+namespace {
enum XMLSectionSourceToken
{
XML_TOK_SECTION_XLINK_HREF,
@@ -59,6 +60,8 @@ enum XMLSectionSourceToken
XML_TOK_SECTION_TEXT_SECTION_NAME
};
+}
+
static const SvXMLTokenMapEntry aSectionSourceTokenMap[] =
{
{ XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SECTION_XLINK_HREF },
diff --git a/xmloff/source/text/XMLTextColumnsContext.cxx b/xmloff/source/text/XMLTextColumnsContext.cxx
index b62b66fde137..b8f3d55e4884 100644
--- a/xmloff/source/text/XMLTextColumnsContext.cxx
+++ b/xmloff/source/text/XMLTextColumnsContext.cxx
@@ -40,6 +40,8 @@ using namespace ::com::sun::star::style;
using namespace ::com::sun::star::beans;
using namespace ::xmloff::token;
+namespace {
+
enum SvXMLTokenMapAttrs
{
XML_TOK_COLUMN_WIDTH,
@@ -56,6 +58,8 @@ enum SvXMLSepTokenMapAttrs
XML_TOK_COLUMN_SEP_STYLE
};
+}
+
static const SvXMLTokenMapEntry aColAttrTokenMap[] =
{
{ XML_NAMESPACE_STYLE, XML_REL_WIDTH, XML_TOK_COLUMN_WIDTH },
diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx
index 9d13c810b240..4dd5c1e76f90 100644
--- a/xmloff/source/text/XMLTextMarkImportContext.cxx
+++ b/xmloff/source/text/XMLTextMarkImportContext.cxx
@@ -107,11 +107,15 @@ XMLTextMarkImportContext::XMLTextMarkImportContext(
{
}
+namespace {
+
enum lcl_MarkType { TypeReference, TypeReferenceStart, TypeReferenceEnd,
TypeBookmark, TypeBookmarkStart, TypeBookmarkEnd,
TypeFieldmark, TypeFieldmarkStart, TypeFieldmarkEnd
};
+}
+
static SvXMLEnumMapEntry<lcl_MarkType> const lcl_aMarkTypeMap[] =
{
{ XML_REFERENCE_MARK, TypeReference },
diff --git a/xmloff/source/text/txtdropi.cxx b/xmloff/source/text/txtdropi.cxx
index 8e7dc0e2100b..cceb49caa51c 100644
--- a/xmloff/source/text/txtdropi.cxx
+++ b/xmloff/source/text/txtdropi.cxx
@@ -37,6 +37,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::style;
using namespace ::xmloff::token;
+namespace {
enum SvXMLTokenMapDropAttrs
{
@@ -46,6 +47,8 @@ enum SvXMLTokenMapDropAttrs
XML_TOK_DROP_STYLE
};
+}
+
static const SvXMLTokenMapEntry aDropAttrTokenMap[] =
{
{ XML_NAMESPACE_STYLE, XML_LINES, XML_TOK_DROP_LINES },
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index cde1edd6daa3..10e246596821 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -2666,6 +2666,7 @@ void XMLReferenceFieldImportContext::PrepareField(
// field declarations container
+namespace {
enum DdeFieldDeclAttrs
{
@@ -2676,6 +2677,8 @@ enum DdeFieldDeclAttrs
XML_TOK_DDEFIELD_UPDATE
};
+}
+
static const SvXMLTokenMapEntry aDdeDeclAttrTokenMap[] =
{
{ XML_NAMESPACE_OFFICE, XML_NAME, XML_TOK_DDEFIELD_NAME },
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 0238e918535d..00b4968aa5fe 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -355,6 +355,8 @@ static const sal_Char* aParagraphPropertyNamesAuto[] =
nullptr
};
+namespace {
+
enum eParagraphPropertyNamesEnumAuto
{
NUMBERING_RULES_AUTO = 0,
@@ -362,6 +364,8 @@ enum eParagraphPropertyNamesEnumAuto
PARA_STYLE_NAME_AUTO = 2
};
+}
+
static const sal_Char* aParagraphPropertyNames[] =
{
"NumberingIsNumber",
@@ -373,6 +377,8 @@ static const sal_Char* aParagraphPropertyNames[] =
nullptr
};
+namespace {
+
enum eParagraphPropertyNamesEnum
{
NUMBERING_IS_NUMBER = 0,
@@ -383,6 +389,8 @@ enum eParagraphPropertyNamesEnum
TEXT_SECTION = 5
};
+}
+
void BoundFrames::Fill(const filter_t& rFilter)
{
if(!m_xEnumAccess.is())
diff --git a/xmloff/source/text/txtvfldi.cxx b/xmloff/source/text/txtvfldi.cxx
index 5a1f2255035e..e2ddd6ec42d5 100644
--- a/xmloff/source/text/txtvfldi.cxx
+++ b/xmloff/source/text/txtvfldi.cxx
@@ -1052,6 +1052,7 @@ void XMLDatabaseDisplayImportContext::EndElement()
// value import helper
+namespace {
enum ValueType
{
@@ -1064,6 +1065,8 @@ enum ValueType
XML_VALUE_TYPE_BOOLEAN
};
+}
+
static SvXMLEnumMapEntry<ValueType> const aValueTypeMap[] =
{
{ XML_FLOAT, XML_VALUE_TYPE_FLOAT },