Print message "Found calculation inside sizeof()" also for increment/decrement operator.
This commit is contained in:
parent
bbe06c65c0
commit
aa2ad41629
|
@ -3195,7 +3195,8 @@ void CheckOther::sizeofCalculation()
|
|||
sizeofCalculationError(tok2, tok2->isExpandedMacro());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (tok2->type() == Token::eIncDecOp)
|
||||
sizeofCalculationError(tok2, tok2->isExpandedMacro());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1428,6 +1428,12 @@ private:
|
|||
|
||||
check("sizeof(void * const)");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("sizeof(foo++)");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (warning) Found calculation inside sizeof().\n", errout.str());
|
||||
|
||||
check("sizeof(--foo)");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (warning) Found calculation inside sizeof().\n", errout.str());
|
||||
}
|
||||
|
||||
void switchRedundantAssignmentTest() {
|
||||
|
|
Loading…
Reference in New Issue