Fixed false positive when self-checking Cppcheck 'boolean result used in bitwise operation' when using boolean variables.
This commit is contained in:
parent
24c6d92667
commit
0e48625ff4
|
@ -931,9 +931,9 @@ void CheckCondition::clarifyCondition()
|
||||||
// using boolean result in bitwise operation ! x [&|^]
|
// using boolean result in bitwise operation ! x [&|^]
|
||||||
const ValueType* vt1 = tok->astOperand1() ? tok->astOperand1()->valueType() : nullptr;
|
const ValueType* vt1 = tok->astOperand1() ? tok->astOperand1()->valueType() : nullptr;
|
||||||
const ValueType* vt2 = tok->astOperand2() ? tok->astOperand2()->valueType() : nullptr;
|
const ValueType* vt2 = tok->astOperand2() ? tok->astOperand2()->valueType() : nullptr;
|
||||||
if (vt1 && vt1->type == ValueType::BOOL && !Token::Match(tok->astOperand1(), "(|[|::|.") && countPar(tok->astOperand1(), tok) == 0)
|
if (vt1 && vt1->type == ValueType::BOOL && !Token::Match(tok->astOperand1(), "%name%|(|[|::|.") && countPar(tok->astOperand1(), tok) == 0)
|
||||||
clarifyConditionError(tok, false, true);
|
clarifyConditionError(tok, false, true);
|
||||||
else if (vt2 && vt2->type == ValueType::BOOL && !Token::Match(tok->astOperand1(), "(|[|::|.") && countPar(tok, tok->astOperand2()) == 0)
|
else if (vt2 && vt2->type == ValueType::BOOL && !Token::Match(tok->astOperand1(), "%name%|(|[|::|.") && countPar(tok, tok->astOperand2()) == 0)
|
||||||
clarifyConditionError(tok, false, true);
|
clarifyConditionError(tok, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue