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

Jochen Nitschke j.nitschke+logerrit at ok.de
Wed Apr 27 12:04:23 UTC 2016


 compilerplugins/clang/implicitboolconversion.cxx |    2 +-
 compilerplugins/clang/memoryvar.cxx              |    2 +-
 compilerplugins/clang/oncevar.cxx                |    2 +-
 compilerplugins/clang/passstuffbyref.cxx         |    2 +-
 compilerplugins/clang/plugin.hxx                 |    2 +-
 compilerplugins/clang/sallogareas.cxx            |    2 +-
 compilerplugins/clang/staticanonymous.cxx        |    2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 1520d0d6f3fdb78a09dfb436ba1d2f6804805311
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Tue Apr 26 15:50:12 2016 +0200

    cppcheck: silence warnings in compilerplugins
    
    mostly missing explicit before ctors and
    uninitialized member vars
    
    one odd use of std::find
    > compilerplugins/clang/implicitboolconversion.cxx
    > 800 stlIfFind warning	Suspicious condition.
    > The result of find() is an iterator, but it is not properly checked.
    
    Change-Id: Iade53494cd7fe8ddb0e110e431449ae5a517fe3b
    Reviewed-on: https://gerrit.libreoffice.org/24398
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx
index 226f49d..8c47212 100644
--- a/compilerplugins/clang/implicitboolconversion.cxx
+++ b/compilerplugins/clang/implicitboolconversion.cxx
@@ -797,7 +797,7 @@ bool ImplicitBoolConversion::TraverseCXXStdInitializerListExpr(
     bool ret = RecursiveASTVisitor::TraverseCXXStdInitializerListExpr(expr);
     assert(!nested.empty());
     for (auto i: nested.top()) {
-        if (!std::find(e->begin(), e->end(), i)) {
+        if (std::find(e->begin(), e->end(), i) == e->end()) {
             reportWarning(i);
         }
     }
diff --git a/compilerplugins/clang/memoryvar.cxx b/compilerplugins/clang/memoryvar.cxx
index 9cacdee..b407c76 100644
--- a/compilerplugins/clang/memoryvar.cxx
+++ b/compilerplugins/clang/memoryvar.cxx
@@ -25,7 +25,7 @@ class MemoryVar:
     public RecursiveASTVisitor<MemoryVar>, public loplugin::Plugin
 {
 public:
-    explicit MemoryVar(InstantiationData const & data): Plugin(data) {}
+    explicit MemoryVar(InstantiationData const & data): Plugin(data), mbChecking(false) {}
 
     virtual void run() override {
         TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
diff --git a/compilerplugins/clang/oncevar.cxx b/compilerplugins/clang/oncevar.cxx
index 6a348b4..5c203dfa 100644
--- a/compilerplugins/clang/oncevar.cxx
+++ b/compilerplugins/clang/oncevar.cxx
@@ -28,7 +28,7 @@ class OnceVar:
     public RecursiveASTVisitor<OnceVar>, public loplugin::Plugin
 {
 public:
-    explicit OnceVar(InstantiationData const & data): Plugin(data) {}
+    explicit OnceVar(InstantiationData const & data): Plugin(data), mbChecking(false) {}
 
     virtual void run() override {
         TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx
index 5ffec99..c30b6fb 100644
--- a/compilerplugins/clang/passstuffbyref.cxx
+++ b/compilerplugins/clang/passstuffbyref.cxx
@@ -31,7 +31,7 @@ class PassStuffByRef:
     public RecursiveASTVisitor<PassStuffByRef>, public loplugin::Plugin
 {
 public:
-    explicit PassStuffByRef(InstantiationData const & data): Plugin(data) {}
+    explicit PassStuffByRef(InstantiationData const & data): Plugin(data), mbInsideFunctionDecl(false), mbFoundDisqualifier(false) {}
 
     virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
 
diff --git a/compilerplugins/clang/plugin.hxx b/compilerplugins/clang/plugin.hxx
index 778d951..c630a3e 100644
--- a/compilerplugins/clang/plugin.hxx
+++ b/compilerplugins/clang/plugin.hxx
@@ -112,7 +112,7 @@ class RewritePlugin
             : public Rewriter::RewriteOptions
             {
             RewriteOptions();
-            RewriteOptions( RewriteOption option );
+            explicit RewriteOptions( RewriteOption option );
             const int flags;
             };
         // syntactic sugar to be able to write 'RemoveLineIfEmpty | RemoveWholeStatement'
diff --git a/compilerplugins/clang/sallogareas.cxx b/compilerplugins/clang/sallogareas.cxx
index a9f6e35..512177d 100644
--- a/compilerplugins/clang/sallogareas.cxx
+++ b/compilerplugins/clang/sallogareas.cxx
@@ -27,7 +27,7 @@ if appropriate.
 */
 
 SalLogAreas::SalLogAreas( const InstantiationData& data )
-    : Plugin( data )
+    : Plugin(data), inFunction(nullptr)
     {
     }
 
diff --git a/compilerplugins/clang/staticanonymous.cxx b/compilerplugins/clang/staticanonymous.cxx
index da5724b..ff62a56 100644
--- a/compilerplugins/clang/staticanonymous.cxx
+++ b/compilerplugins/clang/staticanonymous.cxx
@@ -21,7 +21,7 @@ class StaticAnonymous
     , public Plugin
     {
     public:
-        StaticAnonymous( const InstantiationData& data );
+        explicit StaticAnonymous( const InstantiationData& data );
         virtual void run() override;
         bool VisitFunctionDecl( FunctionDecl* func );
 


More information about the Libreoffice-commits mailing list