diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-12-01 15:24:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-12-04 07:24:52 +0100 |
commit | 68f86457525c60f580954280d1a759aa174e8e96 (patch) | |
tree | d4f0d44d52cf3e744f1555074217e0f42007ac71 | |
parent | 9634a818e8a9432db52bc8fcd534e7437e6bacee (diff) |
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/45502
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
27 files changed, 513 insertions, 50 deletions
diff --git a/bridges/inc/bridge.hxx b/bridges/inc/bridge.hxx index bae89b4b1364..d5c3ba9d9b40 100644 --- a/bridges/inc/bridge.hxx +++ b/bridges/inc/bridge.hxx @@ -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. diff --git a/bridges/inc/cppinterfaceproxy.hxx b/bridges/inc/cppinterfaceproxy.hxx index 0b97264e42f0..dfb1bdbf1e2b 100644 --- a/bridges/inc/cppinterfaceproxy.hxx +++ b/bridges/inc/cppinterfaceproxy.hxx @@ -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. diff --git a/bridges/inc/unointerfaceproxy.hxx b/bridges/inc/unointerfaceproxy.hxx index ba3ddcbb5624..77cd8e98a346 100644 --- a/bridges/inc/unointerfaceproxy.hxx +++ b/bridges/inc/unointerfaceproxy.hxx @@ -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. diff --git a/compilerplugins/clang/salcall.cxx b/compilerplugins/clang/salcall.cxx new file mode 100644 index 000000000000..f982d7f41b11 --- /dev/null +++ b/compilerplugins/clang/salcall.cxx @@ -0,0 +1,370 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 "plugin.hxx" +#include "check.hxx" +#include <cassert> +#include <string> +#include <iostream> +#include <fstream> + +// The SAL_CALL function annotation is only necessary on our outward +// facing C++ ABI, anywhere else it is just cargo-cult. +// + +namespace +{ +//static bool startswith(const std::string& rStr, const char* pSubStr) +//{ +// return rStr.compare(0, strlen(pSubStr), pSubStr) == 0; +//} + +class SalCall final : public RecursiveASTVisitor<SalCall>, public loplugin::RewritePlugin +{ +public: + explicit SalCall(loplugin::InstantiationData const& data) + : RewritePlugin(data) + { + } + + virtual void run() override + { + std::string fn(compiler.getSourceManager() + .getFileEntryForID(compiler.getSourceManager().getMainFileID()) + ->getName()); + loplugin::normalizeDotDotInFilePath(fn); + // ignore this one. I can't get accurate source code from getCharacterData() for it. + if (fn == SRCDIR "/sal/rtl/string.cxx") + return; + m_phase = PluginPhase::FindAddressOf; + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); + m_phase = PluginPhase::Warning; + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); + } + + bool VisitFunctionDecl(FunctionDecl const*); + bool VisitUnaryAddrOf(UnaryOperator const*); + bool VisitInitListExpr(InitListExpr const*); + bool VisitCallExpr(CallExpr const*); + bool VisitBinAssign(BinaryOperator const*); + bool VisitCXXConstructExpr(CXXConstructExpr const*); + +private: + void checkForFunctionDecl(Expr const*, bool bCheckOnly = false); + bool rewrite(SourceLocation); + bool checkOverlap(SourceRange); + bool isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation* pLoc = nullptr); + + std::set<FunctionDecl const*> m_addressOfSet; + enum class PluginPhase + { + FindAddressOf, + Warning + }; + PluginPhase m_phase; + std::vector<std::pair<char const*, char const*>> mvModifiedRanges; +}; + +bool SalCall::VisitUnaryAddrOf(UnaryOperator const* op) +{ + if (m_phase != PluginPhase::FindAddressOf) + return true; + checkForFunctionDecl(op->getSubExpr()); + return true; +} + +bool SalCall::VisitBinAssign(BinaryOperator const* binaryOperator) +{ + if (m_phase != PluginPhase::FindAddressOf) + return true; + checkForFunctionDecl(binaryOperator->getRHS()); + return true; +} + +bool SalCall::VisitCallExpr(CallExpr const* callExpr) +{ + if (m_phase != PluginPhase::FindAddressOf) + return true; + for (auto arg : callExpr->arguments()) + checkForFunctionDecl(arg); + return true; +} + +bool SalCall::VisitCXXConstructExpr(CXXConstructExpr const* constructExpr) +{ + if (m_phase != PluginPhase::FindAddressOf) + return true; + for (auto arg : constructExpr->arguments()) + checkForFunctionDecl(arg); + return true; +} + +bool SalCall::VisitInitListExpr(InitListExpr const* initListExpr) +{ + if (m_phase != PluginPhase::FindAddressOf) + return true; + for (auto subStmt : *initListExpr) + checkForFunctionDecl(dyn_cast<Expr>(subStmt)); + return true; +} + +void SalCall::checkForFunctionDecl(Expr const* expr, bool bCheckOnly) +{ + auto e1 = expr->IgnoreParenCasts(); + auto declRef = dyn_cast<DeclRefExpr>(e1); + if (!declRef) + return; + auto functionDecl = dyn_cast<FunctionDecl>(declRef->getDecl()); + if (!functionDecl) + return; + if (bCheckOnly) + getParentStmt(expr)->dump(); + else + m_addressOfSet.insert(functionDecl->getCanonicalDecl()); +} + +bool SalCall::VisitFunctionDecl(FunctionDecl const* decl) +{ + if (m_phase != PluginPhase::Warning) + return true; + if (ignoreLocation(decl)) + return true; + + // ignore template stuff + if (decl->getTemplatedKind() != clang::FunctionDecl::TK_NonTemplate) + return true; + auto recordDecl = dyn_cast<CXXRecordDecl>(decl->getDeclContext()); + if (recordDecl + && (recordDecl->getTemplateSpecializationKind() != TSK_Undeclared + || recordDecl->isDependentContext())) + { + return true; + } + + auto canonicalDecl = decl->getCanonicalDecl(); + + // ignore UNO implementations + if (isInUnoIncludeFile( + compiler.getSourceManager().getSpellingLoc(canonicalDecl->getLocation()))) + return true; + + // macros make getCharacterData() extremely unreliable + if (compiler.getSourceManager().isMacroArgExpansion(decl->getLocation()) + || compiler.getSourceManager().isMacroBodyExpansion(decl->getLocation())) + return true; + + SourceLocation rewriteLoc; + SourceLocation rewriteCanonicalLoc; + bool bDeclIsSalCall = isSalCallFunction(decl, &rewriteLoc); + bool bCanonicalDeclIsSalCall = isSalCallFunction(canonicalDecl, &rewriteCanonicalLoc); + + // first, check for consistency, so we don't trip ourselves up on Linux, where we normally run the plugin + if (canonicalDecl != decl) + { + if (bCanonicalDeclIsSalCall) + ; // this is fine, the actual definition have or not have SAL_CALL, and MSVC is fine with it + else if (bDeclIsSalCall) + { + // not fine + report(DiagnosticsEngine::Warning, "SAL_CALL inconsistency", + canonicalDecl->getLocation()) + << canonicalDecl->getSourceRange(); + report(DiagnosticsEngine::Note, "SAL_CALL inconsistency", decl->getLocation()) + << decl->getSourceRange(); + return true; + } + } + auto methodDecl = dyn_cast<CXXMethodDecl>(canonicalDecl); + if (methodDecl) + { + for (auto iter = methodDecl->begin_overridden_methods(); + iter != methodDecl->end_overridden_methods(); ++iter) + { + const CXXMethodDecl* overriddenMethod = (*iter)->getCanonicalDecl(); + if (bCanonicalDeclIsSalCall != isSalCallFunction(overriddenMethod)) + { + report(DiagnosticsEngine::Warning, "SAL_CALL inconsistency", + methodDecl->getLocation()) + << methodDecl->getSourceRange(); + report(DiagnosticsEngine::Note, "SAL_CALL inconsistency", + overriddenMethod->getLocation()) + << overriddenMethod->getSourceRange(); + return true; + } + } + } + + if (!bDeclIsSalCall) + return true; + + // @TODO For now, I am ignore free functions, since those are most likely to have their address taken. + // I'll do these later. They are harder to verify since MSVC does not verify when assigning to function pointers + // that the calling convention of the function matches the calling convention of the function pointer! + if (!methodDecl || methodDecl->isStatic()) + return true; + + // can only check when we have a definition since this is the most likely time + // when the address of the method will be taken + if (!(methodDecl && methodDecl->isPure()) && !decl->isThisDeclarationADefinition()) + return true; + if (m_addressOfSet.find(decl->getCanonicalDecl()) != m_addressOfSet.end()) + return true; + + // ignore extern "C" UNO factory constructor functions + if (decl->isExternC()) + { + if (loplugin::TypeCheck(decl->getReturnType()) + .Pointer() + .Class("XInterface") + .Namespace("uno") + .Namespace("star") + .Namespace("sun") + .Namespace("com") + .GlobalNamespace()) + return true; + if (loplugin::TypeCheck(decl->getReturnType()).Pointer().Void()) + return true; + } + + // some base classes are overridden by sub-classes which override both the base-class and an UNO class + if (recordDecl) + { + if (loplugin::DeclCheck(recordDecl) + .Class("OProxyAggregation") + .Namespace("comphelper") + .GlobalNamespace() + || loplugin::DeclCheck(recordDecl) + .Class("OComponentProxyAggregationHelper") + .Namespace("comphelper") + .GlobalNamespace() + || loplugin::DeclCheck(recordDecl).Class("SvxShapeMaster").GlobalNamespace()) + return true; + } + + if (methodDecl) + { + for (auto iter = methodDecl->begin_overridden_methods(); + iter != methodDecl->end_overridden_methods(); ++iter) + { + const CXXMethodDecl* overriddenMethod = (*iter)->getCanonicalDecl(); + if (isSalCallFunction(overriddenMethod)) + return true; + } + } + + /* + bool bOK = rewrite(rewriteLoc); + if (bOK && canonicalDecl != decl) + { + bOK = rewrite(rewriteCanonicalLoc); + } + if (bOK) + return true; + + //std::cout << "xxx:" << std::string(p1, leftBracket - p1) << std::endl; + report(DiagnosticsEngine::Warning, "SAL_CALL unnecessary here", rewriteLoc) + << decl->getSourceRange(); + if (canonicalDecl != decl) + report(DiagnosticsEngine::Warning, "SAL_CALL unnecessary here", rewriteCanonicalLoc) + << canonicalDecl->getSourceRange(); +*/ + return true; +} + +bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation* pLoc) +{ + // In certain situations, in header files, clang will return bogus range data + // from decl->getSourceRange(). + // Specifically, for the + // LNG_DLLPUBLIC CapType SAL_CALL capitalType(const OUString&, CharClass const *); + // declaration in + // include/linguistic/misc.hxx + // it looks like it is returning data from definition of the LNG_DLLPUBLIC macro. + // I suspect something inside clang is calling getSpellingLoc() once too often. + // + // So I use getReturnTypeSourceRange() for the start of the range + // instead, and search for the "(" in the function decl. + + SourceRange range = functionDecl->getSourceRange(); + SourceManager& SM = compiler.getSourceManager(); + SourceLocation startLoc = functionDecl->getReturnTypeSourceRange().getBegin(); + SourceLocation endLoc = range.getEnd(); + if (!startLoc.isValid() || !endLoc.isValid()) + return false; + char const* p1 = SM.getCharacterData(startLoc); + char const* p2 = SM.getCharacterData(endLoc); + + // if (functionDecl->getIdentifier() && functionDecl->getName() == "capitalType") + // { + // std::cout << "xxxx " << (long)p1 << " " << (long)p2 << " " << (int)(p2-p1) << std::endl; + // std::cout << " " << std::string(p1, 80) << std::endl; + // report(DiagnosticsEngine::Warning, "jhjkahdashdkash", functionDecl->getLocation()) + // << functionDecl->getSourceRange(); + // } + // + static const char* SAL_CALL = "SAL_CALL"; + + char const* leftBracket = static_cast<char const*>(memchr(p1, '(', p2 - p1)); + if (!leftBracket) + return false; + + char const* found = std::search(p1, leftBracket, SAL_CALL, SAL_CALL + strlen(SAL_CALL)); + + if (found >= leftBracket) + return false; + + if (pLoc) + // the -1 is to remove the space before the SAL_CALL + *pLoc = startLoc.getLocWithOffset(found - p1 - 1); + + return true; +} + +bool SalCall::rewrite(SourceLocation locBegin) +{ + if (!rewriter) + return false; + + auto locEnd = locBegin.getLocWithOffset(8); + + SourceRange range(locBegin, locEnd); + + // If we overlap with a previous area we modified, we cannot perform this change + // without corrupting the source + if (!checkOverlap(range)) + return false; + + if (!replaceText(locBegin, 9, "")) + return false; + + return true; +} + +// If we overlap with a previous area we modified, we cannot perform this change +// without corrupting the source +bool SalCall::checkOverlap(SourceRange range) +{ + SourceManager& SM = compiler.getSourceManager(); + char const* p1 = SM.getCharacterData(range.getBegin()); + char const* p2 = SM.getCharacterData(range.getEnd()); + for (std::pair<char const*, char const*> const& rPair : mvModifiedRanges) + { + if (rPair.first <= p1 && p1 <= rPair.second) + return false; + if (p1 <= rPair.second && rPair.first <= p2) + return false; + } + mvModifiedRanges.emplace_back(p1, p2); + return true; +} + +static loplugin::Plugin::Registration<SalCall> reg("salcall", true); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/compilerplugins/clang/test/salcall.cxx b/compilerplugins/clang/test/salcall.cxx new file mode 100644 index 000000000000..3b05530e8097 --- /dev/null +++ b/compilerplugins/clang/test/salcall.cxx @@ -0,0 +1,104 @@ +/* -*- 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: */ diff --git a/connectivity/source/drivers/odbc/ORealDriver.hxx b/connectivity/source/drivers/odbc/ORealDriver.hxx index b4b092b87697..5a103d80fec3 100644 --- a/connectivity/source/drivers/odbc/ORealDriver.hxx +++ b/connectivity/source/drivers/odbc/ORealDriver.hxx @@ -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); } } diff --git a/desktop/source/deployment/inc/dp_registry.hxx b/desktop/source/deployment/inc/dp_registry.hxx index 43746ddfc642..7a3eda34f08a 100644 --- a/desktop/source/deployment/inc/dp_registry.hxx +++ b/desktop/source/deployment/inc/dp_registry.hxx @@ -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); diff --git a/extensions/source/propctrlr/eventhandler.hxx b/extensions/source/propctrlr/eventhandler.hxx index bf6582623dd1..57274d235d75 100644 --- a/extensions/source/propctrlr/eventhandler.hxx +++ b/extensions/source/propctrlr/eventhandler.hxx @@ -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( diff --git a/extensions/source/propctrlr/genericpropertyhandler.hxx b/extensions/source/propctrlr/genericpropertyhandler.hxx index c85732fc412d..51ac2f61e1a2 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.hxx +++ b/extensions/source/propctrlr/genericpropertyhandler.hxx @@ -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( diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx index 8d38481ba1d9..45015ef127f1 100644 --- a/extensions/source/scanner/scanunx.cxx +++ b/extensions/source/scanner/scanunx.cxx @@ -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, diff --git a/filter/source/config/cache/contenthandlerfactory.hxx b/filter/source/config/cache/contenthandlerfactory.hxx index f684b4048667..82bf415810cc 100644 --- a/filter/source/config/cache/contenthandlerfactory.hxx +++ b/filter/source/config/cache/contenthandlerfactory.hxx @@ -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 diff --git a/filter/source/config/cache/filterfactory.hxx b/filter/source/config/cache/filterfactory.hxx index c0e9a34d5aa3..bf211ac102d9 100644 --- a/filter/source/config/cache/filterfactory.hxx +++ b/filter/source/config/cache/filterfactory.hxx @@ -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 diff --git a/filter/source/config/cache/frameloaderfactory.hxx b/filter/source/config/cache/frameloaderfactory.hxx index 7dab5e02b0d9..bf05fc920af3 100644 --- a/filter/source/config/cache/frameloaderfactory.hxx +++ b/filter/source/config/cache/frameloaderfactory.hxx @@ -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 diff --git a/filter/source/config/cache/typedetection.hxx b/filter/source/config/cache/typedetection.hxx index 830badc54f63..78f8964e66ea 100644 --- a/filter/source/config/cache/typedetection.hxx +++ b/filter/source/config/cache/typedetection.hxx @@ -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> diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx b/filter/source/odfflatxml/OdfFlatXml.cxx index 381e8429e612..aab5ec7adec4 100644 --- a/filter/source/odfflatxml/OdfFlatXml.cxx +++ b/filter/source/odfflatxml/OdfFlatXml.cxx @@ -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); }; } } diff --git a/forms/source/xforms/binding.hxx b/forms/source/xforms/binding.hxx index dc6ba779bbc4..1bd019a7d497 100644 --- a/forms/source/xforms/binding.hxx +++ b/forms/source/xforms/binding.hxx @@ -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: diff --git a/idlc/source/idlcproduce.cxx b/idlc/source/idlcproduce.cxx index 60c5ff463045..2fa0a3b0317b 100644 --- a/idlc/source/idlcproduce.cxx +++ b/idlc/source/idlcproduce.cxx @@ -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(); diff --git a/include/formula/FormulaOpCodeMapperObj.hxx b/include/formula/FormulaOpCodeMapperObj.hxx index 36099199e60a..0d3c94330f45 100644 --- a/include/formula/FormulaOpCodeMapperObj.hxx +++ b/include/formula/FormulaOpCodeMapperObj.hxx @@ -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); diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index 68d384414af3..86d513a73225 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -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; diff --git a/sd/source/ui/inc/facreg.hxx b/sd/source/ui/inc/facreg.hxx index a235e393818c..58a4903a731b 100644 --- a/sd/source/ui/inc/facreg.hxx +++ b/sd/source/ui/inc/facreg.hxx @@ -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(); diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk index c2b78bf8832d..4a98ef996091 100644 --- a/solenv/CompilerTest_compilerplugins_clang.mk +++ b/solenv/CompilerTest_compilerplugins_clang.mk @@ -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 \ diff --git a/svtools/source/uno/fpicker.hxx b/svtools/source/uno/fpicker.hxx index 5042cffe0431..516c56ec667d 100644 --- a/svtools/source/uno/fpicker.hxx +++ b/svtools/source/uno/fpicker.hxx @@ -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 diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index f19a45bc2aa0..9a6c7907cd5f 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -60,7 +60,7 @@ namespace psp m_aQueues; OUString m_aCommand; - virtual void run() override; + virtual void SAL_CALL run() override; public: SystemQueueInfo(); diff --git a/vcl/unx/gtk/a11y/atklistener.hxx b/vcl/unx/gtk/a11y/atklistener.hxx index 82baf1e72461..58798d4439fb 100644 --- a/vcl/unx/gtk/a11y/atklistener.hxx +++ b/vcl/unx/gtk/a11y/atklistener.hxx @@ -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: diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index 14bb6045c376..5b7e89bd78af 100644 --- a/vcl/unx/gtk/a11y/atkutil.cxx +++ b/vcl/unx/gtk/a11y/atkutil.cxx @@ -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; }; /*****************************************************************************/ diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx index 8f22a8f37363..d8868884e99a 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx @@ -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() ; diff --git a/xmlsecurity/source/xmlsec/xsec_xmlsec.hxx b/xmlsecurity/source/xmlsec/xsec_xmlsec.hxx index 5ecdf4e9de68..7db284869e56 100644 --- a/xmlsecurity/source/xmlsec/xsec_xmlsec.hxx +++ b/xmlsecurity/source/xmlsec/xsec_xmlsec.hxx @@ -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* ); |