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 /cui | |
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 'cui')
-rw-r--r-- | cui/source/dialogs/colorpicker.cxx | 13 | ||||
-rw-r--r-- | cui/source/options/optdict.cxx | 4 | ||||
-rw-r--r-- | cui/source/options/optlingu.cxx | 4 | ||||
-rw-r--r-- | cui/source/tabpages/autocdlg.cxx | 8 | ||||
-rw-r--r-- | cui/source/tabpages/paragrph.cxx | 4 | ||||
-rw-r--r-- | cui/source/tabpages/swpossizetabpage.cxx | 9 | ||||
-rw-r--r-- | cui/source/tabpages/tparea.cxx | 4 | ||||
-rw-r--r-- | cui/source/tabpages/tpbitmap.cxx | 4 |
8 files changed, 50 insertions, 0 deletions
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx index bddca8e8ca81..e3b46bcdec87 100644 --- a/cui/source/dialogs/colorpicker.cxx +++ b/cui/source/dialogs/colorpicker.cxx @@ -43,6 +43,8 @@ using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::beans; using namespace ::basegfx; +namespace { + enum class UpdateFlags { NONE = 0x00, @@ -54,6 +56,9 @@ enum class UpdateFlags Hex = 0x20, All = 0x3f, }; + +} + namespace o3tl { template<> struct typed_flags<UpdateFlags> : is_typed_flags<UpdateFlags, 0x3f> {}; } @@ -62,6 +67,8 @@ namespace o3tl { namespace cui { +namespace { + enum class ColorComponent { Red, Green, @@ -75,6 +82,7 @@ enum class ColorComponent { Key, }; +} // color space conversion helpers @@ -171,7 +179,12 @@ void ColorPreviewControl::Paint(vcl::RenderContext& rRenderContext, const tools: rRenderContext.DrawRect(tools::Rectangle(Point(0, 0), GetOutputSizePixel())); } +namespace { + enum ColorMode { HUE, SATURATION, BRIGHTNESS, RED, GREEN, BLUE }; + +} + const ColorMode DefaultMode = HUE; class ColorFieldControl : public weld::CustomWidgetController diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index 07080a75184a..9e00183209e3 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -66,9 +66,13 @@ static OUString getNormDicEntry_Impl(const OUString &rText) return aTmp.replaceAll("=", ""); } +namespace { + // Compare Dictionary Entry result enum CDE_RESULT { CDE_EQUAL, CDE_SIMILAR, CDE_DIFFERENT }; +} + static CDE_RESULT cmpDicEntry_Impl( const OUString &rText1, const OUString &rText2 ) { CDE_RESULT eRes = CDE_DIFFERENT; diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 2026c73826a9..5e394e9753e3 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -172,6 +172,8 @@ DicUserData::DicUserData( Entry IDs for options listbox of dialog --------------------------------------------------*/ +namespace { + enum EID_OPTIONS { EID_SPELL_AUTO, @@ -186,6 +188,8 @@ enum EID_OPTIONS EID_HYPH_SPECIAL }; +} + //! this array must have an entry for every value of EID_OPTIONS. // It is used to get the respective property name. static const char * aEidToPropName[] = diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index cae7b77fdd40..edb129d8c227 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -321,6 +321,8 @@ public: /* */ /*********************************************************************/ +namespace { + enum OfaAutoFmtOptions { USE_REPLACE_TABLE, @@ -343,6 +345,8 @@ enum OfaAutoFmtOptions MERGE_SINGLE_LINE_PARA }; +} + OfaSwAutoFmtOptionsPage::OfaSwAutoFmtOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet ) : SfxTabPage(pPage, pController, "cui/ui/applyautofmtpage.ui", "ApplyAutoFmtPage", &rSet) @@ -1516,12 +1520,16 @@ IMPL_LINK(OfaAutocorrExceptPage, ModifyHdl, weld::Entry&, rEdt, void) } } +namespace { + enum OfaQuoteOptions { ADD_NONBRK_SPACE, REPLACE_1ST }; +} + void OfaQuoteTabPage::CreateEntry(weld::TreeView& rCheckLB, const OUString& rTxt, sal_uInt16 nCol, sal_uInt16 nTextCol) { rCheckLB.append(); diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index 7990744f1cc3..8cfb01fa1a31 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -84,6 +84,8 @@ const sal_uInt16 SvxExtParagraphTabPage::pExtRanges[] = // according to BP #define FIX_DIST_DEF 283 // standard fix distance 0,5 cm +namespace { + enum LineSpaceList { LLINESPACE_1 = 0, @@ -96,6 +98,8 @@ enum LineSpaceList LLINESPACE_FIX = 7 }; +} + static void SetLineSpace_Impl( SvxLineSpacingItem&, int, long lValue = 0 ); void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace, diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx index 46a210559892..33a0649d21e6 100644 --- a/cui/source/tabpages/swpossizetabpage.cxx +++ b/cui/source/tabpages/swpossizetabpage.cxx @@ -41,8 +41,12 @@ using namespace ::com::sun::star::text; #define SwFPos SvxSwFramePosString +namespace { + enum class LB; +} + struct FrmMap { SvxSwFramePosString::StringId eStrId; @@ -64,6 +68,8 @@ struct StringIdPair_Impl SvxSwFramePosString::StringId eVert; }; +namespace { + enum class LB { NONE = 0x000000, Frame = 0x000001, // paragraph text area @@ -96,6 +102,9 @@ enum class LB { LAST = VertLine }; + +} + namespace o3tl { template<> struct typed_flags<LB> : is_typed_flags<LB, 0x0fffff> {}; } diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx index d0c70b60c456..079b717c3efe 100644 --- a/cui/source/tabpages/tparea.cxx +++ b/cui/source/tabpages/tparea.cxx @@ -32,6 +32,8 @@ using namespace com::sun::star; // static ---------------------------------------------------------------- +namespace { + enum FillType { TRANSPARENT, @@ -42,6 +44,8 @@ enum FillType PATTERN }; +} + const sal_uInt16 SvxAreaTabPage::pAreaRanges[] = { XATTR_GRADIENTSTEPCOUNT, diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 7d1f17be236b..aea68537a5fa 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -48,6 +48,8 @@ using namespace com::sun::star; +namespace { + enum BitmapStyle { CUSTOM, @@ -61,6 +63,8 @@ enum TileOffset COLUMN }; +} + const sal_uInt16 SvxBitmapTabPage::pBitmapRanges[] = { SID_ATTR_TRANSFORM_WIDTH, |