From b784f3899b7cae7ef1e50b1b5b4cee6bbbfe61f8 Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Tue, 13 Jun 2023 11:10:24 +0200
Subject: [PATCH] Fix boost and other compiler warnings

---
 DDCore/include/JSON/DocumentHandler.h    |  2 +-
 DDCore/include/JSON/Elements.h           |  2 +-
 DDCore/include/JSON/config.h             |  3 ++-
 DDCore/src/JSON/DocumentHandler.cpp      |  6 ++++--
 DDCore/src/plugins/JsonProcessor.cpp     | 21 +++++++++++----------
 DDG4/include/DDG4/Geant4FastSimHandler.h | 14 +++++++-------
 DDG4/include/DDG4/Geant4StepHandler.h    |  2 +-
 DDTest/src/test_PolarGridRPhi2.cc        |  6 +++---
 8 files changed, 30 insertions(+), 26 deletions(-)

diff --git a/DDCore/include/JSON/DocumentHandler.h b/DDCore/include/JSON/DocumentHandler.h
index 50f78892d..b12099e9f 100644
--- a/DDCore/include/JSON/DocumentHandler.h
+++ b/DDCore/include/JSON/DocumentHandler.h
@@ -14,7 +14,7 @@
 #define JSON_DOCUMENTHANDLER_H
 
 /// Framework include files
-#include "JSON/Elements.h"
+#include <JSON/Elements.h>
 
 /// Namespace for the AIDA detector description toolkit
 namespace dd4hep {
diff --git a/DDCore/include/JSON/Elements.h b/DDCore/include/JSON/Elements.h
index ec5e60418..e059e9617 100644
--- a/DDCore/include/JSON/Elements.h
+++ b/DDCore/include/JSON/Elements.h
@@ -20,7 +20,7 @@
 #include <stdexcept>
 
 // Framework include files
-#include "JSON/config.h"
+#include <JSON/config.h>
 
 #ifndef RAD_2_DEGREE
 #define RAD_2_DEGREE 57.295779513082320876798154814105
diff --git a/DDCore/include/JSON/config.h b/DDCore/include/JSON/config.h
index c97118ce9..1c5d179ef 100644
--- a/DDCore/include/JSON/config.h
+++ b/DDCore/include/JSON/config.h
@@ -17,7 +17,8 @@
 
 #define DD4HEP_USE_BOOST_JSON 1
 
-#include "boost/property_tree/ptree.hpp"
+#include <boost/bind/bind.hpp>
+#include <boost/property_tree/ptree.hpp>
 
 /// Namespace for the AIDA detector description toolkit
 namespace dd4hep {
diff --git a/DDCore/src/JSON/DocumentHandler.cpp b/DDCore/src/JSON/DocumentHandler.cpp
index 95f21c542..af803f29f 100644
--- a/DDCore/src/JSON/DocumentHandler.cpp
+++ b/DDCore/src/JSON/DocumentHandler.cpp
@@ -12,10 +12,12 @@
 //==========================================================================
 
 // Framework include files
-#include "JSON/DocumentHandler.h"
+#define BOOST_BIND_GLOBAL_PLACEHOLDERS
+#include <JSON/Helper.h>
+#include <JSON/DocumentHandler.h>
 
 // C/C++ include files
-#include "boost/property_tree/json_parser.hpp"
+#include <boost/property_tree/json_parser.hpp>
 #include <memory>
 #include <stdexcept>
 
diff --git a/DDCore/src/plugins/JsonProcessor.cpp b/DDCore/src/plugins/JsonProcessor.cpp
index 736e14c40..d147e6128 100644
--- a/DDCore/src/plugins/JsonProcessor.cpp
+++ b/DDCore/src/plugins/JsonProcessor.cpp
@@ -26,19 +26,20 @@
 */
 
 // Framework inlcude files
-#include "JSON/Helper.h"
-#include "JSON/DocumentHandler.h"
-#include "JSON/Conversions.h"
-#include "DD4hep/Plugins.h"
-#include "DD4hep/Printout.h"
-#include "DD4hep/IDDescriptor.h"
-#include "DD4hep/detail/SegmentationsInterna.h"
-#include "DD4hep/detail/DetectorInterna.h"
-#include "DD4hep/detail/ObjectsInterna.h"
+#define BOOST_BIND_GLOBAL_PLACEHOLDERS
+#include <JSON/Helper.h>
+#include <JSON/DocumentHandler.h>
+#include <JSON/Conversions.h>
+#include <DD4hep/Plugins.h>
+#include <DD4hep/Printout.h>
+#include <DD4hep/IDDescriptor.h>
+#include <DD4hep/detail/SegmentationsInterna.h>
+#include <DD4hep/detail/DetectorInterna.h>
+#include <DD4hep/detail/ObjectsInterna.h>
 
 // C/C++ include files
 #include <iostream>
-#include "boost/property_tree/json_parser.hpp"
+#include <boost/property_tree/json_parser.hpp>
 
 namespace {
   class Json;
diff --git a/DDG4/include/DDG4/Geant4FastSimHandler.h b/DDG4/include/DDG4/Geant4FastSimHandler.h
index 26b844d89..d140a778c 100644
--- a/DDG4/include/DDG4/Geant4FastSimHandler.h
+++ b/DDG4/include/DDG4/Geant4FastSimHandler.h
@@ -48,7 +48,7 @@ namespace dd4hep {
       Geant4FastSimHandler() = delete;
       /// Initializing constructor
       Geant4FastSimHandler(const Geant4FastSimSpot* sp)
-	: Geant4HitHandler(sp->primary, sp->touchable), spot(sp)
+        : Geant4HitHandler(sp->primary, sp->touchable), spot(sp)
       {
       }
       /// No copy constructor
@@ -61,7 +61,7 @@ namespace dd4hep {
       Geant4FastSimHandler& operator=(Geant4FastSimHandler&& copy) = delete;
       /// Returns total energy deposit
       double energy() const  {
-	return spot->hit->GetEnergy();
+        return spot->hit->GetEnergy();
       }
       /// Return track momentum in DD4hep notation
       Momentum momentum() const {
@@ -84,14 +84,14 @@ namespace dd4hep {
       }
       /// Returns the track momentum as a G4ThreeVector
       G4ThreeVector momentumG4() const {
-	return track->GetMomentum();
+        return track->GetMomentum();
       }
       /// Access the enery deposit of the energy spot
       double deposit() const  {
         return spot->hit->GetEnergy();
       }
       G4VPhysicalVolume* volume() const {
-	return touchable()->GetVolume();
+        return touchable()->GetVolume();
       }
       G4LogicalVolume* logvol() const {
         return volume()->GetLogicalVolume();
@@ -103,12 +103,12 @@ namespace dd4hep {
         G4LogicalVolume* lv = logvol();
         return lv ? lv->GetSensitiveDetector() : 0;
       }
-      const char* sdName(const char* undefined = "") const {
+      std::string sdName(const std::string& undefined = "") const {
         G4VSensitiveDetector* s = sd();
-        return s ? s->GetName().c_str() : undefined;
+        return s ? s->GetName() : undefined;
       }
       bool isSensitive() const {
-	G4LogicalVolume* lv = logvol();
+        G4LogicalVolume* lv = logvol();
         return lv ? (0 != lv->GetSensitiveDetector()) : false;
       }
     };
diff --git a/DDG4/include/DDG4/Geant4StepHandler.h b/DDG4/include/DDG4/Geant4StepHandler.h
index 57590aa3f..962fe750a 100644
--- a/DDG4/include/DDG4/Geant4StepHandler.h
+++ b/DDG4/include/DDG4/Geant4StepHandler.h
@@ -165,7 +165,7 @@ namespace dd4hep {
         G4LogicalVolume* lv = logvol(p);
         return lv ? lv->GetSensitiveDetector() : 0;
       }
-      const char* sdName(const G4StepPoint* p, const char* undefined = "") const {
+      std::string sdName(const G4StepPoint* p, const std::string& undefined = "") const {
         G4VSensitiveDetector* s = sd(p);
         return s ? s->GetName().c_str() : undefined;
       }
diff --git a/DDTest/src/test_PolarGridRPhi2.cc b/DDTest/src/test_PolarGridRPhi2.cc
index aaca8299b..1dad90965 100644
--- a/DDTest/src/test_PolarGridRPhi2.cc
+++ b/DDTest/src/test_PolarGridRPhi2.cc
@@ -112,9 +112,9 @@ int main() {
 
       dd4hep::DDSegmentation::CellID cid = seg.cellID(locPos, globPos, volID);
 
-      const long long phiShifted(pB << phiBitOffset);
-      const long long rShifted  (rB << rBitOffset);
-      const long long expectedID(rShifted + phiShifted);
+      const dd4hep::FieldID phiShifted(pB << phiBitOffset);
+      const dd4hep::FieldID rShifted  (rB << rBitOffset);
+      const dd4hep::CellID  expectedID(rShifted + phiShifted);
 
       test( expectedID , cid , " Test get ID From Position" );
 
-- 
GitLab