From 8bdbf412e52c40760b4a79ec90ec194818941716 Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Thu, 24 Nov 2016 18:45:39 +0100
Subject: [PATCH] Fix linker errors on MAC

---
 DDCond/src/ConditionsAccess.cpp        | 11 ++---
 DDCond/src/ConditionsInterna.cpp       | 57 ++++-------------------
 DDCore/src/Evaluator/Evaluator.cpp     |  2 +-
 DDCore/src/OpaqueDataBinder.cpp        | 44 ++++++++++++------
 DDDB/src/DDDBPlugins.cpp               | 64 +++++++++++---------------
 DDTest/include/DD4hep/DDTest.h         | 48 +++++++++----------
 DDTest/src/STR.h                       |  1 +
 DDTest/src/test_DetType.cc             |  2 +-
 DDTest/src/test_EventReaders.cc        |  2 +-
 DDTest/src/test_PolarGridRPhi2.cc      |  2 +-
 DDTest/src/test_bitfield64.cc          |  2 +-
 DDTest/src/test_cellDimensions.cc      |  2 +-
 DDTest/src/test_cellDimensionsRPhi2.cc |  2 +-
 DDTest/src/test_example.cc             |  2 +-
 DDTest/src/test_segmentationHandles.cc |  2 +-
 DDTest/src/test_surface.cc             |  2 +-
 DDTest/src/test_units.cc               |  2 +-
 UtilityApps/src/EvNavHandler.h         |  1 -
 UtilityApps/src/LinkDef.h              |  1 -
 UtilityApps/src/MultiView.h            |  1 -
 UtilityApps/src/converter.cpp          |  1 -
 UtilityApps/src/display.cpp            |  1 -
 UtilityApps/src/dumpdetector.cpp       |  1 -
 UtilityApps/src/materialScan.cpp       |  1 -
 UtilityApps/src/next_event_dummy.cpp   |  1 -
 UtilityApps/src/next_event_lcio.cpp    |  1 -
 UtilityApps/src/plugin_runner.cpp      |  1 -
 UtilityApps/src/print_materials.cpp    |  1 -
 UtilityApps/src/test_surfaces.cpp      |  3 +-
 UtilityApps/src/teve_display.cpp       |  1 -
 cmake/DD4hepBuild.cmake                | 10 ++++
 31 files changed, 115 insertions(+), 157 deletions(-)

diff --git a/DDCond/src/ConditionsAccess.cpp b/DDCond/src/ConditionsAccess.cpp
index f13737504..2a1d5ac42 100644
--- a/DDCond/src/ConditionsAccess.cpp
+++ b/DDCond/src/ConditionsAccess.cpp
@@ -1,4 +1,3 @@
-// $Id$
 //==========================================================================
 //  AIDA Detector description implementation for LCD
 //--------------------------------------------------------------------------
@@ -13,11 +12,7 @@
 //==========================================================================
 
 // Framework include files
-#include "DD4hep/LCDD.h"
-#include "DD4hep/Errors.h"
-#include "DD4hep/Printout.h"
-#include "DD4hep/DetectorTools.h"
-
+#include "DD4hep/Conditions.h"
 #include "DDCond/ConditionsInterna.h"
 #include "DDCond/ConditionsAccess.h"
 
@@ -39,8 +34,8 @@ const vector<const IOVType*> ConditionsAccess::iovTypesUsed() const  {
   Object* obj = access();
   vector<const IOVType*> result;
   const Object::IOVTypes& types = obj->iovTypes();
-  for(Object::IOVTypes::const_iterator i=types.begin(); i!=types.end(); ++i)
-    if ( int((*i).type) != IOVType::UNKNOWN_IOV ) result.push_back(&(*i));
+  for(const auto& i : types )
+    if ( int(i.type) != IOVType::UNKNOWN_IOV ) result.push_back(&i);
   return result;
 }
 
diff --git a/DDCond/src/ConditionsInterna.cpp b/DDCond/src/ConditionsInterna.cpp
index 32150b794..dcd9976cb 100644
--- a/DDCond/src/ConditionsInterna.cpp
+++ b/DDCond/src/ConditionsInterna.cpp
@@ -110,8 +110,8 @@ namespace {
       // The range may be returned unordered. Hence, 
       // we have to try to match at most conditions.size() times until we really know
       for(size_t j = 0; j < conditions.size(); ++j )  {
-        for(RC::const_iterator i=conditions.begin(); i!=conditions.end(); ++i)  {
-          const IOV::Key& k = (*i)->iov->key();
+        for(const auto& cond : conditions )   {
+          const IOV::Key& k = cond->iov->key();
           if ( k.first   <= test.first+1 && k.second >= test.first  ) test.first = k.second;
           if ( k.first+1 <= test.second  && k.second >= test.second ) test.second = k.first;
           //printout(INFO,"Test","IOV: %ld,%ld --> %ld,%ld",k.first,k.second, test.first, test.second);
@@ -125,10 +125,8 @@ namespace {
 
   template <typename PMF>
   void __callListeners(const ConditionsManagerObject::Listeners& listeners, PMF pmf, Condition& cond)  {
-    for(ConditionsManagerObject::Listeners::const_iterator i=listeners.begin(); i!=listeners.end(); ++i)  {
-      const ConditionsManagerObject::Listener& listener = *i;
+    for(const auto& listener : listeners )
       (listener.first->*pmf)(cond, listener.second);
-    }
   }
 }
 
@@ -248,8 +246,8 @@ const IOVType* ConditionsManagerObject::iovType (size_t iov_type) const  {
 
 /// Access IOV by its name
 const IOVType* ConditionsManagerObject::iovType (const string& iov_name) const   {
-  for( IOVTypes::const_iterator i=m_iovTypes.begin(); i != m_iovTypes.end(); ++i)
-    if ( (*i).name == iov_name ) return &(*i);
+  for( const auto& i : m_iovTypes ) 
+    if ( i.name == iov_name ) return &i;
   except("ConditionsManager","Request to access an unregistered IOV type: %s.", iov_name.c_str());
   return 0;
 }
@@ -397,55 +395,16 @@ void ConditionsManagerObject::pushUpdates()   {
   // Lock global pool so that no other updates happen in the meanwhile
   // which could kill the pool's containers
   dd4hep_lock_t lock(m_poolLock);
-  for(Updates::const_iterator iov_iter=entries.begin(); iov_iter!=entries.end(); ++iov_iter)  {
-    typedef UpdatePool::ConditionEntries _E;
-    const _E& ents = (*iov_iter).second;
+  for(const auto& iov_iter : entries )  {
+    const UpdatePool::ConditionEntries& ents = iov_iter.second;
     if ( !ents.empty() )  {
-      for(_E::const_iterator j=ents.begin(); j != ents.end(); ++j)  {
-        Condition c = *j;
+      for(Condition c : ents )  {
         c->setFlag(Condition::ACTIVE);
         c->pool->insert(c);
       }
     }
   }
 }
-#if 0
-/// Prepare all updates to the clients with the defined IOV
-long ConditionsManagerObject::prepare(const Condition::iov_type& required_validity,
-				      dd4hep_ptr<UserPool>& up)
-{
-  const IOVType* typ = check_iov_type<Discrete>(this, &required_validity);
-  if ( typ )  {
-    RC valid, expired;
-    ConditionsIOVPool* pool = m_rawPool[typ->type];
-    if ( 0 == up.get() || up->pool_type != ConditionsPool::USER_POOL_TYPE )  {
-      const void* argv_pool[] = {this, 0};
-      UserPool* cp = createPlugin<UserPool>(m_userType,m_lcdd,1,argv_pool);
-      up.adopt(cp);
-    }
-    UserPool *user_pool = up.get();
-    /// First push any pending updates and register them to pending pools...
-    Condition::iov_type pool_iov(typ);
-    pool_iov.reset().invert();
-
-    pushUpdates();
-    pool->select(required_validity, valid, expired, pool_iov);
-    user_pool->clear();
-    user_pool->insert(valid);
-    long num_expired = (long)expired.size();
-    if ( num_expired > 0 )  {
-      m_loader->update(required_validity, expired, pool_iov);
-      user_pool->insert(expired);
-    }
-    user_pool->setValidity(pool_iov);
-    user_pool->setReqValidity(required_validity);
-    return num_expired;
-  }
-  except("ConditionsManager","+++ Unknown IOV type requested to enable conditions. [%s]",
-         Errors::invalidArg().c_str());
-  return -1;
-}
-#endif
 
 /// Helper to check iov and user pool and create user pool if not present
 void ConditionsManagerObject::__get_checked_pool(const IOV& req_iov,
diff --git a/DDCore/src/Evaluator/Evaluator.cpp b/DDCore/src/Evaluator/Evaluator.cpp
index 286563812..034202096 100644
--- a/DDCore/src/Evaluator/Evaluator.cpp
+++ b/DDCore/src/Evaluator/Evaluator.cpp
@@ -14,7 +14,7 @@
 #include <stdlib.h>     // for strtod()
 
 // Disable some diagnostics, which we know, but need to ignore
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__APPLE__)
 /*  This is OK:
 ../DDCore/src/Evaluator/Evaluator.cpp: In function 'int engine(pchar, pchar, double&, char*&, const dic_type&)':
 ../DDCore/src/Evaluator/Evaluator.cpp:164:23: warning: 'pp[3]' may be used uninitialized in this function [-Wmaybe-uninitialized]
diff --git a/DDCore/src/OpaqueDataBinder.cpp b/DDCore/src/OpaqueDataBinder.cpp
index 808577d4e..10759fc86 100644
--- a/DDCore/src/OpaqueDataBinder.cpp
+++ b/DDCore/src/OpaqueDataBinder.cpp
@@ -110,6 +110,23 @@ namespace DD4hep {
       printout(INFO,"OpaqueDataBinder","++ Unknown conditions parameter type:%s val:%s",typ.c_str(),val.c_str());
     return __bind__(b,object,val,_string());
   }
+  template bool OpaqueDataBinder::bind<ValueBinder,OpaqueDataBlock>(        const ValueBinder& b, OpaqueDataBlock& object,
+                                                                            const string& typ, const string& val);
+  template bool OpaqueDataBinder::bind<VectorBinder,OpaqueDataBlock>(       const VectorBinder& b, OpaqueDataBlock& object,
+                                                                            const string& typ, const string& val);
+  template bool OpaqueDataBinder::bind<ListBinder,OpaqueDataBlock>(         const ListBinder& b, OpaqueDataBlock& object,
+                                                                            const string& typ, const string& val);
+  template bool OpaqueDataBinder::bind<SetBinder,OpaqueDataBlock>(          const SetBinder& b, OpaqueDataBlock& object,
+                                                                            const string& typ, const string& val);
+
+  template bool OpaqueDataBinder::bind<ValueBinder,Conditions::Condition>(  const ValueBinder& b, Conditions::Condition& object,
+                                                                            const string& typ, const string& val);
+  template bool OpaqueDataBinder::bind<VectorBinder,Conditions::Condition>( const VectorBinder& b, Conditions::Condition& object,
+                                                                            const string& typ, const string& val);
+  template bool OpaqueDataBinder::bind<ListBinder,Conditions::Condition>(   const ListBinder& b, Conditions::Condition& object,
+                                                                            const string& typ, const string& val);
+  template bool OpaqueDataBinder::bind<SetBinder,Conditions::Condition>(    const SetBinder& b, Conditions::Condition& object,
+                                                                            const string& typ, const string& val);
   
   /// Binding function for sequences (unmapped STL containers)
   template <typename T> 
@@ -359,17 +376,19 @@ namespace DD4hep {
     return true;
   }
 
-  /// Instantiate the data binder for OpaqueData
   template bool OpaqueDataBinder::bind_sequence<OpaqueDataBlock>(OpaqueDataBlock& object,const string& typ,const string& val);
-  template bool OpaqueDataBinder::bind_map<MapBinder,OpaqueDataBlock>(  const MapBinder& b, OpaqueDataBlock& object,
-                                                                        const string& typ,const string& val);
-  template bool OpaqueDataBinder::insert_map<MapBinder,OpaqueDataBlock>(const MapBinder& b, OpaqueDataBlock& object,
-                                                                        const string& key_type, const string& key,
-                                                                        const string& val_type, const string& val);
-  template bool OpaqueDataBinder::insert_map<MapBinder,OpaqueDataBlock>(const MapBinder& b, OpaqueDataBlock& object,
-                                                                        const string& key_type, const string& val_type,
-                                                                        const string& pair_data);
+  template bool OpaqueDataBinder::bind_map<MapBinder,OpaqueDataBlock>(    const MapBinder& b, OpaqueDataBlock& object,
+                                                                          const string& typ,const string& val);
+  template bool OpaqueDataBinder::insert_map<MapBinder,OpaqueDataBlock>(  const MapBinder& b, OpaqueDataBlock& object,
+                                                                          const string& key_type, const string& key,
+                                                                          const string& val_type, const string& val);
+  template bool OpaqueDataBinder::insert_map<MapBinder,OpaqueDataBlock>(  const MapBinder& b, OpaqueDataBlock& object,
+                                                                          const string& key_type, const string& val_type,
+                                                                          const string& pair_data);
 
+  /// Instantiation for Conditions:
+  template bool OpaqueDataBinder::bind_sequence<Conditions::Condition>(   Conditions::Condition& object,
+                                                                          const string& typ,const string& val);
   /// Conditions binding function for STL maps
   template <> bool OpaqueDataBinder::bind_map(const MapBinder& b, Conditions::Condition& object,
                                               const string& key_type, const string& val_type)
@@ -384,10 +403,5 @@ namespace DD4hep {
   /// Conditions: Filling function for STL maps.
   template <> bool OpaqueDataBinder::insert_map(const MapBinder& b, Conditions::Condition& object,
                                                 const string& key_type, const string& val_type, const string& pair_data)
-  {    return insert_map(b, object->data, key_type, val_type, pair_data);   }
-
-  /// Instantiation for Conditions:
-  template bool
-  OpaqueDataBinder::bind_sequence<Conditions::Condition>(Conditions::Condition& object,const string& typ,const string& val);
-  
+  {    return insert_map(b, object->data, key_type, val_type, pair_data);   }  
 }
diff --git a/DDDB/src/DDDBPlugins.cpp b/DDDB/src/DDDBPlugins.cpp
index 785559e03..29ac0eb39 100644
--- a/DDDB/src/DDDBPlugins.cpp
+++ b/DDDB/src/DDDBPlugins.cpp
@@ -55,7 +55,6 @@ namespace {
    */
   long dddb_map_condition_keys2detelements(LCDD& lcdd, int /* argc */, char** /* argv */) {
 
-    typedef DDDB::Named::StringMap StringMap;
     using DDDB::Catalog;
     using Geometry::DetElement;
 
@@ -80,16 +79,16 @@ namespace {
             conditions->addKey(cat->condition);
             conditions->addKey("Alignment", cat->condition);
           }
-          for(StringMap::const_iterator i=cat->conditioninfo.begin(); i!=cat->conditioninfo.end(); ++i)  {
-            const string& cond_name = (*i).second;
+          for(const auto& i : cat->conditioninfo )  {
+            const string& cond_name = i.second;
             conditions->addKey(cond_name);
-            conditions->addKey((*i).first, cond_name);
+            conditions->addKey(i.first, cond_name);
           }
         }
         catch(...)   {
         }
-        for (DetElement::Children::const_iterator i=c.begin(); i != c.end(); ++i)
-          (*this)((*i).second);
+        for (const auto& i : c )
+          (*this)(i.second);
         return 1;
       }
     };
@@ -134,10 +133,8 @@ namespace {
      *  @date    01/04/2014
      */
     struct Actor {
-      /// Defintion of the container with all known conditions
-      typedef vector<pair<int,Condition> > _RC;
       /// Container with all known conditions
-      _RC             m_allConditions;
+      vector<pair<int,Condition> >  m_allConditions;
       Counters        m_counters;
       bool            m_sensitivesOnly;
       bool            m_dumpConditions;
@@ -160,16 +157,16 @@ namespace {
         }
 #if 0
         printout(INFO,m_name,"**************** DDDB Detector dump: Conditions Usage ***************************");
-        for(_RC::const_iterator ic=m_allConditions.begin(); ic!=m_allConditions.end(); ++ic)   {
-          Condition cond = (*ic).second;
+        for(const auto& ic : m_allConditions )  {
+          Condition cond = ic.second;
           const AbstractMap& data = cond.get<AbstractMap>();
           const DDDB::Document* doc = data.option<DDDB::Document>();
           if ( doc ) 
             printout(INFO,m_name,"++ Usage: %d Cond: %s/%s  -> %s [%08X]",
-                     (*ic).first, doc->name.c_str(), cond->name.c_str(), cond->value.c_str(), cond->hash);
+                     ic.first, doc->name.c_str(), cond->name.c_str(), cond->value.c_str(), cond->hash);
           else
             printout(INFO,m_name,"++ Usage: %d Cond: ---/%s  -> %s [%08X]",
-                     (*ic).first, cond->name.c_str(), cond->value.c_str(), cond->hash);
+                     ic.first, cond->name.c_str(), cond->value.c_str(), cond->hash);
         }
 #endif
         printout(INFO,m_name,"*********************************************************************************");
@@ -185,8 +182,7 @@ namespace {
           Conditions::Operators::collectAllConditions(m_lcdd, rc);
           m_iov.reset().invert();
           m_iov.iovType = 0;
-          for(RangeConditions::const_iterator ic=rc.begin(); ic!=rc.end(); ++ic)  {
-            Condition cond = *ic;
+          for ( Condition cond : rc )   {
             m_allConditions.push_back(make_pair(0,cond));
             if ( !m_iov.iovType ) m_iov = cond.iov();
             else  m_iov.iov_intersection(cond.iov());
@@ -195,8 +191,7 @@ namespace {
           if ( m_dumpConditions )   {
             DDDB::ConditionPrinter prt;
             printout(INFO,m_name,"**************** DDDB Detector dump: ALL Conditions *****************************");
-            for(RangeConditions::const_iterator ic=rc.begin(); ic!=rc.end(); ++ic)
-              prt(*ic);
+            for(Condition cond : rc ) prt(cond);
             printout(INFO,m_name,"*********************************************************************************");
           }
         }
@@ -207,18 +202,18 @@ namespace {
       RangeConditions findCond(const string& match)   {
         RangeConditions result;
         if ( !match.empty() )  {
-          for(_RC::iterator ic=m_allConditions.begin(); ic!=m_allConditions.end(); ++ic)  {
-            Condition cond = (*ic).second;
+          for ( auto& ic : m_allConditions )  {
+            Condition cond = ic.second;
             size_t idx = cond->value.find(match);
             if ( idx == 0 )  {
               if (cond->value.length() == match.length() )   {
-                (*ic).first++;
+                ic.first++;
                 result.push_back(cond);
               }
               else if ( cond->value[match.length()] == '/' )  {
                 size_t idq = cond->value.find('/',match.length()+1);
                 if ( idq == string::npos )  {
-                  (*ic).first++;
+                  ic.first++;
                   result.push_back(cond);
                 }
               }
@@ -234,7 +229,6 @@ namespace {
                            bool with_keys=false,
                            bool with_values=false)
       {
-        typedef Conditions::Container::Object::Keys _K;
         char fmt[128];
         const DetElement::Children& c = de.children();
         ::sprintf(fmt,"%03d %%-%ds Detector: %%s #Dau:%%d VolID:%%p Place:%%p",level+1,2*level+1);
@@ -247,14 +241,13 @@ namespace {
         if ( (with_keys || with_values) && de.hasConditions() )  {
           Conditions::DetConditions dc(de);
           Conditions::Container cont = dc.conditions();
-          const _K& keys = cont->keys;
           ::sprintf(fmt,"%03d %%-%ds Key: %%08X -> %%08X -> %%s",level+1,2*level+3);
-          for(_K::const_iterator i=keys.begin(); i!=keys.end(); ++i)  {
+          for(const auto& i : cont->keys )  {
             if ( with_keys )   {
-              printout(INFO,m_name,fmt,"",(*i).first,(*i).second.first, (*i).second.second.c_str());
+              printout(INFO,m_name,fmt,"",i.first,i.second.first, i.second.second.c_str());
             }
             if ( with_values )   {
-              Condition::key_type key = (*i).second.first;
+              Condition::key_type key = i.second.first;
               Condition cond = dc.get(key, m_iov);
               prt(cond);
             }
@@ -266,18 +259,17 @@ namespace {
         if ( cat && !cat->conditioninfo.empty() )   {
           char fmt[128];
           ::sprintf(fmt,"%03d %%-%ds Cond:%%-20s -> %%s",level+1,2*level+3);
-          for(DDDB::Named::StringMap::const_iterator i=cat->conditioninfo.begin(); i!=cat->conditioninfo.end(); ++i)  {
-            const string& cond_name = (*i).second;
+          for(const auto& i : cat->conditioninfo )  {
+            const string& cond_name = i.second;
             ++m_counters.numConditions;
             if ( with_elements )  {
               RangeConditions rc = findCond(cond_name);
-              printout(INFO,m_name,fmt,"",(*i).first.c_str(), 
+              printout(INFO,m_name,fmt,"",i.first.c_str(), 
                        rc.empty() ? (cond_name+"  !!!UNRESOLVED!!!").c_str() : cond_name.c_str());
-              for(RangeConditions::const_iterator ic=rc.begin(); ic!=rc.end(); ++ic)
-                prt(*ic);
+              for(Condition cond : rc ) prt(cond);
               continue;
             }
-            printout(INFO,m_name,fmt,"",(*i).first.c_str(),cond_name.c_str());
+            printout(INFO,m_name,fmt,"",i.first.c_str(),cond_name.c_str());
           }
         }
       }
@@ -291,8 +283,8 @@ namespace {
             RangeConditions rc = findCond(cat->condition);
             printout(INFO,m_name,fmt,"","Alignment:", 
                      rc.empty() ? (cat->condition+"  !!!UNRESOLVED!!!").c_str() : cat->condition.c_str());
-            for(RangeConditions::const_iterator ic=rc.begin(); ic!=rc.end(); ++ic)
-              prt(*ic);
+            for(const auto& i : rc)
+              prt(i);
             return;
           }
           printout(INFO,m_name,fmt,"","Alignment:",cat->condition.c_str());
@@ -349,8 +341,8 @@ namespace {
           printout(INFO,m_name, fmt, "", de.path().c_str(), "NO CATALOG availible!", "");
           ++m_counters.numNoCatalogs;
         }
-        for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i)
-          dump((*i).second,level+1);
+        for (const auto& i : c)
+          dump(i.second,level+1);
         return 1;
       }
     };
diff --git a/DDTest/include/DD4hep/DDTest.h b/DDTest/include/DD4hep/DDTest.h
index 236ad1d87..bff921f0e 100644
--- a/DDTest/include/DD4hep/DDTest.h
+++ b/DDTest/include/DD4hep/DDTest.h
@@ -17,10 +17,16 @@ namespace DD4hep{
    */
   class DDTest{
 
-    DDTest() :  _out(std::cout) {}
-
   public:
+    /// Default constructor
+    DDTest() = delete;
+
+    /// Copy constructor
+    DDTest(const DDTest& copy) = delete;
 
+    /// Assignment operator
+    DDTest& operator=(const DDTest& copy) = delete;
+    
 
     /** Only constructor
      */
@@ -69,17 +75,17 @@ namespace DD4hep{
     
       if ( ! (v1 == v2)  ) {
       
-	std::stringstream sstr ;
-	sstr << "  " << name<< " : [" << v1 << "] != [" << v2 <<"]" ;
+        std::stringstream sstr ;
+        sstr << "  " << name<< " : [" << v1 << "] != [" << v2 <<"]" ;
 
-	error( sstr.str() ) ;
+        error( sstr.str() ) ;
 
       } else {
 
-	std::stringstream sstr ;
-	sstr << "  " << name<< " : [" << v1 << "] == [" << v2 <<"]" ;
+        std::stringstream sstr ;
+        sstr << "  " << name<< " : [" << v1 << "] == [" << v2 <<"]" ;
 
-	pass( sstr.str() ) ;
+        pass( sstr.str() ) ;
       }
 
       return ;
@@ -92,17 +98,17 @@ namespace DD4hep{
     
       if ( ! (c)  ) {
       
-	std::stringstream sstr ;
-	sstr << "  " << name<< " : [" << c << "] " ;
+        std::stringstream sstr ;
+        sstr << "  " << name<< " : [" << c << "] " ;
       
-	error( sstr.str() ) ;
+        error( sstr.str() ) ;
       
       } else {      
 
-	std::stringstream sstr ;
-	sstr << "  " << name<< " : [" << c  << "] " ;
+        std::stringstream sstr ;
+        sstr << "  " << name<< " : [" << c  << "] " ;
 
-	pass( sstr.str() ) ;
+        pass( sstr.str() ) ;
       }
       return ;
     }
@@ -144,8 +150,6 @@ namespace DD4hep{
       //std::cerr << errmsg.str();
     }
 
-
-
     /** Fatal error ...*/
     void fatal_error( const std::string& msg ){
       error( msg );
@@ -153,23 +157,19 @@ namespace DD4hep{
       exit(1);
     }
 
-
-
     /** Return the status from the last test - either PASSED or FAILED */
     const char* last_test_status(){
       return ( _last_test_status ? "PASSED" : "FAILED" ) ;
     }
 
-
-
   private:
 
     std::string _testname ;
-    std::ostream& _out ;
+    std::ostream& _out = std::cout;
 
-    unsigned int _failed ;      // number of failed tests
-    unsigned int _passed ;      // number of passed tests
-    bool _last_test_status ;    // true if last test succeeded, false otherwise
+    unsigned int _failed = 0;          // number of failed tests
+    unsigned int _passed = 0;          // number of passed tests
+    bool _last_test_status = false;    // true if last test succeeded, false otherwise
   };
 
 
diff --git a/DDTest/src/STR.h b/DDTest/src/STR.h
index 8c93e829b..60abf168b 100644
--- a/DDTest/src/STR.h
+++ b/DDTest/src/STR.h
@@ -40,6 +40,7 @@ namespace  {
   public:
     STR ( float val ) : _val(val), _str(_to_string(val))  {   }
     std::string str() const { return _str ; }
+    float value() const     { return _val;  }
     bool operator==( const STR& s2) const {
       return this->str() == s2.str() ;
     }
diff --git a/DDTest/src/test_DetType.cc b/DDTest/src/test_DetType.cc
index 61e10be35..cb6bbeea2 100644
--- a/DDTest/src/test_DetType.cc
+++ b/DDTest/src/test_DetType.cc
@@ -11,7 +11,7 @@ using namespace std ;
 using namespace DD4hep ;
 
 // this should be the first line in your test
-DDTest test = DDTest( "bitfield64" ) ; 
+static DDTest test( "bitfield64" ) ; 
 
 //=============================================================================
 
diff --git a/DDTest/src/test_EventReaders.cc b/DDTest/src/test_EventReaders.cc
index a7bef79eb..c8a43f8fd 100644
--- a/DDTest/src/test_EventReaders.cc
+++ b/DDTest/src/test_EventReaders.cc
@@ -16,7 +16,7 @@
 typedef DD4hep::Simulation::Geant4Vertex   Vertex;
 typedef DD4hep::Simulation::Geant4Particle Particle;
 
-DD4hep::DDTest test = DD4hep::DDTest( "EventReader" ) ;
+static DD4hep::DDTest test( "EventReader" ) ;
 
 class TestTuple {
 public:
diff --git a/DDTest/src/test_PolarGridRPhi2.cc b/DDTest/src/test_PolarGridRPhi2.cc
index dbf77a5d0..3a3951b7b 100644
--- a/DDTest/src/test_PolarGridRPhi2.cc
+++ b/DDTest/src/test_PolarGridRPhi2.cc
@@ -8,7 +8,7 @@
 #include <exception>
 
 
-DD4hep::DDTest test = DD4hep::DDTest( "PolarGridRPhi2" ) ;
+static DD4hep::DDTest test( "PolarGridRPhi2" ) ;
 
 class TestTuple {
 public:
diff --git a/DDTest/src/test_bitfield64.cc b/DDTest/src/test_bitfield64.cc
index e65b84b9d..ab4f82b2a 100644
--- a/DDTest/src/test_bitfield64.cc
+++ b/DDTest/src/test_bitfield64.cc
@@ -12,7 +12,7 @@ using namespace DD4hep ;
 using namespace DDSegmentation ;
 
 // this should be the first line in your test
-DDTest test = DDTest( "bitfield64" ) ; 
+static DDTest test( "bitfield64" ) ; 
 
 //=============================================================================
 
diff --git a/DDTest/src/test_cellDimensions.cc b/DDTest/src/test_cellDimensions.cc
index 5d4412d40..a55b98aea 100644
--- a/DDTest/src/test_cellDimensions.cc
+++ b/DDTest/src/test_cellDimensions.cc
@@ -13,7 +13,7 @@
 #include <cmath>
 
 
-DD4hep::DDTest test = DD4hep::DDTest( "CellDimensions" ) ;
+static DD4hep::DDTest test( "CellDimensions" ) ;
 
 
 int main() {
diff --git a/DDTest/src/test_cellDimensionsRPhi2.cc b/DDTest/src/test_cellDimensionsRPhi2.cc
index 8ad906bfb..cb50c2a2a 100644
--- a/DDTest/src/test_cellDimensionsRPhi2.cc
+++ b/DDTest/src/test_cellDimensionsRPhi2.cc
@@ -10,7 +10,7 @@
 #include <exception>
 #include <cmath>
 
-DD4hep::DDTest test = DD4hep::DDTest( "CellDimensions" ) ;
+static DD4hep::DDTest test( "CellDimensions" ) ;
 
 using DD4hep::DDSegmentation::Segmentation;
 using DD4hep::DDSegmentation::CellID;
diff --git a/DDTest/src/test_example.cc b/DDTest/src/test_example.cc
index f21046004..bc9910445 100644
--- a/DDTest/src/test_example.cc
+++ b/DDTest/src/test_example.cc
@@ -8,7 +8,7 @@ using namespace std ;
 using namespace DD4hep ;
 
 // this should be the first line in your test
-DDTest test = DDTest( "example" ) ; 
+static DDTest test( "example" ) ; 
 
 //=============================================================================
 
diff --git a/DDTest/src/test_segmentationHandles.cc b/DDTest/src/test_segmentationHandles.cc
index a281589a7..b1d7a2c50 100644
--- a/DDTest/src/test_segmentationHandles.cc
+++ b/DDTest/src/test_segmentationHandles.cc
@@ -13,7 +13,7 @@
 #include <cmath>
 
 
-DD4hep::DDTest test = DD4hep::DDTest( "CellDimensions" ) ;
+static DD4hep::DDTest test( "CellDimensions" ) ;
 using namespace DD4hep;
 using namespace DD4hep::Geometry;
 
diff --git a/DDTest/src/test_surface.cc b/DDTest/src/test_surface.cc
index bbd645e41..4b02c2285 100644
--- a/DDTest/src/test_surface.cc
+++ b/DDTest/src/test_surface.cc
@@ -21,7 +21,7 @@ using namespace DDSurfaces ;
 
 
 // this should be the first line in your test
-DDTest test = DDTest( "surface" ) ; 
+static DDTest test( "surface" ) ; 
 //=============================================================================
 
 int main(int argc, char** argv ){
diff --git a/DDTest/src/test_units.cc b/DDTest/src/test_units.cc
index a3b81bfc1..9af5e4663 100644
--- a/DDTest/src/test_units.cc
+++ b/DDTest/src/test_units.cc
@@ -15,7 +15,7 @@ using namespace Geometry;
 using namespace dd4hep ;
 
 // this should be the first line in your test
-DDTest test = DDTest( "units" ) ; 
+static DDTest test( "units" ) ; 
 
 //=============================================================================
 //=============================================================================
diff --git a/UtilityApps/src/EvNavHandler.h b/UtilityApps/src/EvNavHandler.h
index e348e5384..b54b38291 100644
--- a/UtilityApps/src/EvNavHandler.h
+++ b/UtilityApps/src/EvNavHandler.h
@@ -1,4 +1,3 @@
-// $Id: $
 //==========================================================================
 //  AIDA Detector description implementation for LCD
 //--------------------------------------------------------------------------
diff --git a/UtilityApps/src/LinkDef.h b/UtilityApps/src/LinkDef.h
index c843552a7..1b4825845 100644
--- a/UtilityApps/src/LinkDef.h
+++ b/UtilityApps/src/LinkDef.h
@@ -1,4 +1,3 @@
-// $Id: $
 //==========================================================================
 //  AIDA Detector description implementation for LCD
 //--------------------------------------------------------------------------
diff --git a/UtilityApps/src/MultiView.h b/UtilityApps/src/MultiView.h
index 8dc797888..2ea61d13c 100644
--- a/UtilityApps/src/MultiView.h
+++ b/UtilityApps/src/MultiView.h
@@ -1,4 +1,3 @@
-// $Id: $
 //==========================================================================
 //  AIDA Detector description implementation for LCD
 //--------------------------------------------------------------------------
diff --git a/UtilityApps/src/converter.cpp b/UtilityApps/src/converter.cpp
index 52b858700..649a15f5d 100644
--- a/UtilityApps/src/converter.cpp
+++ b/UtilityApps/src/converter.cpp
@@ -1,4 +1,3 @@
-// $Id$
 //==========================================================================
 //  AIDA Detector description implementation for LCD
 //--------------------------------------------------------------------------
diff --git a/UtilityApps/src/display.cpp b/UtilityApps/src/display.cpp
index 9fe8dff95..834688e9b 100644
--- a/UtilityApps/src/display.cpp
+++ b/UtilityApps/src/display.cpp
@@ -1,4 +1,3 @@
-// $Id$
 //==========================================================================
 //  AIDA Detector description implementation for LCD
 //--------------------------------------------------------------------------
diff --git a/UtilityApps/src/dumpdetector.cpp b/UtilityApps/src/dumpdetector.cpp
index 621a9b3ec..de5e1785b 100644
--- a/UtilityApps/src/dumpdetector.cpp
+++ b/UtilityApps/src/dumpdetector.cpp
@@ -1,4 +1,3 @@
-// $Id: $
 //==========================================================================
 //  AIDA Detector description implementation for LCD
 //--------------------------------------------------------------------------
diff --git a/UtilityApps/src/materialScan.cpp b/UtilityApps/src/materialScan.cpp
index db7841085..9a33bbd3a 100644
--- a/UtilityApps/src/materialScan.cpp
+++ b/UtilityApps/src/materialScan.cpp
@@ -1,4 +1,3 @@
-// $Id: $
 //==========================================================================
 //  AIDA Detector description implementation for LCD
 //--------------------------------------------------------------------------
diff --git a/UtilityApps/src/next_event_dummy.cpp b/UtilityApps/src/next_event_dummy.cpp
index c8f8fd09b..4d6e839e3 100644
--- a/UtilityApps/src/next_event_dummy.cpp
+++ b/UtilityApps/src/next_event_dummy.cpp
@@ -1,4 +1,3 @@
-// $Id: $
 //==========================================================================
 //  AIDA Detector description implementation for LCD
 //--------------------------------------------------------------------------
diff --git a/UtilityApps/src/next_event_lcio.cpp b/UtilityApps/src/next_event_lcio.cpp
index 27413628d..dc6cd77a7 100644
--- a/UtilityApps/src/next_event_lcio.cpp
+++ b/UtilityApps/src/next_event_lcio.cpp
@@ -1,4 +1,3 @@
-// $Id: $
 //==========================================================================
 //  AIDA Detector description implementation for LCD
 //--------------------------------------------------------------------------
diff --git a/UtilityApps/src/plugin_runner.cpp b/UtilityApps/src/plugin_runner.cpp
index 447f92a7d..d94e03923 100644
--- a/UtilityApps/src/plugin_runner.cpp
+++ b/UtilityApps/src/plugin_runner.cpp
@@ -1,4 +1,3 @@
-// $Id$
 //==========================================================================
 //  AIDA Detector description implementation for LCD
 //--------------------------------------------------------------------------
diff --git a/UtilityApps/src/print_materials.cpp b/UtilityApps/src/print_materials.cpp
index 9a424ad65..f60764a92 100644
--- a/UtilityApps/src/print_materials.cpp
+++ b/UtilityApps/src/print_materials.cpp
@@ -1,4 +1,3 @@
-// $Id: $
 //==========================================================================
 //  AIDA Detector description implementation for LCD
 //--------------------------------------------------------------------------
diff --git a/UtilityApps/src/test_surfaces.cpp b/UtilityApps/src/test_surfaces.cpp
index 2db3a5efb..59e3c6afd 100644
--- a/UtilityApps/src/test_surfaces.cpp
+++ b/UtilityApps/src/test_surfaces.cpp
@@ -1,4 +1,3 @@
-// $Id: $
 //==========================================================================
 //  AIDA Detector description implementation for LCD
 //--------------------------------------------------------------------------
@@ -40,7 +39,7 @@ using namespace DDSurfaces ;
 using namespace lcio;
 
 
-DDTest test = DDTest( "surfaces" ) ; 
+static DDTest test( "surfaces" ) ; 
 
 //=============================================================================
 
diff --git a/UtilityApps/src/teve_display.cpp b/UtilityApps/src/teve_display.cpp
index deb32b983..b0c991ad9 100644
--- a/UtilityApps/src/teve_display.cpp
+++ b/UtilityApps/src/teve_display.cpp
@@ -1,4 +1,3 @@
-// $Id: $
 //==========================================================================
 //  AIDA Detector description implementation for LCD
 //--------------------------------------------------------------------------
diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake
index 551d143a4..ff006d03c 100644
--- a/cmake/DD4hepBuild.cmake
+++ b/cmake/DD4hepBuild.cmake
@@ -56,6 +56,16 @@ macro(dd4hep_set_compiler_flags)
 
  if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND APPLE)
    set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup")
+#   All this simply does not work!
+#   if ( APPLE )
+#     set(CMAKE_SKIP_BUILD_RPATH            FALSE)
+#     set(CMAKE_BUILD_WITH_INSTALL_RPATH    FALSE)
+#     set(CMAKE_INSTALL_RPATH               "${CMAKE_BINARY_DIR}/lib")
+#     set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+#     set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath ${CMAKE_BINARY_DIR}/lib")
+#     message( STATUS "Apple settings: CMAKE_INSTALL_RPATH:       ${CMAKE_INSTALL_RPATH}" )
+#     message( STATUS "Apple settings: CMAKE_SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}" )
+#   endif()
  endif()
 endmacro(dd4hep_set_compiler_flags)
 
-- 
GitLab