summaryrefslogtreecommitdiff
path: root/compilerplugins/clang
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang')
-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",