From 2e271b2e5ec43c49e1acd846caf8c5b3f74ff2d3 Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Thu, 24 Nov 2016 18:30:46 +0100 Subject: [PATCH] Remove compiler warnings on MACOSX --- DDCond/src/ConditionsTest.cpp | 2 +- DDCond/src/plugins/ConditionsPlugins.cpp | 128 +++++++++++------------ DDCore/src/AlignmentsPrinter.cpp | 3 +- DDCore/src/PluginCreators.cpp | 6 +- DDDB/include/DDDB/DDDBConditionPrinter.h | 9 +- DDDB/src/DDDB2Objects.cpp | 2 +- DDG4/include/DDG4/Geant4Action.h | 14 +-- DDG4/include/DDG4/Geant4PhysicsList.h | 19 ++-- DDG4/include/DDG4/Python/DDPython.h | 2 +- DDG4/src/Geant4OutputAction.cpp | 3 +- UtilityApps/src/teve_display.cpp | 6 +- 11 files changed, 97 insertions(+), 97 deletions(-) diff --git a/DDCond/src/ConditionsTest.cpp b/DDCond/src/ConditionsTest.cpp index eea73192f..97b0fed1f 100644 --- a/DDCond/src/ConditionsTest.cpp +++ b/DDCond/src/ConditionsTest.cpp @@ -39,7 +39,7 @@ namespace DD4hep { namespace Test { - template <typename T> void print_bound_condition(Condition c, const char* norm) {} + template <typename T> void print_bound_condition(Condition /* c */, const char* /* norm */) {} template<typename T> void __print_bound_val(Condition c, const char* norm) { diff --git a/DDCond/src/plugins/ConditionsPlugins.cpp b/DDCond/src/plugins/ConditionsPlugins.cpp index 3cd2376ca..c9b39f4bc 100644 --- a/DDCond/src/plugins/ConditionsPlugins.cpp +++ b/DDCond/src/plugins/ConditionsPlugins.cpp @@ -333,8 +333,7 @@ static long ddcond_synchronize_conditions(lcdd_t& lcdd, int argc, char** argv) { num_updated, c_evt); } else { - printout(INFO,"Conditions", - "+++ ConditionsUpdate: Updated %ld conditions... key[%s]: %ld", + printout(INFO,"Conditions","+++ ConditionsUpdate: Updated %ld conditions... key[%s]: %ld", num_updated, iov_type.c_str(), iov_key); } user_pool->print("User pool"); @@ -374,6 +373,63 @@ static long ddcond_clean_conditions(lcdd_t& lcdd, int argc, char** argv) { } DECLARE_APPLY(DD4hep_ConditionsClean,ddcond_clean_conditions) +// ====================================================================================== +/// Basic entry point to instantiate the basic DD4hep conditions/alignmants printer +/** + * Factory: DD4hepConditionsPrinter, DD4hepAlignmentsPrinter + * + * \author M.Frank + * \version 1.0 + * \date 17/11/2016 + */ +#include "DD4hep/PluginTester.h" +template <typename PRINTER> +static void* create_printer(Geometry::LCDD& lcdd, int argc,char** argv) { + typedef typename PRINTER::pool_type pool_t; + string prefix = "", name = ""; + int flags = 0, have_pool = 0, arg_error = false; + for(int i=0; i<argc && argv[i]; ++i) { + if ( 0 == ::strncmp("-prefix",argv[i],4) ) + prefix = argv[++i]; + else if ( 0 == ::strncmp("-name",argv[i],5) ) + name = argv[++i]; + else if ( 0 == ::strncmp("-flags",argv[i],5) ) + flags = ::atol(argv[++i]); + else if ( 0 == ::strncmp("-pool",argv[i],5) ) + have_pool = 1; + else + arg_error = true; + } + if ( arg_error ) { + /// Help printout describing the basic command line interface + cout << + "Usage: -plugin <name> -arg [-arg] \n" + " name: factory name DD4hep_ConditionsPrinter, DD4hep_AlignmentsPrinter\n\n" + " -prefix <string> Printout prefix for user customized output. \n" + " -flags <number> Printout processing flags. \n" + " -pool Attach conditions user pool from \n" + " PluginTester instance attached to LCDD. \n\n" + "\tArguments given: " << arguments(argc,argv) << endl << flush; + ::exit(EINVAL); + } + DetElement world = lcdd.world(); + printout(INFO,"Printer","World=%s [%p]",world.path().c_str(),world.ptr()); + PRINTER* p = (flags) ? new PRINTER(prefix,flags) : new PRINTER(prefix); + if ( have_pool != 0 ) { + PluginTester* test = lcdd.extension<PluginTester>(); + pool_t* pool = test->extension<pool_t>("ConditionsTestUserPool"); + if ( !name.empty() ) p->name = name; + p->setPool(pool); + } + return (void*)dynamic_cast<DetElement::Processor*>(p); +} +#include "DD4hep/ConditionsPrinter.h" +DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsPrinter,create_printer<Conditions::ConditionsPrinter>) +#include "DD4hep/AlignmentsPrinter.h" +DECLARE_LCDD_CONSTRUCTOR(DD4hep_AlignmentsPrinter,create_printer<Alignments::AlignmentsPrinter>) +#include "DD4hep/AlignedVolumePrinter.h" +DECLARE_LCDD_CONSTRUCTOR(DD4hep_AlignedVolumePrinter,create_printer<Alignments::AlignedVolumePrinter>) + // ====================================================================================== /// Plugin entry point: Create repository csv file from loaded conditions /** @@ -418,7 +474,7 @@ DECLARE_APPLY(DD4hep_ConditionsCreateRepository,ddcond_create_repository) * \version 1.0 * \date 01/04/2016 */ -static long ddcond_dump_repository(lcdd_t& lcdd, int argc, char** argv) { +static long ddcond_dump_repository(lcdd_t& /* lcdd */, int argc, char** argv) { typedef ConditionsRepository::Data Data; bool arg_error = false; string input = ""; @@ -438,9 +494,7 @@ static long ddcond_dump_repository(lcdd_t& lcdd, int argc, char** argv) { "\tArguments given: " << arguments(argc,argv) << endl << flush; ::exit(EINVAL); } - printout(INFO,"Conditions", - "+++ ConditionsRepository: Dumping %s",input.c_str()); - ConditionsManager manager = ConditionsManager::from(lcdd); + printout(INFO,"Conditions","+++ ConditionsRepository: Dumping %s",input.c_str()); if ( ConditionsRepository().load(input, data) ) { printout(INFO,"Repository","%-8s %-60s %-60s","Key","Name","Address"); for(Data::const_iterator i=data.begin(); i!=data.end(); ++i) { @@ -455,62 +509,6 @@ static long ddcond_dump_repository(lcdd_t& lcdd, int argc, char** argv) { } DECLARE_APPLY(DD4hep_ConditionsDumpRepository,ddcond_dump_repository) -/// Basic entry point to instantiate the basic DD4hep conditions/alignmants printer -/** - * Factory: DD4hepConditionsPrinter, DD4hepAlignmentsPrinter - * - * \author M.Frank - * \version 1.0 - * \date 17/11/2016 - */ -#include "DD4hep/PluginTester.h" -template <typename PRINTER> -static void* create_printer(Geometry::LCDD& lcdd, int argc,char** argv) { - typedef typename PRINTER::pool_type pool_t; - string prefix = "", name = ""; - int flags = 0, have_pool = 0, arg_error = false; - for(int i=0; i<argc && argv[i]; ++i) { - if ( 0 == ::strncmp("-prefix",argv[i],4) ) - prefix = argv[++i]; - else if ( 0 == ::strncmp("-name",argv[i],5) ) - name = argv[++i]; - else if ( 0 == ::strncmp("-flags",argv[i],5) ) - flags = ::atol(argv[++i]); - else if ( 0 == ::strncmp("-pool",argv[i],5) ) - have_pool = 1; - else - arg_error = true; - } - if ( arg_error ) { - /// Help printout describing the basic command line interface - cout << - "Usage: -plugin <name> -arg [-arg] \n" - " name: factory name DD4hep_ConditionsPrinter, DD4hep_AlignmentsPrinter\n\n" - " -prefix <string> Printout prefix for user customized output. \n" - " -flags <number> Printout processing flags. \n" - " -pool Attach conditions user pool from \n" - " PluginTester instance attached to LCDD. \n\n" - "\tArguments given: " << arguments(argc,argv) << endl << flush; - ::exit(EINVAL); - } - DetElement world = lcdd.world(); - printout(INFO,"Printer","World=%s [%p]",world.path().c_str(),world.ptr()); - PRINTER* p = (flags) ? new PRINTER(prefix,flags) : new PRINTER(prefix); - if ( have_pool != 0 ) { - PluginTester* test = lcdd.extension<PluginTester>(); - pool_t* pool = test->extension<pool_t>("ConditionsTestUserPool"); - if ( !name.empty() ) p->name = name; - p->setPool(pool); - } - return (void*)dynamic_cast<DetElement::Processor*>(p); -} -#include "DD4hep/ConditionsPrinter.h" -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsPrinter,create_printer<Conditions::ConditionsPrinter>) -#include "DD4hep/AlignmentsPrinter.h" -DECLARE_LCDD_CONSTRUCTOR(DD4hep_AlignmentsPrinter,create_printer<Alignments::AlignmentsPrinter>) -#include "DD4hep/AlignedVolumePrinter.h" -DECLARE_LCDD_CONSTRUCTOR(DD4hep_AlignedVolumePrinter,create_printer<Alignments::AlignedVolumePrinter>) - // ====================================================================================== /// Plugin entry point: Load conditions repository csv file into conditions manager /** @@ -523,12 +521,10 @@ TO BE DONE!!! * \version 1.0 * \date 01/04/2016 */ -static long ddcond_load_repository(lcdd_t& lcdd, int argc, char** argv) { +static long ddcond_load_repository(lcdd_t& /* lcdd */, int argc, char** argv) { if ( argc > 0 ) { string input = argv[0]; - printout(INFO,"Conditions", - "+++ ConditionsRepository: Loading %s",input.c_str()); - ConditionsManager manager = ConditionsManager::from(lcdd); + printout(INFO,"Conditions","+++ ConditionsRepository: Loading %s",input.c_str()); ConditionsRepository::Data data; ConditionsRepository().load(input, data); return 1; diff --git a/DDCore/src/AlignmentsPrinter.cpp b/DDCore/src/AlignmentsPrinter.cpp index 08413dbe2..1ea71fe06 100644 --- a/DDCore/src/AlignmentsPrinter.cpp +++ b/DDCore/src/AlignmentsPrinter.cpp @@ -53,6 +53,7 @@ int AlignmentsPrinter::processElement(DetElement de) { /// Default printout of an alignment entry void DD4hep::Alignments::printAlignment(const string& prefix, Alignment a) { if ( a.isValid() ) { + Alignment::Object* ptr = a.ptr(); const Alignment::Data& data = a.data(); Conditions::Condition cond = data.condition; const Delta& D = data.delta; @@ -60,7 +61,7 @@ void DD4hep::Alignments::printAlignment(const string& prefix, Alignment a) { new_prefix.assign(prefix.length(),' '); printout(INFO,prefix,"++ %s \tPath:%s [%p] Typ:%s", new_prefix.c_str(), cond.name(), a.ptr(), - typeName(typeid(*(a.ptr()))).c_str()); + typeName(typeid(*ptr)).c_str()); printout(INFO,prefix,"++ %s \tData:(%11s-%8s-%5s)", new_prefix.c_str(), D.hasTranslation() ? "Translation" : "", diff --git a/DDCore/src/PluginCreators.cpp b/DDCore/src/PluginCreators.cpp index 257976c14..1778a1529 100644 --- a/DDCore/src/PluginCreators.cpp +++ b/DDCore/src/PluginCreators.cpp @@ -52,7 +52,8 @@ namespace DD4hep { if ( cast ) { void* obj = cast(processor); if ( obj ) return obj; - invalidHandleAssignmentError(typeid(cast),typeid(*component(processor))); + ComponentCast* c = component(processor); + invalidHandleAssignmentError(typeid(cast),typeid(*c)); } } } @@ -77,7 +78,8 @@ namespace DD4hep { if ( cast ) { void* obj = cast(object); if ( obj ) return obj; - invalidHandleAssignmentError(typeid(cast),typeid(*component(object))); + ComponentCast* c = component(object); + invalidHandleAssignmentError(typeid(cast),typeid(*c)); } return object; } diff --git a/DDDB/include/DDDB/DDDBConditionPrinter.h b/DDDB/include/DDDB/DDDBConditionPrinter.h index 8652d216f..2041c8d40 100644 --- a/DDDB/include/DDDB/DDDBConditionPrinter.h +++ b/DDDB/include/DDDB/DDDBConditionPrinter.h @@ -54,11 +54,16 @@ namespace DD4hep { /// Printout prefix std::string& m_prefix; public: - + /// Default constructor + ParamPrinter() = default; + /// Copy constructor + ParamPrinter(const ParamPrinter& copy) = default; /// Initializing constructor ParamPrinter(std::string& prefix); /// Default destructor - virtual ~ParamPrinter() {} + virtual ~ParamPrinter() = default; + /// Assignment operator + ParamPrinter& operator=(const ParamPrinter& copy) = default; /// Set prefix for prinouts void setPrefix(const std::string& value) { m_prefix = value; } diff --git a/DDDB/src/DDDB2Objects.cpp b/DDDB/src/DDDB2Objects.cpp index beb03cf32..6ecedee41 100644 --- a/DDDB/src/DDDB2Objects.cpp +++ b/DDDB/src/DDDB2Objects.cpp @@ -181,7 +181,7 @@ namespace DD4hep { CNV(LCDD& l, void* p, void* o=0) : Converter<T,T*>(l,p,o) {} template<typename Q> CNV<Q> cnv() const { return CNV<Q>(this->lcdd,this->param,this->optional); } void* convert(T* obj) const; - template<typename Q> Q get(const string& obj) const { + template<typename Q> Q get(const string& /* obj */) const { throw runtime_error("NOT implemented virtual call !"); } void operator()(T* obj) const { convert(obj); } diff --git a/DDG4/include/DDG4/Geant4Action.h b/DDG4/include/DDG4/Geant4Action.h index ba6aacd1b..30b10cb2a 100644 --- a/DDG4/include/DDG4/Geant4Action.h +++ b/DDG4/include/DDG4/Geant4Action.h @@ -1,8 +1,3 @@ -#ifndef DD4HEP_DDG4_GEANT4ACTION_H -#define DD4HEP_DDG4_GEANT4ACTION_H - -// Framework include files -// $Id: $ //========================================================================== // AIDA Detector description implementation for LCD //-------------------------------------------------------------------------- @@ -15,6 +10,11 @@ // Author : M.Frank // //========================================================================== + +#ifndef DD4HEP_DDG4_GEANT4ACTION_H +#define DD4HEP_DDG4_GEANT4ACTION_H + +// Framework include files #include "DD4hep/Printout.h" #include "DD4hep/ComponentProperties.h" #include "DDG4/Geant4Context.h" @@ -65,12 +65,14 @@ namespace DD4hep { TypeName() = default; /// Copy constructor TypeName(const TypeName& copy) = default; - /// Copy constructor + /// Copy constructor from pair TypeName(const std::pair<std::string, std::string>& c) : std::pair<std::string, std::string>(c) { } /// Initializing constructor TypeName(const std::string& typ, const std::string& nam) : std::pair<std::string, std::string>(typ, nam) { } + /// Assignment operator + TypeName& operator=(const TypeName& copy) = default; /// Split string pair according to default delimiter ('/') static TypeName split(const std::string& type_name); /// Split string pair according to custom delimiter diff --git a/DDG4/include/DDG4/Geant4PhysicsList.h b/DDG4/include/DDG4/Geant4PhysicsList.h index 75c85a534..ad52cfc6d 100644 --- a/DDG4/include/DDG4/Geant4PhysicsList.h +++ b/DDG4/include/DDG4/Geant4PhysicsList.h @@ -1,4 +1,3 @@ -// $Id: $ //========================================================================== // AIDA Detector description implementation for LCD //-------------------------------------------------------------------------- @@ -70,13 +69,12 @@ namespace DD4hep { public: /// Default constructor ParticleConstructor() = default; + /// Default constructor + ParticleConstructor(const ParticleConstructor& copy) = default; /// Initalizing constructor ParticleConstructor(const std::string& s) : std::string(s) { } /// Assignment operator - ParticleConstructor& operator=(const ParticleConstructor& c) { - if ( &c != this ) this->std::string::operator=(c); - return *this; - } + ParticleConstructor& operator=(const ParticleConstructor& c) = default; }; typedef std::vector<ParticleConstructor> ParticleConstructors; @@ -89,19 +87,16 @@ namespace DD4hep { class PhysicsConstructor: public std::string { public: /// Pointer to physics constructor object - G4VPhysicsConstructor* pointer; + G4VPhysicsConstructor* pointer = 0; public: /// Default constructor - PhysicsConstructor() : std::string(), pointer(0) {} + PhysicsConstructor() = default; /// Copy constructor - PhysicsConstructor(const PhysicsConstructor& c) : std::string(c), pointer(c.pointer) {} + PhysicsConstructor(const PhysicsConstructor& c) = default; /// Initalizing constructor PhysicsConstructor(const std::string& s) : std::string(s), pointer(0) {} /// Assignment operator - PhysicsConstructor& operator=(const PhysicsConstructor& c) { - if ( &c != this ) { this->std::string::operator=(c); pointer=c.pointer; } - return *this; - } + PhysicsConstructor& operator=(const PhysicsConstructor& c) = default; }; typedef std::vector<PhysicsConstructor> PhysicsConstructors; diff --git a/DDG4/include/DDG4/Python/DDPython.h b/DDG4/include/DDG4/Python/DDPython.h index eb213c481..d3aa8449f 100644 --- a/DDG4/include/DDG4/Python/DDPython.h +++ b/DDG4/include/DDG4/Python/DDPython.h @@ -32,7 +32,7 @@ namespace DD4hep { * \ingroup DD4HEP_SIMULATION */ class DDPython { - private: + protected: void* context; /// Standard constructor DDPython( ); diff --git a/DDG4/src/Geant4OutputAction.cpp b/DDG4/src/Geant4OutputAction.cpp index ea64cfdf2..babb91f26 100644 --- a/DDG4/src/Geant4OutputAction.cpp +++ b/DDG4/src/Geant4OutputAction.cpp @@ -1,4 +1,3 @@ -// $Id: $ //========================================================================== // AIDA Detector description implementation for LCD //-------------------------------------------------------------------------- @@ -35,7 +34,7 @@ Geant4OutputAction::Geant4OutputAction(Geant4Context* ctxt, const string& nam) declareProperty("Output", m_output); declareProperty("HandleErrorsAsFatal", m_errorFatal=true); // Need to instantiate run action to configure fibers - if ( 0 == &ctxt->runAction() ) {} + ctxt->runAction(); } /// Default destructor diff --git a/UtilityApps/src/teve_display.cpp b/UtilityApps/src/teve_display.cpp index d754b9368..deb32b983 100644 --- a/UtilityApps/src/teve_display.cpp +++ b/UtilityApps/src/teve_display.cpp @@ -187,12 +187,12 @@ TEveStraightLineSet* getSurfaceVectors(bool addO, bool addU, bool addV, bool add DDSurfaces::Vector3D ov = o + v ; DDSurfaces::Vector3D on = o + n ; - if (addU) ls->AddLine( o.x(), o.y(), o.z(), ou.x() , ou.y() , ou.z() )->fId ; + if (addU) ls->AddLine( o.x(), o.y(), o.z(), ou.x() , ou.y() , ou.z() ); // TEveStraightLineSet::Marker_t *m = ls->AddMarker(id,1.); - if (addV) ls->AddLine( o.x(), o.y(), o.z(), ov.x() , ov.y() , ov.z() )->fId ; - if (addN) ls->AddLine( o.x(), o.y(), o.z(), on.x() , on.y() , on.z() )->fId ; + if (addV) ls->AddLine( o.x(), o.y(), o.z(), ov.x() , ov.y() , ov.z() ); + if (addN) ls->AddLine( o.x(), o.y(), o.z(), on.x() , on.y() , on.z() ); if (addO) ls->AddMarker( o.x(), o.y(), o.z() ); } ls->SetLineColor( color ) ; -- GitLab