unused private function: fixed false positive (ticket: 129)
This commit is contained in:
parent
cc6cec091a
commit
86050cccdb
|
@ -545,7 +545,7 @@ void CheckClass::privateFunctions()
|
|||
|
||||
// Check member class functions to see what functions are used..
|
||||
if ((inclass && indent_level == 1 && Token::Match(ftok, ") const| {")) ||
|
||||
(Token::Match(ftok, (classname + " :: %var% (").c_str())))
|
||||
(Token::Match(ftok, (classname + " :: ~| %var% (").c_str())))
|
||||
{
|
||||
while (ftok && ftok->str() != ")")
|
||||
ftok = ftok->next();
|
||||
|
|
|
@ -37,6 +37,7 @@ private:
|
|||
{
|
||||
TEST_CASE(test1);
|
||||
TEST_CASE(test2);
|
||||
TEST_CASE(test3);
|
||||
|
||||
// [ 2236547 ] False positive --style unused function, called via pointer
|
||||
TEST_CASE(func_pointer);
|
||||
|
@ -101,6 +102,22 @@ private:
|
|||
}
|
||||
|
||||
|
||||
void test3()
|
||||
{
|
||||
check("class A {\n"
|
||||
"public:\n"
|
||||
" A() { }\n"
|
||||
" ~A();\n"
|
||||
"private:\n"
|
||||
" void B() { }\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"A::~A()\n"
|
||||
"{ B(); }\n");
|
||||
ASSERT_EQUALS(std::string(""), errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue