From d5e9b7c6210b942c8a82ceec6de97bcadd121fee Mon Sep 17 00:00:00 2001 From: Markus Frank <markus.frank@cern.ch> Date: Thu, 25 Aug 2016 11:46:55 +0000 Subject: [PATCH] Fix compiler warnings --- DDDB/src/CondDB2DDDB.cpp | 22 ++++++++++++---------- DDG4/include/DDG4/IoStreams.h | 13 +++++++++++++ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/DDDB/src/CondDB2DDDB.cpp b/DDDB/src/CondDB2DDDB.cpp index 78d27ea75..ff9e138fa 100644 --- a/DDDB/src/CondDB2DDDB.cpp +++ b/DDDB/src/CondDB2DDDB.cpp @@ -38,7 +38,6 @@ namespace DD4hep { /// Keep all in here anonymous. Does not have to be visible outside. namespace { - static int preserv_level = 0; using Conditions::Condition; using Conditions::AbstractMap; @@ -109,27 +108,30 @@ namespace DD4hep { return *this; } }; + /// Helper class to preserve local processing environment /** \ingroup DD4HEP_DDDB */ class PreservedLocals : public Locals { public: Context* context; - PreservedLocals(Context* c) : Locals(c->locals), context(c) { #ifdef __DEBUG_LOCALS + void print(const char* opt, bool inc) const { + static int preserv_level = 0; + int level = inc ? preserv_level++ : --preserv_level; if ( xml_doc ) - printout(INFO,"Locals","PUSH[%d]: %s [%s]", preserv_level++, obj_path.c_str(), xml_doc->id.c_str()); + printout(INFO,"Locals","%s[%d]: %s [%s]", opt, level, obj_path.c_str(), xml_doc->id.c_str()); else - printout(INFO,"Locals","PUSH[%d]: %s ", preserv_level++, obj_path.c_str()); + printout(INFO,"Locals","%s[%d]: %s ", opt, level, obj_path.c_str()); + } +#else + inline void print(const char*, bool) const {} #endif + PreservedLocals(Context* c) : Locals(c->locals), context(c) { + print("PUSH", true); } ~PreservedLocals() { -#ifdef __DEBUG_LOCALS - if ( xml_doc ) - printout(INFO,"Locals","POP [%d]: %s [%s]", --preserv_level, obj_path.c_str(), xml_doc->id.c_str()); - else - printout(INFO,"Locals","POP [%d]: %s", --preserv_level, obj_path.c_str()); -#endif + print("POP ", false); context->locals = *this; } }; diff --git a/DDG4/include/DDG4/IoStreams.h b/DDG4/include/DDG4/IoStreams.h index 716dadee8..b221f75c9 100644 --- a/DDG4/include/DDG4/IoStreams.h +++ b/DDG4/include/DDG4/IoStreams.h @@ -17,14 +17,21 @@ // C/C++ include files #include <string> +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" // Code that causes warning goes here +#endif + // booost iostreams include files #include <boost/iostreams/categories.hpp> #include <boost/iostreams/detail/ios.hpp> #include <boost/iostreams/detail/path.hpp> #include <boost/iostreams/positioning.hpp> +// Forward declarations class TFile; +/// Namespace for the AIDA detector description toolkit namespace DD4hep { // Forward declarations @@ -227,4 +234,10 @@ namespace DD4hep { { open(detail_path(path), mode); } }; } // End namespace boost + + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif + #endif // DD4HEP_DD4HEP_IOSTREAMs_H -- GitLab