diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-11-19 16:32:49 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-11-22 12:57:32 +0100 |
commit | f853ec317f6af1b8c65cc5bd758371689c75118d (patch) | |
tree | b86d729bf9a9465ee619ead3b5635efa62a1804e /reportdesign/source | |
parent | f31d36966bceb90e261cbecd42634bde4448d527 (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 'reportdesign/source')
-rw-r--r-- | reportdesign/source/core/api/ReportDefinition.cxx | 15 | ||||
-rw-r--r-- | reportdesign/source/core/sdr/UndoEnv.cxx | 7 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlExport.cxx | 3 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlFixedContent.cxx | 5 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlStyleImport.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlfilter.cxx | 12 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/GroupsSorting.cxx | 5 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/Navigator.cxx | 3 | ||||
-rw-r--r-- | reportdesign/source/ui/inspection/metadata.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/ui/report/DesignView.cxx | 3 |
10 files changed, 57 insertions, 0 deletions
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index a051e20ea484..296419e4f2db 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -229,11 +229,19 @@ static void lcl_extractAndStartStatusIndicator( const utl::MediaDescriptor& _rDe } typedef ::comphelper::OPropertyStateContainer OStyle_PBASE; + +namespace { + class OStyle; + +} + typedef ::comphelper::OPropertyArrayUsageHelper < OStyle > OStyle_PABASE; typedef ::cppu::WeakImplHelper< style::XStyle, beans::XMultiPropertyStates> TStyleBASE; +namespace { + class OStyle : public ::comphelper::OMutexAndBroadcastHelper ,public TStyleBASE ,public OStyle_PBASE @@ -275,6 +283,8 @@ public: uno::Sequence< uno::Any > SAL_CALL getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames ) override; }; +} + OStyle::OStyle() :OStyle_PBASE(m_aBHelper) ,m_aSize(21000,29700) @@ -2216,6 +2226,9 @@ OUString SAL_CALL OReportDefinition::getShapeType( ) typedef ::cppu::WeakImplHelper< container::XNameContainer, container::XIndexAccess > TStylesBASE; + +namespace { + class OStylesHelper: public cppu::BaseMutex, public TStylesBASE { @@ -2251,6 +2264,8 @@ public: virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; }; +} + OStylesHelper::OStylesHelper(const uno::Type& rType) : cppu::BaseMutex() , m_aType(rType) diff --git a/reportdesign/source/core/sdr/UndoEnv.cxx b/reportdesign/source/core/sdr/UndoEnv.cxx index 80aab3c3a428..645797498c04 100644 --- a/reportdesign/source/core/sdr/UndoEnv.cxx +++ b/reportdesign/source/core/sdr/UndoEnv.cxx @@ -59,6 +59,7 @@ namespace rptui using namespace container; using namespace report; +namespace { struct PropertyInfo { @@ -70,8 +71,12 @@ struct PropertyInfo } }; +} + typedef std::unordered_map< OUString, PropertyInfo > PropertiesInfo; +namespace { + struct ObjectInfo { PropertiesInfo aProperties; @@ -84,6 +89,8 @@ struct ObjectInfo } }; +} + typedef ::std::map< Reference< XPropertySet >, ObjectInfo > PropertySetInfoCache; diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index 2f00950b265c..0c3ad1e70ce3 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -154,6 +154,7 @@ namespace rptxml return aSupported; } + namespace { class OSpecialHandleXMLExportPropertyMapper : public SvXMLExportPropertyMapper { @@ -175,6 +176,8 @@ namespace rptxml } }; + } + static void lcl_adjustColumnSpanOverRows(ORptExport::TSectionsGrid& _rGrid) { for (auto& rEntry : _rGrid) diff --git a/reportdesign/source/filter/xml/xmlFixedContent.cxx b/reportdesign/source/filter/xml/xmlFixedContent.cxx index 94842e6bdb4c..0f33f91e98a9 100644 --- a/reportdesign/source/filter/xml/xmlFixedContent.cxx +++ b/reportdesign/source/filter/xml/xmlFixedContent.cxx @@ -36,6 +36,8 @@ namespace rptxml { using namespace ::com::sun::star; +namespace { + class OXMLCharContent: public XMLCharContext { OXMLFixedContent* m_pFixedContent; @@ -62,6 +64,9 @@ public: virtual void InsertControlCharacter(sal_Int16 _nControl) override; virtual void InsertString(const OUString& _sString) override; }; + +} + OXMLCharContent::OXMLCharContent( SvXMLImport& rImport, OXMLFixedContent* _pFixedContent, diff --git a/reportdesign/source/filter/xml/xmlStyleImport.cxx b/reportdesign/source/filter/xml/xmlStyleImport.cxx index 092f928b22a1..6c454eda45d0 100644 --- a/reportdesign/source/filter/xml/xmlStyleImport.cxx +++ b/reportdesign/source/filter/xml/xmlStyleImport.cxx @@ -44,6 +44,7 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace xmloff::token; +namespace { class OSpecialHanldeXMLImportPropertyMapper : public SvXMLImportPropertyMapper { @@ -64,6 +65,7 @@ public: } }; +} OControlStyleContext::OControlStyleContext( ORptFilter& rImport, sal_uInt16 nPrfx, const OUString& rLName, diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index e4df625cacce..b39b315ce13b 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -83,6 +83,8 @@ using namespace ::com::sun::star::xml::sax; using namespace xmloff; using namespace ::com::sun::star::util; +namespace { + class RptMLMasterStylesContext_Impl: public XMLTextMasterStylesContext { @@ -101,6 +103,8 @@ public: virtual void EndElement() override; }; +} + RptMLMasterStylesContext_Impl::RptMLMasterStylesContext_Impl( ORptFilter& rImport, sal_uInt16 nPrfx, const OUString& rLName , @@ -576,6 +580,8 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) return bRet; } +namespace { + class RptXMLDocumentSettingsContext : public SvXMLImportContext { public: @@ -651,6 +657,8 @@ public: } }; +} + SvXMLImportContextRef RptXMLDocumentBodyContext::CreateChildContext( sal_uInt16 const nPrefix, const OUString& rLocalName, @@ -678,6 +686,8 @@ SvXMLImportContextRef RptXMLDocumentBodyContext::CreateChildContext( } } +namespace { + class RptXMLDocumentContentContext : public SvXMLImportContext { public: @@ -720,6 +730,8 @@ public: } }; +} + SvXMLImportContext* ORptFilter::CreateDocumentContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList >& xAttrList ) diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index abd9102c46fa..b3219be00fe0 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -77,6 +77,9 @@ using namespace ::comphelper; * Separated out from OFieldExpressionControl to prevent collision of ref-counted base classes */ class OFieldExpressionControl; + +namespace { + class OFieldExpressionControlContainerListener : public ::cppu::WeakImplHelper< container::XContainerListener > { VclPtr<OFieldExpressionControl> mpParent; @@ -91,6 +94,8 @@ public: virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& rEvent) override; }; +} + class OFieldExpressionControl : public ::svt::EditBrowseBox { ::osl::Mutex m_aMutex; diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx index 80d018d88220..ef09f4ae2455 100644 --- a/reportdesign/source/ui/dlg/Navigator.cxx +++ b/reportdesign/source/ui/dlg/Navigator.cxx @@ -102,6 +102,7 @@ static OUString lcl_getName(const uno::Reference< beans::XPropertySet>& _xElemen return sName.makeStringAndClear(); } +namespace { class NavigatorTree : public ::cppu::BaseMutex , public SvTreeListBox @@ -205,6 +206,8 @@ private: using SvTreeListBox::ExecuteDrop; }; +} + NavigatorTree::NavigatorTree( vcl::Window* pParent,OReportController& _rController ) :SvTreeListBox( pParent, WB_TABSTOP| WB_HASBUTTONS|WB_HASLINES|WB_BORDER|WB_HSCROLL|WB_HASBUTTONSATROOT ) ,comphelper::OSelectionChangeListener() diff --git a/reportdesign/source/ui/inspection/metadata.cxx b/reportdesign/source/ui/inspection/metadata.cxx index 2fd4bc6bf20d..fe968c7fddd6 100644 --- a/reportdesign/source/ui/inspection/metadata.cxx +++ b/reportdesign/source/ui/inspection/metadata.cxx @@ -63,6 +63,7 @@ namespace rptui { } + namespace { // compare PropertyInfo struct PropertyInfoLessByName @@ -73,6 +74,7 @@ namespace rptui } }; + } //= OPropertyInfoService diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx index de49c0361817..a970d73b9873 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -55,6 +55,8 @@ using namespace container; #define REPORT_ID 2 #define TASKPANE_ID 3 +namespace { + class OTaskWindow : public vcl::Window { VclPtr<PropBrw> m_pPropWin; @@ -76,6 +78,7 @@ public: } }; +} // class ODesignView |