Fixed ticket 205 (False positive: char variable used in bit operation)
This commit is contained in:
parent
06776c6ac7
commit
44c952873e
|
@ -712,6 +712,9 @@ void CheckOther::CheckCharVariable()
|
|||
break;
|
||||
}
|
||||
|
||||
else if (tok2->str() == "return")
|
||||
continue;
|
||||
|
||||
std::string temp = "%var% [ " + tok->str() + " ]";
|
||||
if ((tok2->str() != ".") && Token::Match(tok2->next(), temp.c_str()))
|
||||
{
|
||||
|
|
|
@ -39,6 +39,7 @@ private:
|
|||
TEST_CASE(array_index);
|
||||
TEST_CASE(bitop1);
|
||||
TEST_CASE(bitop2);
|
||||
TEST_CASE(return1);
|
||||
}
|
||||
|
||||
void check(const char code[])
|
||||
|
@ -108,6 +109,16 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS(std::string(""), errout.str());
|
||||
}
|
||||
|
||||
void return1()
|
||||
{
|
||||
check("void foo()\n"
|
||||
"{\n"
|
||||
" char c;\n"
|
||||
" return &c;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS(std::string(""), errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestCharVar)
|
||||
|
|
Loading…
Reference in New Issue