parent
cb03b9883f
commit
df9df70ba7
|
@ -150,9 +150,9 @@ static bool isInLoopCondition(const Token * tok)
|
|||
/// If tok2 comes after tok1
|
||||
static bool precedes(const Token * tok1, const Token * tok2)
|
||||
{
|
||||
if(!tok1)
|
||||
if (!tok1)
|
||||
return false;
|
||||
if(!tok2)
|
||||
if (!tok2)
|
||||
return false;
|
||||
return tok1->progressValue() < tok2->progressValue();
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ static const Token * followVariableExpression(const Token * tok, bool cpp, const
|
|||
if (!tok)
|
||||
return tok;
|
||||
// Skip following variables that is across multiple files
|
||||
if(end && end->fileIndex() != tok->fileIndex())
|
||||
if (end && end->fileIndex() != tok->fileIndex())
|
||||
return tok;
|
||||
// Skip array access
|
||||
if (Token::Match(tok, "%var% ["))
|
||||
|
@ -216,7 +216,7 @@ static const Token * followVariableExpression(const Token * tok, bool cpp, const
|
|||
}
|
||||
|
||||
if (const Variable * var2 = tok2->variable()) {
|
||||
if(!var2->scope())
|
||||
if (!var2->scope())
|
||||
return tok;
|
||||
const Token * endToken2 = var2->scope() != tok->scope() ? var2->scope()->bodyEnd : endToken;
|
||||
if (!var2->isLocal() && !var2->isConst() && !var2->isArgument())
|
||||
|
@ -225,8 +225,8 @@ static const Token * followVariableExpression(const Token * tok, bool cpp, const
|
|||
return tok;
|
||||
if (!var2->isConst() && isVariableChanged(tok2, endToken2, tok2->varId(), false, nullptr, cpp))
|
||||
return tok;
|
||||
// Recognized as a variable but the declaration is unknown
|
||||
} else if(tok2->varId() > 0) {
|
||||
// Recognized as a variable but the declaration is unknown
|
||||
} else if (tok2->varId() > 0) {
|
||||
return tok;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -427,10 +427,10 @@ void CheckCondition::multiCondition()
|
|||
break;
|
||||
tok2 = tok2->tokAt(4);
|
||||
|
||||
if (cond1 &&
|
||||
tok2->astOperand2() &&
|
||||
!cond1->hasKnownValue() &&
|
||||
!tok2->astOperand2()->hasKnownValue() &&
|
||||
if (cond1 &&
|
||||
tok2->astOperand2() &&
|
||||
!cond1->hasKnownValue() &&
|
||||
!tok2->astOperand2()->hasKnownValue() &&
|
||||
isOverlappingCond(cond1, tok2->astOperand2(), true))
|
||||
multiConditionError(tok2, cond1->linenr());
|
||||
}
|
||||
|
@ -583,7 +583,7 @@ void CheckCondition::multiCondition2()
|
|||
tokens1.push(firstCondition->astOperand1());
|
||||
tokens1.push(firstCondition->astOperand2());
|
||||
} else if (!firstCondition->hasKnownValue()) {
|
||||
if(isOppositeCond(false, mTokenizer->isCPP(), firstCondition, cond2, mSettings->library, true, &errorPath)) {
|
||||
if (isOppositeCond(false, mTokenizer->isCPP(), firstCondition, cond2, mSettings->library, true, &errorPath)) {
|
||||
if (!isAliased(vars))
|
||||
oppositeInnerConditionError(firstCondition, cond2, errorPath);
|
||||
} else if (isSameExpression(mTokenizer->isCPP(), true, firstCondition, cond2, mSettings->library, true, &errorPath)) {
|
||||
|
@ -602,8 +602,8 @@ void CheckCondition::multiCondition2()
|
|||
if (secondCondition->str() == "||" || secondCondition->str() == "&&") {
|
||||
tokens2.push(secondCondition->astOperand1());
|
||||
tokens2.push(secondCondition->astOperand2());
|
||||
} else if ((!cond1->hasKnownValue() || !secondCondition->hasKnownValue()) &&
|
||||
isSameExpression(mTokenizer->isCPP(), true, cond1, secondCondition, mSettings->library, true, &errorPath)) {
|
||||
} else if ((!cond1->hasKnownValue() || !secondCondition->hasKnownValue()) &&
|
||||
isSameExpression(mTokenizer->isCPP(), true, cond1, secondCondition, mSettings->library, true, &errorPath)) {
|
||||
if (!isAliased(vars))
|
||||
identicalConditionAfterEarlyExitError(cond1, secondCondition, errorPath);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue