Merge pull request #474 from Dmitry-Me/reorderChecks
Reorder checks to avoid redundant actions
This commit is contained in:
commit
02298bf4d9
|
@ -445,10 +445,12 @@ void CheckOther::invalidPointerCast()
|
|||
nextTok = nextTok->next();
|
||||
toTok = tok->tokAt(2);
|
||||
}
|
||||
if (!nextTok)
|
||||
continue;
|
||||
if (toTok && toTok->str() == "const")
|
||||
toTok = toTok->next();
|
||||
|
||||
if (!nextTok || !toTok || !toTok->isStandardType())
|
||||
if (!toTok || !toTok->isStandardType())
|
||||
continue;
|
||||
|
||||
// Find casted variable
|
||||
|
@ -649,7 +651,7 @@ void CheckOther::checkRedundantAssignment()
|
|||
}
|
||||
}
|
||||
if (error) {
|
||||
if (scope->type == Scope::eSwitch && Token::findmatch(it->second, "default|case", tok) && warning)
|
||||
if (warning && scope->type == Scope::eSwitch && Token::findmatch(it->second, "default|case", tok))
|
||||
redundantAssignmentInSwitchError(it->second, tok, tok->str());
|
||||
else if (performance) {
|
||||
const bool nonlocal = nonLocal(it->second->variable());
|
||||
|
|
Loading…
Reference in New Issue