[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - compilerplugins/clang

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Nov 21 16:46:48 UTC 2018


 compilerplugins/clang/expressionalwayszero.cxx |    5 -----
 1 file changed, 5 deletions(-)

New commits:
commit 031e1528a0e8e90a534b4b377eddac46b5d15937
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Sep 22 20:44:30 2018 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Nov 21 17:46:24 2018 +0100

    Always disable loplugin:expressionalwayszero, to avoid false positives
    
    bdade7e3fc33c1832c6f6a472443fca8238738d2 "tdf#105444 DOCX import: don't put
    extra paragraphs in comments" caused
    
    > /home/sbergman/lo2/core/writerfilter/source/dmapper/DomainMapper_Impl.cxx:441:22: error: expression always evaluates to zero, lhs=0 rhs=unknown [loplugin:expressionalwayszero]
    >                     (sizeof(SAL_NEWLINE_STRING)-1 == 2 && xCursor->getString() == "\n"))
    >                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    now with sufficiently new Clang, and the code looks reasonable, and there's no
    apparent way to avoid such false positives in the plugin.  (It could check for a
    sub-expression of the problematic expression being an object-like macro, but
    SAL_NEWLINE_STRING could just as well be a variable instead of a macro.  That
    variable would need to be defined in some #if to have different values on
    different platforms, so the plugin could theoretically check for such
    conditional inclusion, but it's not clear whether that's worth it and would even
    be a useful heuristic to not produce neither too many false positives nor too
    many false negatives.)  So just disable the plugin for good.
    
    Change-Id: I85dc8573735ccac4e19be20ab7443cbaa85a3164
    Reviewed-on: https://gerrit.libreoffice.org/60907
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit 8b1501d80dc9d3f42c351c6e026fa737e116cae5)
    Reviewed-on: https://gerrit.libreoffice.org/63717
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/expressionalwayszero.cxx b/compilerplugins/clang/expressionalwayszero.cxx
index 6633f138cfb3..3f6edae09475 100644
--- a/compilerplugins/clang/expressionalwayszero.cxx
+++ b/compilerplugins/clang/expressionalwayszero.cxx
@@ -149,12 +149,7 @@ bool ExpressionAlwaysZero::TraverseStaticAssertDecl( StaticAssertDecl * )
     return true;
 }
 
-// on clang-3.8, this plugin can generate OOM
-#if CLANG_VERSION >= 30900
-loplugin::Plugin::Registration< ExpressionAlwaysZero > X("expressionalwayszero");
-#else
 loplugin::Plugin::Registration< ExpressionAlwaysZero > X("expressionalwayszero", false);
-#endif
 
 }
 


More information about the Libreoffice-commits mailing list