Fixed TODO in checkAssignBoolToFloat

This commit is contained in:
PKEuS 2014-05-24 20:02:12 +02:00
parent e6a394d514
commit d42275c5f1
2 changed files with 4 additions and 4 deletions

View File

@ -484,9 +484,9 @@ void CheckBool::checkAssignBoolToFloat()
for (std::size_t i = 0; i < functions; ++i) {
const Scope * scope = symbolDatabase->functionScopes[i];
for (const Token* tok = scope->classStart; tok != scope->classEnd; tok = tok->next()) {
if (Token::Match(tok, "!!* %var% = %bool% ;")) {
const Variable * const var = symbolDatabase->getVariableFromVarId(tok->next()->varId());
if (var && var->isFloatingType())
if (Token::Match(tok, "%var% =")) {
const Variable * const var = symbolDatabase->getVariableFromVarId(tok->varId());
if (var && var->isFloatingType() && astIsBool(tok->next()->astOperand2()))
assignBoolToFloatError(tok->next());
}
}

View File

@ -154,7 +154,7 @@ private:
check("void foo3() {\n"
" long double d = (2>1);\n"
"}");
TODO_ASSERT_EQUALS("[test.cpp:2]: (style) Boolean value assigned to floating point variable.\n", "", errout.str());
ASSERT_EQUALS("[test.cpp:2]: (style) Boolean value assigned to floating point variable.\n", errout.str());
// stability - don't crash:
check("void foo4() {\n"