Fixed #3661 (False positive: unusedPrivateFunction)

This commit is contained in:
Daniel Marjamäki 2012-04-09 11:19:19 +02:00
parent c12d82aeb9
commit 26a9a1b571
2 changed files with 17 additions and 3 deletions

View File

@ -192,7 +192,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
scope->access = Private;
else if (tok->str() == "protected:")
scope->access = Protected;
else if (tok->str() == "public:")
else if (tok->str() == "public:" || tok->str() == "__published:")
scope->access = Public;
else if (Token::Match(tok, "public|protected|private %var% :")) {
if (tok->str() == "private")

View File

@ -56,7 +56,8 @@ private:
TEST_CASE(friendClass);
TEST_CASE(borland); // skip FP when using __property
TEST_CASE(borland1); // skip FP when using __property
TEST_CASE(borland2); // skip FP when using __published
// No false positives when there are "unused" templates that are removed in the simplified token list
TEST_CASE(template1);
@ -472,7 +473,7 @@ private:
ASSERT_EQUALS("[test.cpp:5]: (style) Unused private function 'Foo::f'\n", errout.str());
}
void borland() {
void borland1() {
// ticket #2034 - Borland C++ __property
check("class Foo {\n"
"private:\n"
@ -486,6 +487,19 @@ private:
ASSERT_EQUALS("", errout.str());
}
void borland2() {
// ticket #3661 - Borland C++ __published
check("class Foo {\n"
"__published:\n"
" int getx() {\n"
" return 123;\n"
" }\n"
"public:\n"
" Foo() { }\n"
"};");
ASSERT_EQUALS("", errout.str());
}
void template1() {
// ticket #2067 - Template methods do not "use" private ones
check("class A {\n"