summaryrefslogtreecommitdiff
path: root/sd/source/filter
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-11-19 16:32:49 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-11-22 12:57:32 +0100
commitf853ec317f6af1b8c65cc5bd758371689c75118d (patch)
treeb86d729bf9a9465ee619ead3b5635efa62a1804e /sd/source/filter
parentf31d36966bceb90e261cbecd42634bde4448d527 (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 'sd/source/filter')
-rw-r--r--sd/source/filter/eppt/epptso.cxx4
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx4
-rw-r--r--sd/source/filter/grf/sdgrffilter.cxx4
-rw-r--r--sd/source/filter/html/HtmlOptionsDialog.cxx4
-rw-r--r--sd/source/filter/html/buttonset.cxx4
-rw-r--r--sd/source/filter/html/htmlex.cxx4
-rw-r--r--sd/source/filter/html/pubdlg.cxx4
-rw-r--r--sd/source/filter/ppt/pptin.cxx4
-rw-r--r--sd/source/filter/xml/sdtransform.cxx4
-rw-r--r--sd/source/filter/xml/sdxmlwrp.cxx4
10 files changed, 38 insertions, 2 deletions
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index e03db4c9ddd3..1cd19b23c1f8 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -3035,6 +3035,8 @@ void PPTWriter::WriteCString( SvStream& rSt, const OUString& rString, sal_uInt32
}
}
+namespace {
+
class ContainerGuard
{
private:
@@ -3051,6 +3053,8 @@ public:
}
};
+}
+
void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape > const & rXShape, EscherSolverContainer& aSolverContainer,
EscherPropertyContainer& aPropOpt )
{
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 9ef75df597ad..9789e20a343c 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -152,8 +152,6 @@ enum PPTXLayout
LAYOUT_SIZE
};
-}
-
struct PPTXLayoutInfo
{
int const nType;
@@ -161,6 +159,8 @@ struct PPTXLayoutInfo
const char* sType;
};
+}
+
static const PPTXLayoutInfo aLayoutInfo[LAYOUT_SIZE] =
{
{ 20, "Blank Slide", "blank" },
diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx
index d16491dff288..c1f920362b81 100644
--- a/sd/source/filter/grf/sdgrffilter.cxx
+++ b/sd/source/filter/grf/sdgrffilter.cxx
@@ -59,6 +59,8 @@ using namespace ::com::sun::star::ucb;
using namespace com::sun::star::ui::dialogs;
using namespace ::sfx2;
+namespace {
+
class SdGRFFilter_ImplInteractionHdl : public ::cppu::WeakImplHelper< css::task::XInteractionHandler >
{
css::uno::Reference< css::task::XInteractionHandler > m_xInter;
@@ -76,6 +78,8 @@ class SdGRFFilter_ImplInteractionHdl : public ::cppu::WeakImplHelper< css::task:
virtual void SAL_CALL handle( const css::uno::Reference< css::task::XInteractionRequest >& ) override;
};
+}
+
void SdGRFFilter_ImplInteractionHdl::handle( const css::uno::Reference< css::task::XInteractionRequest >& xRequest )
{
if( !m_xInter.is() )
diff --git a/sd/source/filter/html/HtmlOptionsDialog.cxx b/sd/source/filter/html/HtmlOptionsDialog.cxx
index ec523e2c86aa..5db49c2af647 100644
--- a/sd/source/filter/html/HtmlOptionsDialog.cxx
+++ b/sd/source/filter/html/HtmlOptionsDialog.cxx
@@ -38,6 +38,8 @@ using namespace com::sun::star::ui::dialogs;
#include <pres.hxx>
#include <sdabstdlg.hxx>
+namespace {
+
class SdHtmlOptionsDialog : public cppu::WeakImplHelper
<
XExporter,
@@ -80,6 +82,8 @@ public:
};
+}
+
SdHtmlOptionsDialog::SdHtmlOptionsDialog() :
meDocType ( DocumentType::Draw )
{
diff --git a/sd/source/filter/html/buttonset.cxx b/sd/source/filter/html/buttonset.cxx
index 751e5db0b63f..cb382303287f 100644
--- a/sd/source/filter/html/buttonset.cxx
+++ b/sd/source/filter/html/buttonset.cxx
@@ -45,6 +45,8 @@ using namespace ::com::sun::star::io;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
+namespace {
+
class ButtonsImpl
{
public:
@@ -60,6 +62,8 @@ private:
Reference< XStorage > mxStorage;
};
+}
+
ButtonsImpl::ButtonsImpl( const OUString& rURL )
{
try
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index ad8e2a97eae6..77189e3d543d 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -114,6 +114,8 @@ const char * const pButtonNames[] =
#define BTN_MORE 10
#define BTN_LESS 11
+namespace {
+
// Helper class for the simple creation of files local/remote
class EasyFile
{
@@ -131,6 +133,8 @@ public:
void close();
};
+}
+
// Helper class for the embedding of text attributes into the html output
class HtmlState
{
diff --git a/sd/source/filter/html/pubdlg.cxx b/sd/source/filter/html/pubdlg.cxx
index 7623d34a115d..6026e78c67aa 100644
--- a/sd/source/filter/html/pubdlg.cxx
+++ b/sd/source/filter/html/pubdlg.cxx
@@ -335,6 +335,8 @@ SvStream& WriteSdPublishingDesign(SvStream& rOut, const SdPublishingDesign& rDes
return rOut;
}
+namespace {
+
// Dialog for the entry of the name of the design
class SdDesignNameDlg : public weld::GenericDialogController
{
@@ -348,6 +350,8 @@ public:
DECL_LINK(ModifyHdl, weld::Entry&, void);
};
+}
+
// SdPublishingDlg Methods
SdPublishingDlg::SdPublishingDlg(weld::Window* pWindow, DocumentType eDocType)
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 89af5b41019c..c2f30fa880e4 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -1475,12 +1475,16 @@ void ImplSdPPTImport::SetHeaderFooterPageSettings( SdPage* pPage, const PptSlide
}
}
+namespace {
+
// Import of pages
struct Ppt97AnimationStlSortHelper
{
bool operator()( const std::pair< SdrObject*, Ppt97AnimationPtr >& p1, const std::pair< SdrObject*, Ppt97AnimationPtr >& p2 );
};
+}
+
bool Ppt97AnimationStlSortHelper::operator()( const std::pair< SdrObject*, Ppt97AnimationPtr >& p1, const std::pair< SdrObject*, Ppt97AnimationPtr >& p2 )
{
if( !p1.second.get() || !p2.second.get() )
diff --git a/sd/source/filter/xml/sdtransform.cxx b/sd/source/filter/xml/sdtransform.cxx
index fa0cced78971..586d6ba9dbdc 100644
--- a/sd/source/filter/xml/sdtransform.cxx
+++ b/sd/source/filter/xml/sdtransform.cxx
@@ -34,6 +34,8 @@
using namespace ::com::sun::star::style;
+namespace {
+
class SdTransformOOo2xDocument
{
public:
@@ -65,6 +67,8 @@ public:
SdrOutliner& mrOutliner;
};
+}
+
/** transforms the given model from OOo 2.x to OOo 3.x. This maps
the deprecated EE_PARA_BULLETSTATE and clears the EE_PARA_LRSPACE
if used together with a EE_PARA_NUMBULLET */
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx
index f23eabd0f6c8..90e0e4f120fa 100644
--- a/sd/source/filter/xml/sdxmlwrp.cxx
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -126,6 +126,8 @@ char const sXML_import_draw_styles_ooo_service[] = "com.sun.star.comp.Draw.XMLSt
char const sXML_import_draw_content_ooo_service[] = "com.sun.star.comp.Draw.XMLContentImporter";
char const sXML_import_draw_settings_ooo_service[] = "com.sun.star.comp.Draw.XMLSettingsImporter";
+namespace {
+
struct XML_SERVICEMAP
{
const sal_Char* mpService;
@@ -140,6 +142,8 @@ struct XML_SERVICES
const sal_Char* mpSettings;
};
+}
+
static XML_SERVICES const * getServices( bool bImport, bool bDraw, sal_uLong nStoreVer )
{
static XML_SERVICES const gServices[] =