From a23a368bf5e3622f9a0cb9a77e7efb53021d5bdd Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Thu, 3 Sep 2020 16:45:50 +0200
Subject: [PATCH] Remove shadow warnings

---
 DDCore/src/Conditions.cpp | 15 ++++++---------
 cmake/DD4hepBuild.cmake   |  2 +-
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/DDCore/src/Conditions.cpp b/DDCore/src/Conditions.cpp
index 47c3fac83..b239dee6b 100644
--- a/DDCore/src/Conditions.cpp
+++ b/DDCore/src/Conditions.cpp
@@ -174,14 +174,14 @@ bool Condition::testFlag(mask_type option) const {
 
 /// Access to the grammar type
 const dd4hep::BasicGrammar& Condition::descriptor() const   {
-  const BasicGrammar* g = access()->data.grammar;
-  if ( !g ) {
+  const BasicGrammar* grammar = access()->data.grammar;
+  if ( !grammar ) {
     invalidHandleError<Condition>();
     // This code is never reached, since function above throws exception!
     // Needed to satisfay CppCheck
     throw runtime_error("Null pointer in Grammar object");
   }
-  return *g;
+  return *grammar;
 }
 
 /// Default destructor. 
@@ -190,20 +190,17 @@ ConditionsSelect::~ConditionsSelect()   {
 
 /// Constructor from string
 ConditionKey::KeyMaker::KeyMaker(DetElement detector, const std::string& value)   {
-  KeyMaker m(detector.key(), detail::hash32(value));
-  hash = m.hash;
+  hash = KeyMaker(detector.key(), detail::hash32(value)).hash;
 }
 
 /// Constructor from detector element and item sub-key
 ConditionKey::KeyMaker::KeyMaker(DetElement detector, Condition::itemkey_type item_key)  {
-  KeyMaker m(detector.key(), item_key);
-  hash = m.hash;
+  hash = KeyMaker(detector.key(), item_key).hash;
 }
 
 /// Constructor from string
 ConditionKey::KeyMaker::KeyMaker(Condition::detkey_type det, const std::string& value)   {
-  KeyMaker m(det, detail::hash32(value));
-  hash = m.hash;
+  hash = KeyMaker(det, detail::hash32(value)).hash;
 }
 
 /// Constructor from string
diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake
index fe2dd966f..eff65340f 100644
--- a/cmake/DD4hepBuild.cmake
+++ b/cmake/DD4hepBuild.cmake
@@ -36,7 +36,7 @@ endmacro(dd4hep_to_parent_scope)
 macro(dd4hep_set_compiler_flags)
   include(CheckCXXCompilerFlag)
 
-  SET(COMPILER_FLAGS -Wall -Wextra -pedantic -Wshadow -Wformat-security -Wno-long-long -Wdeprecated -Wshadow -fdiagnostics-color=auto)
+  SET(COMPILER_FLAGS -Wshadow -Wformat-security -Wno-long-long -Wdeprecated -fdiagnostics-color=auto -Wall -Wextra -pedantic)
 
   # AppleClang/Clang specific warning flags
   if(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
-- 
GitLab