From f71a9a513eb4015f8fea39ef72728a306e66d3b7 Mon Sep 17 00:00:00 2001
From: Soeren Peters <peters@irmb.tu-bs.de>
Date: Thu, 8 Oct 2020 10:04:40 +0200
Subject: [PATCH] Remove some clang tidy warnings.

---
 3rdParty/MuParser/include/muParserDLL.h       |  2 ++
 src/basics/basics/memory/MbSmartPtr.h         | 22 +---------------
 src/basics/basics/memory/MbSmartPtrBase.h     |  5 ++--
 src/basics/geometry3d/GbTriFaceMesh3D.cpp     | 15 ++---------
 src/basics/geometry3d/GbTriFaceMesh3D.h       |  6 ++---
 .../geometry3d/KdTree/KdSplitCandidate.h      | 25 +++++--------------
 src/basics/geometry3d/KdTree/KdUtilities.h    |  2 +-
 7 files changed, 18 insertions(+), 59 deletions(-)

diff --git a/3rdParty/MuParser/include/muParserDLL.h b/3rdParty/MuParser/include/muParserDLL.h
index 18051c4d7..d3aebeb96 100644
--- a/3rdParty/MuParser/include/muParserDLL.h
+++ b/3rdParty/MuParser/include/muParserDLL.h
@@ -29,6 +29,8 @@
 #ifndef MU_PARSER_DLL_H
 #define MU_PARSER_DLL_H
 
+#pragma clang system_header
+
 #include "muParserFixes.h"
 
 #ifdef __cplusplus
diff --git a/src/basics/basics/memory/MbSmartPtr.h b/src/basics/basics/memory/MbSmartPtr.h
index 0a705fa26..0757fb91c 100644
--- a/src/basics/basics/memory/MbSmartPtr.h
+++ b/src/basics/basics/memory/MbSmartPtr.h
@@ -66,7 +66,7 @@ public:
 	template<class ParamType>
 	const MbSmartPtr<ObjType>& operator =(const MbSmartPtr<ParamType>& ptr)
 	{
-   	init(ptr.get());
+   	    init(ptr.get());
 		return *this;
 	}
 	const MbSmartPtr<ObjType>& operator =(const MbSmartPtr<ObjType>& ptr)
@@ -102,26 +102,6 @@ public:
    {
       return MbSmartPtrBase::removeFromGC(mpPtr);
    }
-
-#ifdef CAB_RCF
-   template<class Archive>
-   void serialize(Archive & ar, const unsigned int version)
-   {
-      if(ArchiveTools::isWriting(ar))
-      {
-         ar & mpPtr;
-      }
-      else
-      {
-         ObjType* ptr;
-         ar & ptr;
-
-         mpPtr=NULL;
-         init(ptr);
-      }
-   }
-#endif //CAB_RCF
-
 private:
    void init(const ObjType* pPtr)
 	{
diff --git a/src/basics/basics/memory/MbSmartPtrBase.h b/src/basics/basics/memory/MbSmartPtrBase.h
index ee81baa53..7c531902b 100644
--- a/src/basics/basics/memory/MbSmartPtrBase.h
+++ b/src/basics/basics/memory/MbSmartPtrBase.h
@@ -29,11 +29,12 @@ class MbSmartPtrBase
    {
    private:
       MbSmartPtrBaseMap() = default;
-      MbSmartPtrBaseMap( const MbSmartPtrBaseMap& );                  //no copy allowed
-      const MbSmartPtrBaseMap& operator=( const MbSmartPtrBaseMap& ); //no copy allowed
 
       std::map<void*,int> mpCntrMap;
    public:
+       MbSmartPtrBaseMap( const MbSmartPtrBaseMap& ) = delete;
+       const MbSmartPtrBaseMap& operator=( const MbSmartPtrBaseMap& ) = delete;
+
       static MbSmartPtrBaseMap* getInstance() { static MbSmartPtrBaseMap instance; return &instance; }
       std::map<void*,int>& getMap()           { return mpCntrMap;                                    }
    };
diff --git a/src/basics/geometry3d/GbTriFaceMesh3D.cpp b/src/basics/geometry3d/GbTriFaceMesh3D.cpp
index 6ac4146ee..e883f5956 100644
--- a/src/basics/geometry3d/GbTriFaceMesh3D.cpp
+++ b/src/basics/geometry3d/GbTriFaceMesh3D.cpp
@@ -22,10 +22,6 @@ using namespace std;
 
 GbTriFaceMesh3D::GbTriFaceMesh3D() 
    :   GbObject3D()
-     , 
-      kdTree(NULL)
-      
-
 {
    this->setName("CAB_GbTriFaceMesh3D");
    this->nodes          = new vector<Vertex>;
@@ -38,14 +34,7 @@ GbTriFaceMesh3D::GbTriFaceMesh3D(string name, vector<Vertex>* nodes, vector<TriF
    :  GbObject3D()
     , nodes(nodes)
     , triangles(triangles)
-    , buildVertTriRelationMap(false)
-    , consistent(false)
-    , kdTree(NULL)
     , kdtreeSplitAlg(splitAlg)
-    , transX1(0.0)
-    , transX2(0.0)
-    , transX3(0.0)
-    , transferViaFilename(false)
 {
    if( name.empty() ) throw UbException(UB_EXARGS,"no name specified");
    if( !nodes       ) throw UbException(UB_EXARGS,"no nodes specified");
@@ -330,7 +319,7 @@ UbTupleDouble3 GbTriFaceMesh3D::calculateCenterOfGravity()
    rSP2 = rSP2/(24.0*volume);
    rSP3 = rSP3/(24.0*volume);
 
-   return UbTupleDouble3(rSP1, rSP2, rSP3);
+   return  {rSP1, rSP2, rSP3};
 }
 /*===============================================*/
 UbTupleDouble6 GbTriFaceMesh3D::calculateMomentOfInertia(double rhoP)
@@ -406,7 +395,7 @@ UbTupleDouble6 GbTriFaceMesh3D::calculateMomentOfInertia(double rhoP)
    cout<<" top11:"<<top11<<" top22:"<<top22<<" top33:"<<top33<<endl;
    cout<<" top12:"<<top12<<" top23:"<<top23<<" top13:"<<top13<<endl;
 
-   return UbTupleDouble6(top11,top22,top33,top12,top23,top13);
+   return {top11,top22,top33,top12,top23,top13};
 }
 /*==============================================================*/
 void GbTriFaceMesh3D::calculateValues()
diff --git a/src/basics/geometry3d/GbTriFaceMesh3D.h b/src/basics/geometry3d/GbTriFaceMesh3D.h
index eff53d4e2..ec69a7b37 100644
--- a/src/basics/geometry3d/GbTriFaceMesh3D.h
+++ b/src/basics/geometry3d/GbTriFaceMesh3D.h
@@ -104,7 +104,7 @@ public:
           
       = default;
       TriFace(const int& v1, const int& v2, const int& v3)
-         : v1(v1), v2(v2), v3(v3), nx(0.0), ny(0.0), nz(0.0)
+         : v1(v1), v2(v2), v3(v3)
       {
       }
 
@@ -314,12 +314,12 @@ protected:
    double x2center;
    double x3center;
 
-   bool   consistent;
+   bool consistent {false};
 
    bool buildVertTriRelationMap{false};
    std::multimap<Vertex*,TriFace*> relationVertTris;
 
-   Kd::Tree< double >* kdTree;
+   Kd::Tree< double >* kdTree = nullptr;
 };
 
 
diff --git a/src/basics/geometry3d/KdTree/KdSplitCandidate.h b/src/basics/geometry3d/KdTree/KdSplitCandidate.h
index 0b532b819..b7719ebf3 100644
--- a/src/basics/geometry3d/KdTree/KdSplitCandidate.h
+++ b/src/basics/geometry3d/KdTree/KdSplitCandidate.h
@@ -9,28 +9,15 @@ namespace Kd
    class SplitCandidate   
    {
    public:
-      SplitCandidate() 
-         :  
-           position(0.0)
-          , 
-           Cn(0.0)
-           
-      {
-
-      }
+      SplitCandidate() = default;
       /* ======================================================================================= */
-      SplitCandidate(const int& axis, const T& position, const int& starting, const int& ending, const int& insidePlane)
-         : np_left(false)
-         , np_right(false)
-         , axis(axis)
+      SplitCandidate(const int& axis, const T& position, const int& starting, const int& ending, const int& insidePlane) :
+           axis(axis)
          , position(position)
          , starting(starting)
          , ending(ending)
          , np(insidePlane)
-         , Cn(0.0) 
-         , nr(0)  
-         , nl(0)  
-         , isValid(true)
+         , isValid(true) //FIXME: isValid default false is correct?
       {
       }
       /* ======================================================================================= */
@@ -47,8 +34,8 @@ namespace Kd
 
    public:
       int     axis{0};
-      T       Cn;
-      T       position;
+      T       Cn {0.0};
+      T       position {0.0};
       int     nl{0};
       int     nr{0};
       int     np;
diff --git a/src/basics/geometry3d/KdTree/KdUtilities.h b/src/basics/geometry3d/KdTree/KdUtilities.h
index 134497543..2c56652d2 100644
--- a/src/basics/geometry3d/KdTree/KdUtilities.h
+++ b/src/basics/geometry3d/KdTree/KdUtilities.h
@@ -52,7 +52,7 @@ namespace Kd
       }
       else throw UbException(UB_EXARGS,"unknown axis");
       
-      std::sort( projection.begin(), projection.end(), std::less<double>() );
+      std::sort( projection.begin(), projection.end(), std::less<>() );
    }
    /* ======================================================================================= */
    template< typename T>
-- 
GitLab