summaryrefslogtreecommitdiffstats
path: root/compilerplugins/clang/casttovoid.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-04-17 17:13:50 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-04-17 20:46:28 +0200
commitcb06f61967850f7c3bbaaf3575901d6a18b94c96 (patch)
tree7e04ca9324cb79021da4e9181dbbcf441e80b6ba /compilerplugins/clang/casttovoid.cxx
parentWe don't build for i386 on macOS anyway (diff)
downloadcore-cb06f61967850f7c3bbaaf3575901d6a18b94c96.tar.gz
core-cb06f61967850f7c3bbaaf3575901d6a18b94c96.zip
More containsPreprocessingConditionalInclusion checking in loplugin:casttovoid
...to avoid false positive with --disable-dbgutil in SfxApplication ctor (sfx2/source/appl/app.cxx), which contains bool bOk = InitializeDde(); #ifdef DBG_UTIL ... #else (void)bOk; #endif Change-Id: I4de6322a848a9c6aea3057e4598b2161888dee6a Reviewed-on: https://gerrit.libreoffice.org/53051 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/casttovoid.cxx')
-rw-r--r--compilerplugins/clang/casttovoid.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/compilerplugins/clang/casttovoid.cxx b/compilerplugins/clang/casttovoid.cxx
index c67d7ca10870..e8b080dab2a5 100644
--- a/compilerplugins/clang/casttovoid.cxx
+++ b/compilerplugins/clang/casttovoid.cxx
@@ -380,6 +380,11 @@ private:
} else if (!i.second.castToVoid.empty()
&& !isWarnUnusedType(i.first->getType()))
{
+ auto const fun = dyn_cast_or_null<FunctionDecl>(i.first->getDeclContext());
+ assert(fun != nullptr);
+ if (containsPreprocessingConditionalInclusion(fun->getSourceRange())) {
+ continue;
+ }
report(
DiagnosticsEngine::Warning,
"unused variable %select{declaration|name}0",