Do not ask that calculation is clarified when different order would be invalid
This commit is contained in:
parent
242fc4e9a2
commit
7a85b8e452
|
@ -160,6 +160,10 @@ void CheckOther::clarifyCalculation()
|
|||
if (!tok->astOperand1()->isArithmeticalOp() && tok->astOperand1()->tokType() != Token::eBitOp)
|
||||
continue;
|
||||
|
||||
// bit operation in lhs and pointer in rhs => no clarification is needed
|
||||
if (tok->astOperand1()->tokType() == Token::eBitOp && tok->astOperand2()->valueType() && tok->astOperand2()->valueType()->pointer > 0)
|
||||
continue;
|
||||
|
||||
// Is code clarified by parentheses already?
|
||||
const Token *tok2 = tok->astOperand1();
|
||||
for (; tok2; tok2 = tok2->next()) {
|
||||
|
|
|
@ -4022,6 +4022,9 @@ private:
|
|||
|
||||
check("void f() { a = *p ? 1 : 2; }");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f(int x) { const char *p = x & 1 ? \"1\" : \"0\"; }");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void clarifyStatement() {
|
||||
|
|
Loading…
Reference in New Issue