Calculation in sizeof: Fixed FP for sizeof(Fred**)
This commit is contained in:
parent
29e74222fb
commit
742a6935ea
|
@ -248,6 +248,8 @@ static bool isCalculation(const Token *op)
|
||||||
operands.push(item->astOperand1());
|
operands.push(item->astOperand1());
|
||||||
if (item->astOperand2())
|
if (item->astOperand2())
|
||||||
operands.push(item->astOperand2());
|
operands.push(item->astOperand2());
|
||||||
|
else if (Token::Match(item, "*|&"))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// type specification => return false
|
// type specification => return false
|
||||||
|
|
|
@ -100,6 +100,9 @@ private:
|
||||||
check("sizeof(int*[2])");
|
check("sizeof(int*[2])");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("sizeof(Fred**)");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
check("sizeof(foo++)");
|
check("sizeof(foo++)");
|
||||||
ASSERT_EQUALS("[test.cpp:1]: (warning) Found calculation inside sizeof().\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:1]: (warning) Found calculation inside sizeof().\n", errout.str());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue