[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann sbergman at redhat.com
Wed Aug 30 14:43:31 UTC 2017


 compilerplugins/clang/constparams.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 64a4ad3a678e414cccdcc158dbe4c76c4bad3cda
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Aug 30 16:34:46 2017 +0200

    Avoid loplugin:constparam when param is marked as unused
    
    ...as in entry_group_callback
    (sd/source/ui/remotecontrol/AvahiNetworkService.cxx),
    
      AVAHI_GCC_UNUSED void *userdata
    
    Change-Id: I494067878181c51b77d581a21ab1c9ef81e482e5

diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx
index 2a1fc1ff8a2d..f170552ba6de 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -194,7 +194,8 @@ bool ConstParams::VisitFunctionDecl(const FunctionDecl * functionDecl)
     // calculate the ones we want to check
     for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) {
         // ignore unused params
-        if (pParmVarDecl->getName().empty())
+        if (pParmVarDecl->getName().empty()
+            || pParmVarDecl->hasAttr<UnusedAttr>())
             continue;
         auto const type = loplugin::TypeCheck(pParmVarDecl->getType());
         if (!type.Pointer() && !type.LvalueReference())


More information about the Libreoffice-commits mailing list