Kaydet (Commit) 68f86457 authored tarafından Noel Grandin's avatar Noel Grandin

new loplugin salcall: remove unnecessary SAL_CALL

In this first commit, I use the plugin to verify the consistency of our
SAL_CALL annotations.
The point being to make the next commit more mechanical in nature,
purely using the rewriter.

There are various chunks of unix-only code that have never had to be
compiled by MSVC, hence the inconsistencies.

In bridges, I had to inline some typedefs to make the verification code
happy, since it cannot see into typedefs.

Change-Id: Iec6e274bed857febf7295cfcf5e9f21fe4a34da0
Reviewed-on: https://gerrit.libreoffice.org/45502Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 9634a818
......@@ -33,28 +33,21 @@
namespace bridges { namespace cpp_uno { namespace shared {
// private:
extern "C" typedef void SAL_CALL FreeMapping(uno_Mapping *);
FreeMapping freeMapping;
extern "C" void SAL_CALL freeMapping(uno_Mapping *);
// private:
extern "C"
typedef void SAL_CALL AcquireMapping(uno_Mapping *);
AcquireMapping acquireMapping;
extern "C" void SAL_CALL acquireMapping(uno_Mapping *);
// private:
extern "C"
typedef void SAL_CALL ReleaseMapping(uno_Mapping *);
ReleaseMapping releaseMapping;
extern "C" void SAL_CALL releaseMapping(uno_Mapping *);
// private:
extern "C" typedef void SAL_CALL Cpp2unoMapping(
extern "C" void SAL_CALL cpp2unoMapping(
uno_Mapping *, void **, void *, typelib_InterfaceTypeDescription *);
Cpp2unoMapping cpp2unoMapping;
// private:
extern "C" typedef void SAL_CALL Uno2cppMapping(
extern "C" void SAL_CALL uno2cppMapping(
uno_Mapping *, void **, void *, typelib_InterfaceTypeDescription *);
Uno2cppMapping uno2cppMapping;
/**
* Holding environments and mappings.
......
......@@ -45,9 +45,8 @@ namespace bridges { namespace cpp_uno { namespace shared {
class Bridge;
extern "C" typedef void SAL_CALL FreeCppInterfaceProxy(
extern "C" void SAL_CALL freeCppInterfaceProxy(
uno_ExtEnvironment * pEnv, void * pInterface);
FreeCppInterfaceProxy freeCppInterfaceProxy;
/**
* A cpp proxy wrapping a uno interface.
......
......@@ -39,25 +39,21 @@ namespace bridges { namespace cpp_uno { namespace shared {
class Bridge;
extern "C" typedef void SAL_CALL FreeUnoInterfaceProxy(
extern "C" void SAL_CALL freeUnoInterfaceProxy(
uno_ExtEnvironment * pEnv, void * pProxy);
FreeUnoInterfaceProxy freeUnoInterfaceProxy;
// private:
extern "C" typedef void SAL_CALL UnoInterfaceProxyDispatch(
extern "C" void SAL_CALL unoInterfaceProxyDispatch(
uno_Interface * pUnoI, typelib_TypeDescription const * pMemberDescr,
void * pReturn, void * pArgs[], uno_Any ** ppException);
UnoInterfaceProxyDispatch unoInterfaceProxyDispatch;
// this function is not defined in the generic part, but instead has to be
// defined individually for each CPP--UNO bridge
// private:
extern "C" typedef void SAL_CALL AcquireProxy(uno_Interface *);
AcquireProxy acquireProxy;
extern "C" void SAL_CALL acquireProxy(uno_Interface *);
// private:
extern "C" typedef void SAL_CALL ReleaseProxy(uno_Interface *);
ReleaseProxy releaseProxy;
extern "C" void SAL_CALL releaseProxy(uno_Interface *);
/**
* A uno proxy wrapping a cpp interface.
......
This diff is collapsed.
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <sal/types.h>
class Class1
{
void SAL_CALL method1(); // xxexpected-error {{SAL_CALL unnecessary here [loplugin:salcall]}}
};
void SAL_CALL Class1::method1() {
} // xxexpected-error {{SAL_CALL unnecessary here [loplugin:salcall]}}
class Class2
{
void method1(); // expected-error {{SAL_CALL inconsistency [loplugin:salcall]}}
};
void SAL_CALL Class2::method1() {} // expected-note {{SAL_CALL inconsistency [loplugin:salcall]}}
// no warning, this appears to be legal
class Class3
{
void SAL_CALL method1();
};
void Class3::method1() {}
// no warning, normal case for reference
class Class4
{
void method1();
};
void Class4::method1() {}
class Class5_1
{
virtual void method1(); // expected-note {{SAL_CALL inconsistency [loplugin:salcall]}}
virtual ~Class5_1();
};
class Class5_2
{
virtual void SAL_CALL method1();
virtual ~Class5_2();
};
class Class5_3 : public Class5_1, public Class5_2
{
virtual void SAL_CALL
method1() override; // expected-error {{SAL_CALL inconsistency [loplugin:salcall]}}
virtual ~Class5_3();
};
class Class6_1
{
virtual void SAL_CALL method1();
virtual ~Class6_1();
};
class Class6_2
{
virtual void SAL_CALL method1();
virtual ~Class6_2();
};
class Class6_3 : public Class6_1, public Class6_2
{
virtual void SAL_CALL method1() override;
virtual ~Class6_3();
};
class Class7_1
{
virtual void method1();
virtual ~Class7_1();
};
class Class7_2
{
virtual void method1();
virtual ~Class7_2();
};
class Class7_3 : public Class7_1, public Class7_2
{
virtual void method1() override;
virtual ~Class7_3();
};
class Class8_1
{
virtual void method2();
virtual ~Class8_1();
};
class Class8_2
{
virtual void SAL_CALL method2(); // expected-note {{SAL_CALL inconsistency [loplugin:salcall]}}
virtual ~Class8_2();
};
class Class8_3 : public Class8_1, public Class8_2
{
virtual void method2() override; // expected-error {{SAL_CALL inconsistency [loplugin:salcall]}}
virtual ~Class8_3();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -33,7 +33,7 @@ namespace com { namespace sun { namespace star {
namespace connectivity { namespace odbc {
/// @throws css::uno::Exception
css::uno::Reference< css::uno::XInterface >
css::uno::Reference< css::uno::XInterface > SAL_CALL
ODBCDriver_CreateInstance( css::uno::Reference< css::lang::XMultiServiceFactory > const & factory);
} }
......
......@@ -32,7 +32,7 @@ namespace com { namespace sun { namespace star {
namespace dp_registry {
css::uno::Reference<css::deployment::XPackageRegistry> create(
css::uno::Reference<css::deployment::XPackageRegistry> SAL_CALL create(
OUString const & context, OUString const & cachePath,
css::uno::Reference<css::uno::XComponentContext> const & xComponentContext);
......
......@@ -100,7 +100,7 @@ namespace pcr
static OUString SAL_CALL getImplementationName_static( );
/// @throws css::uno::RuntimeException
static css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_static( );
static css::uno::Reference< css::uno::XInterface > Create( const css::uno::Reference< css::uno::XComponentContext >& _rxContext );
static css::uno::Reference< css::uno::XInterface > SAL_CALL Create( const css::uno::Reference< css::uno::XComponentContext >& _rxContext );
private:
explicit EventHandler(
......
......@@ -83,7 +83,7 @@ namespace pcr
static OUString SAL_CALL getImplementationName_static( );
/// @throws css::uno::RuntimeException
static css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_static( );
static css::uno::Reference< css::uno::XInterface > Create( const css::uno::Reference< css::uno::XComponentContext >& _rxContext );
static css::uno::Reference< css::uno::XInterface > SAL_CALL Create( const css::uno::Reference< css::uno::XComponentContext >& _rxContext );
private:
explicit GenericPropertyHandler(
......
......@@ -129,8 +129,8 @@ class ScannerThread : public osl::Thread
ScannerManager* m_pManager; // just for the disposing call
public:
virtual void run() override;
virtual void onTerminated() override { delete this; }
virtual void SAL_CALL run() override;
virtual void SAL_CALL onTerminated() override { delete this; }
public:
ScannerThread( const std::shared_ptr<SaneHolder>& pHolder,
const Reference< css::lang::XEventListener >& listener,
......
......@@ -113,7 +113,7 @@ class ContentHandlerFactory : public ::cppu::ImplInheritanceHelper< BaseContaine
@return The new instance of this service as an uno reference.
*/
static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
// Overrides to resolve ambiguity
......
......@@ -171,7 +171,7 @@ class FilterFactory : public ::cppu::ImplInheritanceHelper< BaseContainer
@return The new instance of this service as an uno reference.
*/
static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
};
} // namespace config
......
......@@ -113,7 +113,7 @@ class FrameLoaderFactory : public ::cppu::ImplInheritanceHelper< BaseContainer
@return The new instance of this service as an uno reference.
*/
static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
// Overrides to resolve ambiguity
virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) override
......
......@@ -368,7 +368,7 @@ public:
@return The new instance of this service as an uno reference.
*/
static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
};
class TerminateDetection : public cppu::WeakComponentImplHelper<css::frame::XTerminateListener>
......
......@@ -97,7 +97,7 @@ namespace filter {
static Sequence< OUString > impl_getSupportedServiceNames();
static Reference< XInterface > impl_createInstance(const Reference< XMultiServiceFactory >& fact);
static Reference< XInterface > SAL_CALL impl_createInstance(const Reference< XMultiServiceFactory >& fact);
};
}
}
......
......@@ -258,7 +258,7 @@ public:
// the ID for XUnoTunnel calls
static css::uno::Sequence<sal_Int8> getUnoTunnelID();
static Binding* getBinding( const css::uno::Reference<css::beans::XPropertySet>& );
static Binding* SAL_CALL getBinding( const css::uno::Reference<css::beans::XPropertySet>& );
private:
......
......@@ -121,7 +121,7 @@ void removeIfExists(const OString& pathname)
osl::File::remove(OStringToOUString(pathname, RTL_TEXTENCODING_UTF8));
}
sal_Int32 SAL_CALL
sal_Int32
produceFile(const OString& regFileName, sPair_t const*const pDepFile)
{
Options* pOptions = idlc()->getOptions();
......
......@@ -52,9 +52,9 @@ class FORMULA_DLLPUBLIC FormulaOpCodeMapperObj : public cppu::WeakImplHelper<
{
::std::unique_ptr<FormulaCompiler> m_pCompiler;
public:
static OUString getImplementationName_Static();
static css::uno::Sequence< OUString> getSupportedServiceNames_Static();
static css::uno::Reference< css::uno::XInterface > create(const css::uno::Reference< css::uno::XComponentContext >& _xContext);
static OUString SAL_CALL getImplementationName_Static();
static css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames_Static();
static css::uno::Reference< css::uno::XInterface > SAL_CALL create(const css::uno::Reference< css::uno::XComponentContext >& _xContext);
protected:
FormulaOpCodeMapperObj(::std::unique_ptr<FormulaCompiler> && _pCompiler);
......
......@@ -1056,7 +1056,7 @@ oslFileError SAL_CALL osl_openFile(rtl_uString* ustrFileURL, oslFileHandle* pHan
return openFile(ustrFileURL, pHandle, uFlags, mode_t(-1));
}
oslFileError SAL_CALL openFile(rtl_uString* ustrFileURL, oslFileHandle* pHandle, sal_uInt32 uFlags, mode_t mode)
oslFileError openFile(rtl_uString* ustrFileURL, oslFileHandle* pHandle, sal_uInt32 uFlags, mode_t mode)
{
oslFileError eRet;
......
......@@ -30,13 +30,13 @@ namespace com { namespace sun { namespace star {
css::uno::Reference< css::uno::XInterface > SAL_CALL SdDrawingDocument_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory > & _rxFactory, SfxModelFlags _nCreationFlags );
/// @throws css::uno::RuntimeException
OUString SdDrawingDocument_getImplementationName();
OUString SAL_CALL SdDrawingDocument_getImplementationName();
/// @throws css::uno::RuntimeException
css::uno::Sequence< OUString > SAL_CALL SdDrawingDocument_getSupportedServiceNames();
css::uno::Reference< css::uno::XInterface > SAL_CALL SdPresentationDocument_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory > & _rxFactory, SfxModelFlags _nCreationFlags );
/// @throws css::uno::RuntimeException
OUString SdPresentationDocument_getImplementationName();
OUString SAL_CALL SdPresentationDocument_getImplementationName();
/// @throws css::uno::RuntimeException
css::uno::Sequence< OUString > SAL_CALL SdPresentationDocument_getSupportedServiceNames();
......
......@@ -38,6 +38,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
compilerplugins/clang/test/redundantpointerops \
compilerplugins/clang/test/refcounting \
compilerplugins/clang/test/salbool \
compilerplugins/clang/test/salcall \
compilerplugins/clang/test/salunicodeliteral \
compilerplugins/clang/test/simplifybool \
compilerplugins/clang/test/simplifydynamiccast \
......
......@@ -35,12 +35,12 @@ namespace com { namespace sun { namespace star {
css::uno::Reference<css::uno::XInterface> SAL_CALL FilePicker_CreateInstance(
css::uno::Reference< css::uno::XComponentContext > const & context);
css::uno::Sequence<OUString> FilePicker_getSupportedServiceNames();
OUString FilePicker_getImplementationName();
OUString SAL_CALL FilePicker_getImplementationName();
css::uno::Reference<css::uno::XInterface> SAL_CALL FolderPicker_CreateInstance(
css::uno::Reference< css::uno::XComponentContext > const & context);
css::uno::Sequence<OUString> FolderPicker_getSupportedServiceNames();
OUString FolderPicker_getImplementationName();
OUString SAL_CALL FolderPicker_getImplementationName();
#endif
......
......@@ -60,7 +60,7 @@ namespace psp
m_aQueues;
OUString m_aCommand;
virtual void run() override;
virtual void SAL_CALL run() override;
public:
SystemQueueInfo();
......
......@@ -33,10 +33,10 @@ public:
explicit AtkListener(AtkObjectWrapper * pWrapper);
// XEventListener
virtual void disposing( const css::lang::EventObject& Source ) override;
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
// XAccessibleEventListener
virtual void notifyEvent( const css::accessibility::AccessibleEventObject& aEvent ) override;
virtual void SAL_CALL notifyEvent( const css::accessibility::AccessibleEventObject& aEvent ) override;
private:
......
......@@ -185,10 +185,10 @@ public:
static uno::Reference< accessibility::XAccessible > getAccessible(const lang::EventObject& aEvent );
// XEventListener
virtual void disposing( const lang::EventObject& Source ) override;
virtual void SAL_CALL disposing( const lang::EventObject& Source ) override;
// XAccessibleEventListener
virtual void notifyEvent( const accessibility::AccessibleEventObject& aEvent ) override;
virtual void SAL_CALL notifyEvent( const accessibility::AccessibleEventObject& aEvent ) override;
};
/*****************************************************************************/
......
......@@ -81,7 +81,7 @@ class X509Certificate_NssImpl : public ::cppu::WeakImplHelper<
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
/// @see xmlsecurity::Certificate::getSHA256Thumbprint().
virtual css::uno::Sequence<sal_Int8> getSHA256Thumbprint() override;
virtual css::uno::Sequence<sal_Int8> SAL_CALL getSHA256Thumbprint() override;
static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() ;
......
......@@ -24,7 +24,7 @@
extern "C" {
void* nss_component_getFactory( const sal_Char*, void*, void* );
void* SAL_CALL nss_component_getFactory( const sal_Char*, void*, void* );
#if defined( XMLSEC_CRYPTO_MSCRYPTO )
void* mscrypt_component_getFactory( const sal_Char*, void*, void* );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment