Fixed #3661 (False positive: unusedPrivateFunction)
This commit is contained in:
parent
c12d82aeb9
commit
26a9a1b571
|
@ -192,7 +192,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
|
||||||
scope->access = Private;
|
scope->access = Private;
|
||||||
else if (tok->str() == "protected:")
|
else if (tok->str() == "protected:")
|
||||||
scope->access = Protected;
|
scope->access = Protected;
|
||||||
else if (tok->str() == "public:")
|
else if (tok->str() == "public:" || tok->str() == "__published:")
|
||||||
scope->access = Public;
|
scope->access = Public;
|
||||||
else if (Token::Match(tok, "public|protected|private %var% :")) {
|
else if (Token::Match(tok, "public|protected|private %var% :")) {
|
||||||
if (tok->str() == "private")
|
if (tok->str() == "private")
|
||||||
|
|
|
@ -56,7 +56,8 @@ private:
|
||||||
|
|
||||||
TEST_CASE(friendClass);
|
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
|
// No false positives when there are "unused" templates that are removed in the simplified token list
|
||||||
TEST_CASE(template1);
|
TEST_CASE(template1);
|
||||||
|
@ -472,7 +473,7 @@ private:
|
||||||
ASSERT_EQUALS("[test.cpp:5]: (style) Unused private function 'Foo::f'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:5]: (style) Unused private function 'Foo::f'\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void borland() {
|
void borland1() {
|
||||||
// ticket #2034 - Borland C++ __property
|
// ticket #2034 - Borland C++ __property
|
||||||
check("class Foo {\n"
|
check("class Foo {\n"
|
||||||
"private:\n"
|
"private:\n"
|
||||||
|
@ -486,6 +487,19 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
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() {
|
void template1() {
|
||||||
// ticket #2067 - Template methods do not "use" private ones
|
// ticket #2067 - Template methods do not "use" private ones
|
||||||
check("class A {\n"
|
check("class A {\n"
|
||||||
|
|
Loading…
Reference in New Issue