diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-11-16 21:00:53 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-11-17 00:28:17 +0100 |
commit | 314f15bff08b76bf96acf99141776ef64d2f1355 (patch) | |
tree | 842f7b109d9c4a57fa47fc5089f5818b2610368b /sd | |
parent | 46920005f74edcb70acfb8dd1a0ffb9553e5c2b2 (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 'sd')
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/sidebar/SlideBackground.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/unoidl/UnoDocumentSettings.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/unoidl/facreg.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unoobj.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 4 |
6 files changed, 26 insertions, 0 deletions
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 8a7db7302ff0..9ef75df597ad 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -133,6 +133,8 @@ void WriteSndAc(const FSHelperPtr& pFS, const OUString& sSoundRelId, const OUStr } } +namespace { + enum PPTXLayout { LAYOUT_BLANK, @@ -150,6 +152,8 @@ enum PPTXLayout LAYOUT_SIZE }; +} + struct PPTXLayoutInfo { int const nType; diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx index 98e57e7d594e..873bbd46759e 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -67,6 +67,8 @@ using ::com::sun::star::uno::Reference; namespace sd { namespace sidebar { +namespace { + enum eFillStyle { NONE, @@ -77,6 +79,8 @@ enum eFillStyle PATTERN }; +} + SlideBackground::SlideBackground( Window * pParent, ViewShellBase& rBase, diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index b765dc59a0dc..701c5462bae6 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -128,6 +128,8 @@ namespace sd return static_cast<XWeak*>(new DocumentSettings( pModel )); } +namespace { + enum SdDocumentSettingsPropertyHandles { HANDLE_PRINTDRAWING, HANDLE_PRINTNOTES, HANDLE_PRINTHANDOUT, HANDLE_PRINTOUTLINE, HANDLE_MEASUREUNIT, HANDLE_SCALE_NUM, @@ -144,6 +146,8 @@ enum SdDocumentSettingsPropertyHandles HANDLE_EMBED_LATIN_SCRIPT_FONTS, HANDLE_EMBED_ASIAN_SCRIPT_FONTS, HANDLE_EMBED_COMPLEX_SCRIPT_FONTS, }; +} + #define MID_PRINTER 1 static rtl::Reference<PropertySetInfo> createSettingsInfoImpl( bool bIsDraw ) diff --git a/sd/source/ui/unoidl/facreg.cxx b/sd/source/ui/unoidl/facreg.cxx index dc93ddb06810..9314a60b4fe2 100644 --- a/sd/source/ui/unoidl/facreg.cxx +++ b/sd/source/ui/unoidl/facreg.cxx @@ -33,11 +33,16 @@ using namespace com::sun::star; // Declaration and initialization of a map from service names to locally // unique factory identifiers. +namespace { + enum FactoryId { SdDrawingDocumentFactoryId, SdPresentationDocumentFactoryId, }; + +} + typedef std::unordered_map<OUString, FactoryId> FactoryMap; namespace { diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 9bcc2126eedf..ae275dd57e82 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -1080,6 +1080,8 @@ SdUnoEventsAccess::SdUnoEventsAccess( SdXShape* pShape ) throw() { } +namespace { + enum class FoundFlags { NONE = 0x0000, ClickAction = 0x0001, @@ -1093,6 +1095,9 @@ enum class FoundFlags { Macro = 0x0100, Library = 0x0200, }; + +} + namespace o3tl { template<> struct typed_flags<FoundFlags> : is_typed_flags<FoundFlags, 0x03ff> {}; } diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 244c27bce6a4..55340b4b91d5 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -78,6 +78,8 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::drawing; using namespace ::com::sun::star::office; +namespace { + // this are the ids for page properties enum WID_PAGE { @@ -93,6 +95,8 @@ enum WID_PAGE WID_NAVORDER, WID_PAGE_PREVIEWMETAFILE }; +} + static sal_Char const sEmptyPageName[sizeof("page")] = "page"; // this function stores the property maps for draw pages in impress and draw |