Skip to content

Commit

Permalink
Remove shadow warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusFrankATcernch committed Sep 3, 2020
1 parent c002dd1 commit 20349c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
15 changes: 6 additions & 9 deletions DDCore/src/Conditions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmake/DD4hepBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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$")
Expand Down

0 comments on commit 20349c8

Please sign in to comment.