Fixed #2346 (False positive: pointer is assigned value that is never used. used here: 'pCol = pCol->GetNext()')
This commit is contained in:
parent
10ee43790d
commit
ecad249ae2
|
@ -1667,6 +1667,10 @@ void CheckOther::functionVariableUsage()
|
|||
else
|
||||
variables.write(varid1);
|
||||
}
|
||||
else if (Token::Match(tok, "%varid% .", varid1))
|
||||
{
|
||||
variables.use(varid1);
|
||||
}
|
||||
else
|
||||
{
|
||||
variables.write(varid1);
|
||||
|
|
|
@ -80,6 +80,7 @@ private:
|
|||
TEST_CASE(localvar30);
|
||||
TEST_CASE(localvar31); // ticket #2286
|
||||
TEST_CASE(localvar32); // ticket #2330
|
||||
TEST_CASE(localvar33); // ticket #2346
|
||||
TEST_CASE(localvaralias1);
|
||||
TEST_CASE(localvaralias2); // ticket #1637
|
||||
TEST_CASE(localvaralias3); // ticket #1639
|
||||
|
@ -1346,6 +1347,17 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void localvar33() // ticket #2345
|
||||
{
|
||||
functionVariableUsage("void f() {\n"
|
||||
" Abc* abc = getabc();\n"
|
||||
" while (0 != (abc = abc->next())) {\n"
|
||||
" ++nOldNum;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void localvaralias1()
|
||||
{
|
||||
functionVariableUsage("void foo()\n"
|
||||
|
|
Loading…
Reference in New Issue