Print message "Found calculation inside sizeof()" also for increment/decrement operator.

This commit is contained in:
PKEuS 2012-11-06 11:39:47 -08:00
parent bbe06c65c0
commit aa2ad41629
2 changed files with 8 additions and 1 deletions

View File

@ -3195,7 +3195,8 @@ void CheckOther::sizeofCalculation()
sizeofCalculationError(tok2, tok2->isExpandedMacro());
break;
}
}
} else if (tok2->type() == Token::eIncDecOp)
sizeofCalculationError(tok2, tok2->isExpandedMacro());
}
}
}

View File

@ -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() {