summaryrefslogtreecommitdiff
path: root/svtools
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 /svtools
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 'svtools')
-rw-r--r--svtools/source/config/helpopt.cxx3
-rw-r--r--svtools/source/config/htmlcfg.cxx5
-rw-r--r--svtools/source/control/ctrltool.cxx5
-rw-r--r--svtools/source/svhtml/parhtml.cxx4
4 files changed, 16 insertions, 1 deletions
diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx
index 07834d8bf76c..1137caaef436 100644
--- a/svtools/source/config/helpopt.cxx
+++ b/svtools/source/config/helpopt.cxx
@@ -38,7 +38,6 @@ using namespace com::sun::star;
namespace {
//global
std::weak_ptr<SvtHelpOptions_Impl> g_pHelpOptions;
-}
enum class HelpProperty
{
@@ -50,6 +49,8 @@ enum class HelpProperty
OfflineHelpPopUp = 5
};
+}
+
class SvtHelpOptions_Impl : public utl::ConfigItem
{
bool bExtendedHelp;
diff --git a/svtools/source/config/htmlcfg.cxx b/svtools/source/config/htmlcfg.cxx
index ed8fbfe49f96..fbd7f57e282f 100644
--- a/svtools/source/config/htmlcfg.cxx
+++ b/svtools/source/config/htmlcfg.cxx
@@ -29,6 +29,8 @@
#include <o3tl/typed_flags_set.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+namespace {
+
enum class HtmlCfgFlags {
NONE = 0x000,
UnknownTags = 0x001,
@@ -39,6 +41,9 @@ enum class HtmlCfgFlags {
IsBasicWarning = 0x080,
NumbersEnglishUS = 0x100,
};
+
+}
+
namespace o3tl {
template<> struct typed_flags<HtmlCfgFlags> : is_typed_flags<HtmlCfgFlags, 0x1f9> {};
}
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index 2ba347bf73d9..957e153e916a 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -89,12 +89,17 @@ public:
OutputDevice* GetDevice() const { return mpDevice; }
};
+namespace {
+
enum class FontListFontNameType
{
NONE = 0x00,
PRINTER = 0x01,
SCREEN = 0x02,
};
+
+}
+
namespace o3tl
{
template<> struct typed_flags<FontListFontNameType> : is_typed_flags<FontListFontNameType, 0x3> {};
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 6ce236566e61..523ed4fb28e4 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -1894,6 +1894,8 @@ bool HTMLParser::InternalImgToPrivateURL( OUString& rURL )
return bFound;
}
+namespace {
+
enum class HtmlMeta {
NONE = 0,
Author,
@@ -1910,6 +1912,8 @@ enum class HtmlMeta {
ContentType
};
+}
+
// <META NAME=xxx>
static HTMLOptionEnum<HtmlMeta> const aHTMLMetaNameTable[] =
{