From 619c42e4bffe9f46b1722114fbf4a3dceb730cfd Mon Sep 17 00:00:00 2001 From: Markus Frank <markus.frank@cern.ch> Date: Fri, 11 Dec 2015 07:56:42 +0000 Subject: [PATCH] Fix compiler warnings in nightlies --- DDCore/src/Evaluator/string.src | 9 +++++++-- DDRec/src/DetectorSurfaces.cpp | 8 +++----- DDTest/src/test_surface.cc | 2 +- DDTest/src/test_units.cc | 2 +- GaudiPluginService/src/PluginService.cpp | 10 +++++----- GaudiPluginService/src/capi_pluginservice.cpp | 4 ++-- UtilityApps/src/MultiView.h | 20 ++++++++++++++++++- .../SimpleDetector/src/ZPlanarTracker_geo.cpp | 14 ++++++------- 8 files changed, 44 insertions(+), 25 deletions(-) diff --git a/DDCore/src/Evaluator/string.src b/DDCore/src/Evaluator/string.src index a675a99b1..86da311c0 100644 --- a/DDCore/src/Evaluator/string.src +++ b/DDCore/src/Evaluator/string.src @@ -40,13 +40,18 @@ struct string { } // Copy constructor from string. - string(const string& x) { + string(const string& x) { x.p->n++; p = x.p; } // Destructor. - ~string() { if (--p->n == 0) { delete [] p->s; delete p; } } + ~string() { + if (--p->n == 0) { + delete [] p->s; + delete p; + } + } // Assignment from character string. string& operator=(const char* s) { diff --git a/DDRec/src/DetectorSurfaces.cpp b/DDRec/src/DetectorSurfaces.cpp index 1885133b7..1a59123be 100644 --- a/DDRec/src/DetectorSurfaces.cpp +++ b/DDRec/src/DetectorSurfaces.cpp @@ -23,12 +23,10 @@ namespace DD4hep { const VolSurfaceList* vsL = volSurfaceList(det) ; try { + _sL = det.extension< SurfaceList >() ; - _sL = det.extension< SurfaceList >() ; - - } catch( std::runtime_error e){ - - _sL = det.addExtension<SurfaceList >( new SurfaceList( true ) ) ; + } catch(const std::exception& e) { + _sL = det.addExtension<SurfaceList >( new SurfaceList( true ) ) ; } if( ! vsL->empty() && _sL->empty() ) { // only fill surfaces for this DetElement once diff --git a/DDTest/src/test_surface.cc b/DDTest/src/test_surface.cc index 78595a718..29f4a2c7a 100644 --- a/DDTest/src/test_surface.cc +++ b/DDTest/src/test_surface.cc @@ -31,7 +31,7 @@ class STR { float _val ; std::string _str ; public: - STR ( float val ) : _val( val ){ + STR ( float val ) : _val( val ), _str() { std::stringstream s1 ; s1 << _val ; _str = s1.str() ; diff --git a/DDTest/src/test_units.cc b/DDTest/src/test_units.cc index 5668310b7..d3cc02e54 100644 --- a/DDTest/src/test_units.cc +++ b/DDTest/src/test_units.cc @@ -24,7 +24,7 @@ class STR { float _val ; std::string _str ; public: - STR ( float val ) : _val( val ){ + STR ( float val ) : _val(val), _str() { std::stringstream s1 ; s1 << _val ; _str = s1.str() ; diff --git a/GaudiPluginService/src/PluginService.cpp b/GaudiPluginService/src/PluginService.cpp index 4f08f0ce9..4337611b7 100644 --- a/GaudiPluginService/src/PluginService.cpp +++ b/GaudiPluginService/src/PluginService.cpp @@ -66,7 +66,7 @@ namespace { /// Helper function used to set values in FactoryInfo data members only /// if the original value is empty and reporting warnings in case of /// inconsistencies. - inline void factoryInfoSetHelper(std::string& dest, const std::string value, + inline void factoryInfoSetHelper(std::string& dest, const std::string& value, const std::string& desc, const std::string& id) { if (dest.empty()) { @@ -340,11 +340,11 @@ namespace Gaudi { namespace PluginService { } void Logger::report(Level lvl, const std::string& msg) { - static const char* levels[] = {"DEBUG : ", - "INFO : ", - "WARNING: ", - "ERROR : "}; if (lvl >= level()) { + static const char* levels[] = {"DEBUG : ", + "INFO : ", + "WARNING: ", + "ERROR : "}; std::cerr << levels[lvl] << msg << std::endl; } } diff --git a/GaudiPluginService/src/capi_pluginservice.cpp b/GaudiPluginService/src/capi_pluginservice.cpp index 94b092285..1380fd283 100644 --- a/GaudiPluginService/src/capi_pluginservice.cpp +++ b/GaudiPluginService/src/capi_pluginservice.cpp @@ -32,7 +32,7 @@ cgaudi_pluginsvc_get_factory_at(cgaudi_pluginsvc_t self, int n) itr = reg->factories().begin(), iend= reg->factories().end(); itr != iend; - itr++) { + ++itr) { keys.push_back(itr->first); } const char *key = keys[n].c_str(); @@ -103,7 +103,7 @@ cgaudi_factory_get_property_at(cgaudi_factory_t self, int n) itr = fi.properties.begin(), iend = fi.properties.end(); itr != iend; - itr++, i++) { + ++itr, ++i) { if (i == n) { cprop.key = itr->first.c_str(); return cprop; diff --git a/UtilityApps/src/MultiView.h b/UtilityApps/src/MultiView.h index 3a6c9776c..8dc797888 100644 --- a/UtilityApps/src/MultiView.h +++ b/UtilityApps/src/MultiView.h @@ -39,7 +39,6 @@ */ class MultiView { - public: TEveProjectionManager *fRPhiMgr; @@ -197,6 +196,25 @@ public: { fRhoZEventScene->DestroyElements(); } + +private: + MultiView(const MultiView& /* x */) + : fRPhiMgr(0), fRhoZMgr(0), f3DView(0), fRPhiView(0), fRhoZView(0), + fRPhiGeomScene(0), fRhoZGeomScene(0), fRPhiEventScene(0), fRhoZEventScene(0) + { + } + MultiView& operator=(const MultiView& /* x */) { + fRPhiMgr = 0; + fRhoZMgr = 0; + f3DView = 0; + fRPhiView = 0; + fRhoZView = 0; + fRPhiGeomScene = 0; + fRhoZGeomScene = 0; + fRPhiEventScene = 0; + fRhoZEventScene = 0; + return *this; + } }; //===================================================================================== diff --git a/examples/SimpleDetector/src/ZPlanarTracker_geo.cpp b/examples/SimpleDetector/src/ZPlanarTracker_geo.cpp index ceb6ca19f..ef755b60a 100644 --- a/examples/SimpleDetector/src/ZPlanarTracker_geo.cpp +++ b/examples/SimpleDetector/src/ZPlanarTracker_geo.cpp @@ -185,20 +185,18 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { double radius = supp_distance ; double offset = supp_offset ; - pv = layer_assembly.placeVolume( supp_vol,Transform3D( rot, Position( ( radius + lthick/2. ) * cos(phi) - offset * sin( phi ) , - ( radius + lthick/2. ) * sin(phi) + offset * cos( phi ) , - 0. ) )); + /* pv = */layer_assembly.placeVolume(supp_vol,Transform3D(rot, Position((radius+lthick/2.)*cos(phi) - offset*sin(phi), + (radius+lthick/2.)*sin(phi) + offset*cos(phi), + 0. ) )); // --- place sensitive ----- lthick = sens_thickness ; radius = sens_distance ; offset = sens_offset ; - pv = layer_assembly.placeVolume( sens_vol,Transform3D( rot, Position( ( radius + lthick/2. ) * cos(phi) - offset * sin( phi ) , - ( radius + lthick/2. ) * sin(phi) + offset * cos( phi ) , - 0. ) )); - - + pv = layer_assembly.placeVolume( sens_vol,Transform3D(rot, Position((radius + lthick/2.0)*cos(phi) - offset*sin(phi), + (radius + lthick/2.0)*sin(phi) + offset*cos(phi), + 0. ) )); // pv.addPhysVolID("layer", layer_id ).addPhysVolID( "module" , j ).addPhysVolID("sensor", 0 ) ; pv.addPhysVolID( "module" , j ).addPhysVolID("sensor", 0 ) ; -- GitLab