private functions: don't report false positives when using initialization lists (#254)
This commit is contained in:
parent
7750f327ff
commit
3c3a56bfca
|
@ -436,7 +436,10 @@ void CheckClass::privateFunctions()
|
|||
if (Token::Match(tok, "typedef %type% ("))
|
||||
tok = tok->tokAt(2);
|
||||
|
||||
if (Token::Match(tok, "%var% (") &&
|
||||
else if (Token::Match(tok, "[:,] %var% ("))
|
||||
tok = tok->tokAt(2);
|
||||
|
||||
else if (Token::Match(tok, "%var% (") &&
|
||||
!Token::Match(tok, classname.c_str()))
|
||||
{
|
||||
FuncList.push_back(tok);
|
||||
|
|
|
@ -42,6 +42,8 @@ private:
|
|||
|
||||
// [ 2236547 ] False positive --style unused function, called via pointer
|
||||
TEST_CASE(func_pointer);
|
||||
|
||||
TEST_CASE(ctor);
|
||||
}
|
||||
|
||||
|
||||
|
@ -166,6 +168,22 @@ private:
|
|||
}
|
||||
|
||||
|
||||
void ctor()
|
||||
{
|
||||
check("class PrivateCtor\n"
|
||||
"{\n"
|
||||
"private:\n"
|
||||
" PrivateCtor(int threadNum) :\n"
|
||||
" numOfThreads(threadNum)\n"
|
||||
" {\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" int numOfThreads;\n"
|
||||
"};\n");
|
||||
|
||||
ASSERT_EQUALS(std::string(""), errout.str());
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue