summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-09-15 19:13:19 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-09-17 09:05:38 +0200
commit206b5b2661be37efdff3c6aedb6f248c4636be79 (patch)
treeaf385e5b4725dcfea23988d9113cced8e9ccaf3c /extensions
parentloplugin:external in i18npool (diff)
downloadcore-206b5b2661be37efdff3c6aedb6f248c4636be79.tar.gz
core-206b5b2661be37efdff3c6aedb6f248c4636be79.zip
New loplugin:external
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/abpilot/abpfinalpage.cxx2
-rw-r--r--extensions/source/abpilot/datasourcehandling.cxx2
-rw-r--r--extensions/source/bibliography/bibload.cxx2
-rw-r--r--extensions/source/bibliography/datman.cxx6
-rw-r--r--extensions/source/bibliography/framectr.cxx4
-rw-r--r--extensions/source/dbpilots/dbpservices.cxx5
-rw-r--r--extensions/source/propctrlr/pcrservices.cxx5
-rw-r--r--extensions/source/propctrlr/propertycomposer.cxx2
-rw-r--r--extensions/source/propctrlr/stringrepresentation.cxx6
-rw-r--r--extensions/source/propctrlr/xsddatatypes.cxx2
-rw-r--r--extensions/source/scanner/sane.cxx2
-rw-r--r--extensions/source/update/check/download.cxx2
12 files changed, 24 insertions, 16 deletions
diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx
index 7bd03896f0c3..1d4b92c48b80 100644
--- a/extensions/source/abpilot/abpfinalpage.cxx
+++ b/extensions/source/abpilot/abpfinalpage.cxx
@@ -34,7 +34,7 @@ namespace abp
using namespace ::svt;
using namespace ::utl;
- std::shared_ptr<const SfxFilter> lcl_getBaseFilter()
+ static std::shared_ptr<const SfxFilter> lcl_getBaseFilter()
{
std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!");
diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx
index 06db84fa0d76..da97727d7756 100644
--- a/extensions/source/abpilot/datasourcehandling.cxx
+++ b/extensions/source/abpilot/datasourcehandling.cxx
@@ -161,7 +161,7 @@ namespace abp
return aReturn;
}
- void lcl_registerDataSource(
+ static void lcl_registerDataSource(
const Reference< XComponentContext >& _rxORB, const OUString& _sName,
const OUString& _sURL )
{
diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx
index b9aa15092714..e0bf5b4a2c71 100644
--- a/extensions/source/bibliography/bibload.cxx
+++ b/extensions/source/bibliography/bibload.cxx
@@ -74,6 +74,8 @@ using namespace ::com::sun::star::form;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::frame;
+static Reference< XInterface > BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr );
+
class BibliographyLoader : public cppu::WeakImplHelper
< XServiceInfo, XNameAccess, XPropertySet, XFrameLoader >
{
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index 02333733f83d..846cd1ceebbd 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -83,7 +83,7 @@ using namespace ::com::sun::star::form;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::lang;
-Reference< XConnection > getConnection(const OUString& _rURL)
+static Reference< XConnection > getConnection(const OUString& _rURL)
{
// first get the sdb::DataSource corresponding to the url
Reference< XDataSource > xDataSource;
@@ -124,7 +124,7 @@ Reference< XConnection > getConnection(const OUString& _rURL)
return xConn;
}
-Reference< XConnection > getConnection(const Reference< XInterface > & xRowSet)
+static Reference< XConnection > getConnection(const Reference< XInterface > & xRowSet)
{
Reference< XConnection > xConn;
try
@@ -147,7 +147,7 @@ Reference< XConnection > getConnection(const Reference< XInterface > & xRowSe
return xConn;
}
-Reference< XNameAccess > getColumns(const Reference< XForm > & _rxForm)
+static Reference< XNameAccess > getColumns(const Reference< XForm > & _rxForm)
{
Reference< XNameAccess > xReturn;
// check if the form is alive
diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx
index 7f6e188c14bc..b6bd50f6e67b 100644
--- a/extensions/source/bibliography/framectr.cxx
+++ b/extensions/source/bibliography/framectr.cxx
@@ -100,7 +100,7 @@ static const DispatchInfo SupportedCommandsArray[] =
typedef std::unordered_map< OUString, CacheDispatchInfo > CmdToInfoCache;
-const CmdToInfoCache& GetCommandToInfoCache()
+static const CmdToInfoCache& GetCommandToInfoCache()
{
static bool bCacheInitialized = false;
static CmdToInfoCache aCmdToInfoCache;
@@ -318,7 +318,7 @@ uno::Sequence< frame::DispatchInformation > SAL_CALL BibFrameController_Impl::ge
return comphelper::containerToSequence( aDispatchInfoVector );
}
-bool canInsertRecords(const Reference< beans::XPropertySet>& _rxCursorSet)
+static bool canInsertRecords(const Reference< beans::XPropertySet>& _rxCursorSet)
{
sal_Int32 nPriv = 0;
_rxCursorSet->getPropertyValue("Privileges") >>= nPriv;
diff --git a/extensions/source/dbpilots/dbpservices.cxx b/extensions/source/dbpilots/dbpservices.cxx
index bba456bfa4fd..054924b5aa04 100644
--- a/extensions/source/dbpilots/dbpservices.cxx
+++ b/extensions/source/dbpilots/dbpservices.cxx
@@ -24,7 +24,9 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;
-extern "C" void dbp_initializeModule()
+extern "C" {
+
+static void dbp_initializeModule()
{
static bool s_bInit = false;
if (!s_bInit)
@@ -36,6 +38,7 @@ extern "C" void dbp_initializeModule()
}
}
+}
extern "C" SAL_DLLPUBLIC_EXPORT void* dbp_component_getFactory(
const sal_Char* pImplementationName,
diff --git a/extensions/source/propctrlr/pcrservices.cxx b/extensions/source/propctrlr/pcrservices.cxx
index 1ef0353ae1c6..eb4368bb7da4 100644
--- a/extensions/source/propctrlr/pcrservices.cxx
+++ b/extensions/source/propctrlr/pcrservices.cxx
@@ -25,7 +25,9 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;
-extern "C" void pcr_initializeModule()
+extern "C" {
+
+static void pcr_initializeModule()
{
static bool s_bInit = false;
if (!s_bInit)
@@ -53,6 +55,7 @@ extern "C" void pcr_initializeModule()
}
}
+}
extern "C" SAL_DLLPUBLIC_EXPORT void* pcr_component_getFactory(
const sal_Char* pImplementationName,
diff --git a/extensions/source/propctrlr/propertycomposer.cxx b/extensions/source/propctrlr/propertycomposer.cxx
index 5f97a759ef6f..19d5230ee274 100644
--- a/extensions/source/propctrlr/propertycomposer.cxx
+++ b/extensions/source/propctrlr/propertycomposer.cxx
@@ -250,7 +250,7 @@ namespace pcr
}
- void uniteStringArrays( const PropertyComposer::HandlerArray& _rHandlers, Sequence< OUString > (SAL_CALL XPropertyHandler::*pGetter)( void ),
+ static void uniteStringArrays( const PropertyComposer::HandlerArray& _rHandlers, Sequence< OUString > (SAL_CALL XPropertyHandler::*pGetter)( void ),
Sequence< OUString >& /* [out] */ _rUnion )
{
std::set< OUString > aUnitedBag;
diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx
index 208a0d27b183..bdca73fe13fc 100644
--- a/extensions/source/propctrlr/stringrepresentation.cxx
+++ b/extensions/source/propctrlr/stringrepresentation.cxx
@@ -54,9 +54,9 @@ namespace comp_StringRepresentation {
using namespace ::com::sun::star;
// component and service helper functions:
-OUString _getImplementationName();
-uno::Sequence< OUString > _getSupportedServiceNames();
-uno::Reference< uno::XInterface > _create( uno::Reference< uno::XComponentContext > const & context );
+static OUString _getImplementationName();
+static uno::Sequence< OUString > _getSupportedServiceNames();
+static uno::Reference< uno::XInterface > _create( uno::Reference< uno::XComponentContext > const & context );
} // closing component helper namespace
diff --git a/extensions/source/propctrlr/xsddatatypes.cxx b/extensions/source/propctrlr/xsddatatypes.cxx
index 8334af630701..9403117e685f 100644
--- a/extensions/source/propctrlr/xsddatatypes.cxx
+++ b/extensions/source/propctrlr/xsddatatypes.cxx
@@ -36,7 +36,7 @@ namespace pcr
using namespace ::com::sun::star::beans;
template< typename INTERFACE, typename ARGUMENT >
- ARGUMENT getSave( INTERFACE* pObject, ARGUMENT ( SAL_CALL INTERFACE::*pGetter )( ) )
+ static ARGUMENT getSave( INTERFACE* pObject, ARGUMENT ( SAL_CALL INTERFACE::*pGetter )( ) )
{
ARGUMENT aReturn = ARGUMENT();
try
diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx
index 0be0c0a19d93..1231037d712d 100644
--- a/extensions/source/scanner/sane.cxx
+++ b/extensions/source/scanner/sane.cxx
@@ -40,7 +40,7 @@
#else
#define dump_state( a, b, c, d ) ;
#endif
-inline void dbg_msg( const char* pString, ... )
+static inline void dbg_msg( const char* pString, ... )
{
#if (OSL_DEBUG_LEVEL > 0) || defined DBG_UTIL
va_list ap;
diff --git a/extensions/source/update/check/download.cxx b/extensions/source/update/check/download.cxx
index 3f137c4c1448..75579ca0f8f2 100644
--- a/extensions/source/update/check/download.cxx
+++ b/extensions/source/update/check/download.cxx
@@ -203,7 +203,7 @@ Download::getProxyForURL(const OUString& rURL, OString& rHost, sal_Int32& rPort)
}
-bool curl_run(const OUString& rURL, OutData& out, const OString& aProxyHost, sal_Int32 nProxyPort)
+static bool curl_run(const OUString& rURL, OutData& out, const OString& aProxyHost, sal_Int32 nProxyPort)
{
/* Need to investigate further whether it is necessary to call
* curl_global_init or not - leave it for now (as the ftp UCB content