diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-10-09 16:36:11 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-10-09 22:33:02 +0200 |
commit | 969990becc001d5fe5a34ff976cb022786c10c76 (patch) | |
tree | 6ec81b85cb9cd7d82874cdd30155cd5e65ab61e8 /compilerplugins | |
parent | ba124320327beea8a4068ffa93a9050fa3dd5c38 (diff) |
Avoid a false loplugin:casttovoid on macOS
...involving conditional preprocessed code at
> vcl/skia/SkiaHelper.cxx:265:13: error: unnecessary cast to void [loplugin:casttovoid]
> 265 | (void)blockDisable;
> | ^~~~~~~~~~~~~~~~~~
> vcl/skia/SkiaHelper.cxx:286:22: note: first consumption is here [loplugin:casttovoid]
> 286 | if (!blockDisable && !DefaultMTLDeviceIsSupported())
> | ^~~~~~~~~~~~
Change-Id: I222d72d240852be2d64fe08d345f00d137cd5a63
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157707
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/casttovoid.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compilerplugins/clang/casttovoid.cxx b/compilerplugins/clang/casttovoid.cxx index bddfcb4da503..c02cf6887365 100644 --- a/compilerplugins/clang/casttovoid.cxx +++ b/compilerplugins/clang/casttovoid.cxx @@ -425,6 +425,11 @@ private: } } } else { + if (auto const fun = dyn_cast_or_null<FunctionDecl>(i.first->getDeclContext())) { + if (containsPreprocessingConditionalInclusion(fun->getSourceRange())) { + continue; + } + } for (auto const j: i.second.castToVoid) { report( DiagnosticsEngine::Warning, "unnecessary cast to void", |