summaryrefslogtreecommitdiff
path: root/sfx2/source/appl
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 /sfx2/source/appl
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 'sfx2/source/appl')
-rw-r--r--sfx2/source/appl/appcfg.cxx2
-rw-r--r--sfx2/source/appl/appinit.cxx4
-rw-r--r--sfx2/source/appl/appopen.cxx2
-rw-r--r--sfx2/source/appl/childwin.cxx2
-rw-r--r--sfx2/source/appl/impldde.cxx4
-rw-r--r--sfx2/source/appl/linkmgr2.cxx4
-rw-r--r--sfx2/source/appl/linksrc.cxx6
-rw-r--r--sfx2/source/appl/lnkbase2.cxx5
-rw-r--r--sfx2/source/appl/newhelp.cxx4
-rw-r--r--sfx2/source/appl/openuriexternally.cxx4
-rw-r--r--sfx2/source/appl/sfxhelp.cxx12
-rw-r--r--sfx2/source/appl/workwin.cxx4
12 files changed, 53 insertions, 0 deletions
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index 208c23aca8b5..8b9ca9e6f413 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -76,6 +76,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::beans;
+namespace {
class SfxEventAsyncer_Impl : public SfxListener
{
@@ -89,6 +90,7 @@ public:
DECL_LINK( IdleHdl, Timer*, void );
};
+}
void SfxEventAsyncer_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 3b2234e8545b..68ee31f76b89 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -72,6 +72,8 @@ using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star;
+namespace {
+
class SfxTerminateListener_Impl : public ::cppu::WeakImplHelper< XTerminateListener, XServiceInfo >
{
public:
@@ -87,6 +89,8 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
};
+}
+
void SAL_CALL SfxTerminateListener_Impl::disposing( const EventObject& )
{
}
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 5ef87f45cc91..5f6fb65c3684 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -117,6 +117,7 @@ void SetTemplate_Impl( const OUString &rFileName,
pDoc->ResetFromTemplate( rLongName, rFileName );
}
+namespace {
class SfxDocPasswordVerifier : public ::comphelper::IDocPasswordVerifier
{
@@ -134,6 +135,7 @@ private:
Reference< embed::XStorage > mxStorage;
};
+}
::comphelper::DocPasswordVerifierResult SfxDocPasswordVerifier::verifyPassword( const OUString& rPassword, uno::Sequence< beans::NamedValue >& o_rEncryptionData )
{
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index a7013fa6c530..602b24967d5c 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -64,6 +64,7 @@ struct SfxChildWindow_Impl
SfxWorkWindow* pWorkWin;
};
+namespace {
class DisposeListener : public ::cppu::WeakImplHelper< css::lang::XEventListener >
{
@@ -107,6 +108,7 @@ class DisposeListener : public ::cppu::WeakImplHelper< css::lang::XEventListener
SfxChildWindow_Impl* m_pData ;
};
+}
bool GetPosSizeFromString( const OUString& rStr, Point& rPos, Size& rSize )
{
diff --git a/sfx2/source/appl/impldde.cxx b/sfx2/source/appl/impldde.cxx
index 25097d480440..39cd6629b12a 100644
--- a/sfx2/source/appl/impldde.cxx
+++ b/sfx2/source/appl/impldde.cxx
@@ -47,6 +47,8 @@ using namespace ::com::sun::star::uno;
namespace sfx2
{
+namespace {
+
class SvDDELinkEditDialog : public weld::GenericDialogController
{
std::unique_ptr<weld::Entry> m_xEdDdeApp;
@@ -60,6 +62,8 @@ public:
OUString GetCmd() const;
};
+}
+
SvDDELinkEditDialog::SvDDELinkEditDialog(weld::Window* pParent, SvBaseLink const * pLink)
: GenericDialogController(pParent, "sfx/ui/linkeditdialog.ui", "LinkEditDialog")
, m_xEdDdeApp(m_xBuilder->weld_entry("app"))
diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index 4f9c109a23d1..fb8746e834fd 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -60,6 +60,8 @@ using ::com::sun::star::util::XCloseable;
namespace sfx2
{
+namespace {
+
class SvxInternalLink : public sfx2::SvLinkSource
{
public:
@@ -68,6 +70,8 @@ public:
virtual bool Connect( sfx2::SvBaseLink* ) override;
};
+}
+
LinkManager::LinkManager(SfxObjectShell* p)
: pPersist( p )
{
diff --git a/sfx2/source/appl/linksrc.cxx b/sfx2/source/appl/linksrc.cxx
index 98c347713dfb..9bfab2bfa4d8 100644
--- a/sfx2/source/appl/linksrc.cxx
+++ b/sfx2/source/appl/linksrc.cxx
@@ -33,6 +33,7 @@ using namespace ::com::sun::star::uno;
namespace sfx2
{
+namespace {
class SvLinkSourceTimer : public Timer
{
@@ -42,6 +43,8 @@ public:
explicit SvLinkSourceTimer( SvLinkSource * pOwn );
};
+}
+
SvLinkSourceTimer::SvLinkSourceTimer( SvLinkSource * pOwn )
: pOwner( pOwn )
{
@@ -65,6 +68,7 @@ static void StartTimer( std::unique_ptr<SvLinkSourceTimer>& pTimer, SvLinkSource
}
}
+namespace {
struct SvLinkSource_Entry_Impl
{
@@ -119,6 +123,8 @@ public:
bool IsValidCurrValue( SvLinkSource_Entry_Impl const * pEntry );
};
+}
+
SvLinkSource_EntryIter_Impl::SvLinkSource_EntryIter_Impl(
const SvLinkSource_Array_Impl& rArr )
: rOrigArr( rArr ), nPos( 0 )
diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx
index 9d234bf82c81..ab0119053021 100644
--- a/sfx2/source/appl/lnkbase2.cxx
+++ b/sfx2/source/appl/lnkbase2.cxx
@@ -40,9 +40,12 @@ using namespace ::com::sun::star::uno;
namespace sfx2
{
+namespace {
class ImplDdeItem;
+}
+
struct BaseLink_Impl
{
Link<SvBaseLink&,void> m_aEndEditLink;
@@ -89,6 +92,7 @@ struct ImplBaseLinkData
}
};
+namespace {
class ImplDdeItem : public DdeGetPutItem
{
@@ -119,6 +123,7 @@ public:
bool IsInDTOR() const { return bIsInDTOR; }
};
+}
SvBaseLink::SvBaseLink()
: pImpl ( new BaseLink_Impl ),
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index c34308afb72d..945d24a1f63b 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -243,6 +243,8 @@ namespace sfx2
// struct IndexEntry_Impl ------------------------------------------------
+namespace {
+
struct IndexEntry_Impl
{
bool const m_bSubEntry;
@@ -263,6 +265,8 @@ struct ContentEntry_Impl
aURL( rURL ), bIsFolder( bFolder ) {}
};
+}
+
// ContentListBox_Impl ---------------------------------------------------
ContentListBox_Impl::ContentListBox_Impl(vcl::Window* pParent, WinBits nStyle)
diff --git a/sfx2/source/appl/openuriexternally.cxx b/sfx2/source/appl/openuriexternally.cxx
index c0a14425ebc8..45e9ee0861f4 100644
--- a/sfx2/source/appl/openuriexternally.cxx
+++ b/sfx2/source/appl/openuriexternally.cxx
@@ -31,6 +31,8 @@
#include <sfx2/viewsh.hxx>
#include <sfx2/strings.hrc>
+namespace {
+
class URITools
{
private:
@@ -47,6 +49,8 @@ public:
void openURI(const OUString& sURI, bool bHandleSystemShellExecuteException);
};
+}
+
void URITools::openURI(const OUString& sURI, bool bHandleSystemShellExecuteException)
{
if (comphelper::LibreOfficeKit::isActive())
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index c4c1735f6418..2158acdcc7fd 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -102,6 +102,8 @@ using namespace ::com::sun::star::util;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::system;
+namespace {
+
class NoHelpErrorBox
{
private:
@@ -122,6 +124,8 @@ public:
}
};
+}
+
IMPL_STATIC_LINK_NOARG(NoHelpErrorBox, HelpRequestHdl, weld::Widget&, bool)
{
// do nothing, because no help available
@@ -329,12 +333,16 @@ static bool GetHelpAnchor_Impl( const OUString& _rURL, OUString& _rAnchor )
return bRet;
}
+namespace {
+
class SfxHelp_Impl
{
public:
static OUString GetHelpText( const OUString& aCommandURL, const OUString& rModule );
};
+}
+
OUString SfxHelp_Impl::GetHelpText( const OUString& aCommandURL, const OUString& rModule )
{
// create help url
@@ -994,6 +1002,8 @@ namespace
}
}
+namespace {
+
class HelpManualMessage : public weld::MessageDialogController
{
private:
@@ -1013,6 +1023,8 @@ public:
bool GetOfflineHelpPopUp() const { return !m_xHideOfflineHelpCB->get_active(); }
};
+}
+
bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const OUString& rKeyword)
{
OUStringBuffer aHelpRootURL("vnd.sun.star.help://");
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 5feb326243fc..f372857c286a 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -63,12 +63,16 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
+namespace {
+
struct ResIdToResName
{
ToolbarId const eId;
const char* pName;
};
+}
+
static const ResIdToResName pToolBarResToName[] =
{
{ ToolbarId::FullScreenToolbox, "fullscreenbar" },