From be26000de47fb5242aa8e2d75a3ce9c2ef8e2845 Mon Sep 17 00:00:00 2001
From: Achim Gsell <achim.gsell@psi.ch>
Date: Thu, 30 Nov 2017 12:26:58 +0100
Subject: [PATCH] ippl: Clang warnings/errors fixed

---
 ippl/src/Particle/IntTSC.h                     | 18 ------------------
 .../src/Particle/PairBuilder/HashPairBuilder.h |  6 +++---
 ippl/src/Utility/IpplTimings.h                 |  3 ++-
 ippl/src/Utility/PAssert.h                     |  8 ++++++++
 4 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/ippl/src/Particle/IntTSC.h b/ippl/src/Particle/IntTSC.h
index a5a9467e1..82c60d315 100644
--- a/ippl/src/Particle/IntTSC.h
+++ b/ippl/src/Particle/IntTSC.h
@@ -54,7 +54,6 @@ public:
     CompressedBrickIterator<FT,Dim> fiter;
     //BENI: offset not needed, since NGP is used as center
 	//int lgpoff[Dim];
-    unsigned int d;
     // find nearest grid point for particle position, store in NDIndex obj
     ngp = FindNGP(mesh, ppos, ctag);
     // get position of ngp
@@ -96,7 +95,6 @@ public:
     CenteringTag<C> ctag;
     Vektor<PT,Dim> gpos, delta;
     CompressedBrickIterator<FT,Dim> fiter;
-    unsigned int d;
     // find nearest grid point for particle position, store in NDIndex obj
     ngp = FindNGP(mesh, ppos, ctag);
     // get position of ngp
@@ -154,7 +152,6 @@ public:
     NDIndex<Dim> ngp;
     CompressedBrickIterator<FT,Dim> fiter;
     int lgpoff[Dim];
-    unsigned int d;
     // find nearest grid point for particle position, store in NDIndex obj
     ngp = FindNGP(mesh, ppos, ctag);
     // get position of ngp
@@ -196,7 +193,6 @@ public:
     CenteringTag<C> ctag;
     Vektor<PT,Dim> gpos, delta;
     CompressedBrickIterator<FT,Dim> fiter;
-    unsigned int d;
     // find nearest grid point for particle position, store in NDIndex obj
     ngp = FindNGP(mesh, ppos, ctag);
     // get position of ngp
@@ -266,8 +262,6 @@ public:
     Vektor<PT,1U> gpos, dpos, delta;
     NDIndex<1U> ngp;
     CompressedBrickIterator<FT,1U> fiter;
-    int lgpoff[1U];
-    unsigned int d;
     // find nearest grid point for particle position, store in NDIndex obj
     ngp = FindNGP(mesh, ppos, ctag);
     // get position of ngp
@@ -307,7 +301,6 @@ public:
     CenteringTag<C> ctag;
     Vektor<PT,1U> gpos, delta;
     CompressedBrickIterator<FT,1U> fiter;
-    unsigned int d;
     // find nearest grid point for particle position, store in NDIndex obj
     ngp = FindNGP(mesh, ppos, ctag);
     // get position of ngp
@@ -376,8 +369,6 @@ public:
     Vektor<PT,1U> gpos, dpos, delta;
     NDIndex<1U> ngp;
     CompressedBrickIterator<FT,1U> fiter;
-    int lgpoff[1U];
-    unsigned int d;
     // find nearest grid point for particle position, store in NDIndex obj
     ngp = FindNGP(mesh, ppos, ctag);
     // get position of ngp
@@ -421,7 +412,6 @@ public:
     CenteringTag<C> ctag;
     Vektor<PT,1U> gpos, delta;
     CompressedBrickIterator<FT,1U> fiter;
-    unsigned int d;
     // find nearest grid point for particle position, store in NDIndex obj
     ngp = FindNGP(mesh, ppos, ctag);
     // get position of ngp
@@ -504,8 +494,6 @@ public:
     Vektor<PT,2U> gpos, dpos, delta;
     NDIndex<2U> ngp;
     CompressedBrickIterator<FT,2U> fiter;
-    int lgpoff[2U];
-    unsigned int d;
     // find nearest grid point for particle position, store in NDIndex obj
     ngp = FindNGP(mesh, ppos, ctag);
     // get position of ngp
@@ -553,7 +541,6 @@ public:
     CenteringTag<C> ctag;
     Vektor<PT,2U> gpos, delta;
     CompressedBrickIterator<FT,2U> fiter;
-    unsigned int d;
     // find nearest grid point for particle position, store in NDIndex obj
     ngp = FindNGP(mesh, ppos, ctag);
     // get position of ngp
@@ -640,8 +627,6 @@ public:
     Vektor<PT,2U> gpos, dpos, delta;
     NDIndex<2U> ngp;
     CompressedBrickIterator<FT,2U> fiter;
-    int lgpoff[2U];
-    unsigned int d;
     // find nearest grid point for particle position, store in NDIndex obj
     ngp = FindNGP(mesh, ppos, ctag);
     // get position of ngp
@@ -691,7 +676,6 @@ public:
     CenteringTag<C> ctag;
     Vektor<PT,2U> gpos, delta;
     CompressedBrickIterator<FT,2U> fiter;
-    unsigned int d;
     // find nearest grid point for particle position, store in NDIndex obj
     ngp = FindNGP(mesh, ppos, ctag);
     // get position of ngp
@@ -834,7 +818,6 @@ public:
     CenteringTag<C> ctag;
     Vektor<PT,3U> gpos, delta;
     CompressedBrickIterator<FT,3U> fiter;
-    unsigned int d;
     // find nearest grid point for particle position, store in NDIndex obj
     ngp = FindNGP(mesh, ppos, ctag);
     // get position of ngp
@@ -948,7 +931,6 @@ public:
     CenteringTag<C> ctag;
     Vektor<PT,3U> gpos, delta;
     CompressedBrickIterator<FT,3U> fiter;
-    unsigned int d;
     // find nearest grid point for particle position, store in NDIndex obj
     ngp = FindNGP(mesh, ppos, ctag);
     // get position of ngp
diff --git a/ippl/src/Particle/PairBuilder/HashPairBuilder.h b/ippl/src/Particle/PairBuilder/HashPairBuilder.h
index 09e8d2725..d36f361f1 100644
--- a/ippl/src/Particle/PairBuilder/HashPairBuilder.h
+++ b/ippl/src/Particle/PairBuilder/HashPairBuilder.h
@@ -76,9 +76,9 @@ public:
             buckets[bucket_id] = i;
         }
 
-        for (int i=0; i< Nbucket; ++i) {
+        for (std::size_t i=0; i< Nbucket; ++i) {
             //dmsg << "Bucket " << i << " stores particles " << endl;
-            int j = buckets[i];
+		std::size_t j = buckets[i];
             while (j!= END) {
                 //dmsg << j << " :: " << particles.R[j] << endl;
                 j = next[j];
@@ -92,7 +92,7 @@ public:
                     //dmsg << "bx = " << bx << "by = " << by << " bz = " << bz <<endl;
                     unsigned bucket_id_self = bz*buckets_per_dim[1]*buckets_per_dim[0]+by*buckets_per_dim[0]+bx;
                     //compute index of neighboring cell to interact with
-                    for (unsigned n=0; n<neigh;++n){
+                    for (int n=0; n<neigh;++n){
                         unsigned bx_neigh = bx+offset[n][0];
                         unsigned by_neigh = by+offset[n][1];
                         unsigned bz_neigh = bz+offset[n][2];
diff --git a/ippl/src/Utility/IpplTimings.h b/ippl/src/Utility/IpplTimings.h
index c4744a61c..239691cda 100644
--- a/ippl/src/Utility/IpplTimings.h
+++ b/ippl/src/Utility/IpplTimings.h
@@ -39,6 +39,7 @@
 #include "Utility/Timer.h"
 #include "Utility/my_auto_ptr.h"
 
+#include <string>
 #include <vector>
 #include <map>
 #include <limits>
@@ -241,4 +242,4 @@ private:
  * $RCSfile: addheaderfooter,v $   $Author: adelmann $
  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:17 $
  * IPPL_VERSION_ID: $Id: addheaderfooter,v 1.1.1.1 2003/01/23 07:40:17 adelmann Exp $
- ***************************************************************************/
\ No newline at end of file
+ ***************************************************************************/
diff --git a/ippl/src/Utility/PAssert.h b/ippl/src/Utility/PAssert.h
index d40bc3a9e..9f66bdb68 100644
--- a/ippl/src/Utility/PAssert.h
+++ b/ippl/src/Utility/PAssert.h
@@ -57,7 +57,15 @@ public:
     assertion( const assertion& a );
   ~assertion() throw() { delete[] msg; }
     assertion& operator=( const assertion& a );
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Woverloaded-virtual"
+#endif
     const char* what()  { return msg; }
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
 };
 
 //---------------------------------------------------------------------------//
-- 
GitLab