Improved fix for Cppcheck warning. Remove useless conditions instead of adding a new one.
This commit is contained in:
parent
605fb9039a
commit
7142edf03e
|
@ -366,13 +366,13 @@ void ExecutionPath::checkScope(const Token *tok, std::list<ExecutionPath *> &che
|
|||
}
|
||||
|
||||
// ; { ... }
|
||||
if (tok && Token::Match(tok->previous(), "[;{}:] {")) {
|
||||
if (Token::Match(tok->previous(), "[;{}:] {")) {
|
||||
ExecutionPath::checkScope(tok->next(), checks);
|
||||
tok = tok->link();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tok && tok->str() == "if" && tok->next() && tok->next()->str() == "(") {
|
||||
if (tok->str() == "if" && tok->next() && tok->next()->str() == "(") {
|
||||
// what variable ids should the numberOfIf be counted for?
|
||||
std::set<unsigned int> countif;
|
||||
|
||||
|
@ -449,15 +449,9 @@ void ExecutionPath::checkScope(const Token *tok, std::list<ExecutionPath *> &che
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (tok) {
|
||||
tok = check->parse(*tok, checks);
|
||||
if (checks.empty())
|
||||
return;
|
||||
}
|
||||
|
||||
if (!tok)
|
||||
break;
|
||||
tok = check->parse(*tok, checks);
|
||||
if (!tok || checks.empty())
|
||||
return;
|
||||
|
||||
// return/throw ends all execution paths
|
||||
if (tok->str() == "return" ||
|
||||
|
|
Loading…
Reference in New Issue