summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/constparams.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-08-30 16:34:46 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-08-30 16:34:46 +0200
commit64a4ad3a678e414cccdcc158dbe4c76c4bad3cda (patch)
treecb41733e0521d87f4410ded37c0e8e267aaa1a34 /compilerplugins/clang/constparams.cxx
parent9540916d824521592c08fdbff5014a01dffca752 (diff)
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
Diffstat (limited to 'compilerplugins/clang/constparams.cxx')
-rw-r--r--compilerplugins/clang/constparams.cxx3
1 files changed, 2 insertions, 1 deletions
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())