[Libreoffice-commits] core.git: compilerplugins/clang sw/source

Stephan Bergmann sbergman at redhat.com
Fri Nov 24 14:55:16 UTC 2017


 compilerplugins/clang/commaoperator.cxx      |    8 ++++++++
 compilerplugins/clang/test/commaoperator.cxx |    1 +
 compilerplugins/clang/unnecessaryparen.cxx   |    8 --------
 sw/source/filter/html/htmltab.cxx            |    4 ++--
 4 files changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 832584eae514ea9cd4b3b42f1a2e9d69a17c5160
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Nov 24 11:24:50 2017 +0100

    Clean up loplugin:unnecessaryparen blacklist
    
    * rsc/source/parser/rscyacc.cxx no longer exists
    
    * writerfilter/source/rtftok/rtftokenizer.cxx appears to be just fine nowadays?
    
    * sw/source/filter/html/htmltab.cxx used redundant parentheses around a comma
      operator in a while condition, and I see no reason not to remove them (the
      result requires a---reasonable---tweak to loplugin:commaoperator, though)
    
    Change-Id: I451132c700b0ae5a43b03d704156484df897ad5c
    Reviewed-on: https://gerrit.libreoffice.org/45213
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/commaoperator.cxx b/compilerplugins/clang/commaoperator.cxx
index 4e8ea6153e12..0693fc83a07b 100644
--- a/compilerplugins/clang/commaoperator.cxx
+++ b/compilerplugins/clang/commaoperator.cxx
@@ -50,6 +50,14 @@ public:
         return ret;
     }
 
+    bool TraverseWhileStmt(WhileStmt * stmt) {
+        auto const saved1 = ignore1_;
+        ignore1_ = lookThroughExprWithCleanups(stmt->getCond());
+        auto const ret = RecursiveASTVisitor::TraverseWhileStmt(stmt);
+        ignore1_ = saved1;
+        return ret;
+    }
+
     bool TraverseParenExpr(ParenExpr * expr) {
         auto const saved1 = ignore1_;
         ignore1_ = expr->getSubExpr();
diff --git a/compilerplugins/clang/test/commaoperator.cxx b/compilerplugins/clang/test/commaoperator.cxx
index 199dcf41c243..6abe963ae7a9 100644
--- a/compilerplugins/clang/test/commaoperator.cxx
+++ b/compilerplugins/clang/test/commaoperator.cxx
@@ -22,6 +22,7 @@ int main() {
     S s;
     (s = S(), s = S(), s = S());
     for (s = S(), f(); f(); s = S(), f()) {}
+    while (s = S(), f()) {}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/unnecessaryparen.cxx b/compilerplugins/clang/unnecessaryparen.cxx
index a7d3d26e6591..3a97c0d39456 100644
--- a/compilerplugins/clang/unnecessaryparen.cxx
+++ b/compilerplugins/clang/unnecessaryparen.cxx
@@ -67,14 +67,6 @@ public:
              return;
         if (loplugin::isSamePathname(fn, WORKDIR "/YaccTarget/idlc/source/parser.cxx"))
              return;
-        if (loplugin::isSamePathname(fn, WORKDIR "/YaccTarget/rsc/source/parser/rscyacc.cxx"))
-             return;
-
-        // TODO yuck, comma operator at work
-        if (loplugin::isSamePathname(fn, SRCDIR "/writerfilter/source/rtftok/rtftokenizer.cxx"))
-             return;
-        if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/filter/html/htmltab.cxx"))
-             return;
 
         TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
     }
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 2a5f87f16d67..b6e1d5db18bf 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -1142,7 +1142,7 @@ void HTMLTable::FixRowSpan( sal_uInt16 nRow, sal_uInt16 nCol,
 {
     sal_uInt16 nRowSpan=1;
     HTMLTableCell *pCell;
-    while( ( pCell=GetCell(nRow,nCol), pCell->GetContents()==pCnts ) )
+    while( pCell=GetCell(nRow,nCol), pCell->GetContents()==pCnts )
     {
         pCell->SetRowSpan( nRowSpan );
         if( m_pLayoutInfo )
@@ -1404,7 +1404,7 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
                                                       : (nInnerFrameWidth / 2) );
                 // We only set the item if there's a border or a border distance
                 // If the latter is missing, there's gonna be a border and we'll have to set the distance
-                aBoxItem.SetAllDistances((nBDist) ? nBDist : MIN_BORDER_DIST);
+                aBoxItem.SetAllDistances(nBDist ? nBDist : MIN_BORDER_DIST);
                 pFrameFormat->SetFormatAttr( aBoxItem );
             }
             else


More information about the Libreoffice-commits mailing list