compilerplugins/clang/casttovoid.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit cb06f61967850f7c3bbaaf3575901d6a18b94c96
Author: Stephan Bergmann <[email protected]>
Date:   Tue Apr 17 17:13:50 2018 +0200

    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 <[email protected]>
    Reviewed-by: Stephan Bergmann <[email protected]>

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",
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to