Fixed #1999 (False positive: uninitialized variable (__published variables))
This commit is contained in:
parent
071f7d5f34
commit
fbe11b9bb9
|
@ -102,7 +102,7 @@ private:
|
|||
_obsoleteFunctions.push_back(std::make_pair("vfork","Found obsolete function 'vfork'. It is recommended to use the function 'fork' instead"));
|
||||
|
||||
_obsoleteFunctions.push_back(std::make_pair("wcswcs","Found obsolete function 'wcswcs'. It is recommended to use the function 'wcsstr' instead"));
|
||||
|
||||
|
||||
_obsoleteFunctions.push_back(std::make_pair("gets","Found obsolete function 'gets'. It is recommended to use the function 'fgets' instead"));
|
||||
|
||||
}
|
||||
|
|
|
@ -1778,7 +1778,7 @@ bool Tokenizer::tokenize(std::istream &code, const char FileName[], const std::s
|
|||
}
|
||||
}
|
||||
|
||||
else if (c1 == 'p' && tok->next()->str() == ":")
|
||||
else if ((c1 == 'p' || c1 == '_') && tok->next()->str() == ":")
|
||||
{
|
||||
if (tok->str() == "private" || tok->str() == "protected" || tok->str() == "public" || tok->str() == "__published")
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ private:
|
|||
|
||||
// no false positives for variables
|
||||
TEST_CASE(testvar);
|
||||
|
||||
|
||||
// dangerous function
|
||||
TEST_CASE(testgets);
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ private:
|
|||
TEST_CASE(tokenize7);
|
||||
TEST_CASE(tokenize8);
|
||||
TEST_CASE(tokenize9);
|
||||
TEST_CASE(tokenize10);
|
||||
|
||||
// array access. replace "*(p+1)" => "p[1]"
|
||||
TEST_CASE(tokenize6);
|
||||
|
@ -409,6 +410,14 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void tokenize10()
|
||||
{
|
||||
ASSERT_EQUALS("private:", tokenizeAndStringify("private:", false));
|
||||
ASSERT_EQUALS("protected:", tokenizeAndStringify("protected:", false));
|
||||
ASSERT_EQUALS("public:", tokenizeAndStringify("public:", false));
|
||||
ASSERT_EQUALS("__published:", tokenizeAndStringify("__published:", false));
|
||||
}
|
||||
|
||||
void wrong_syntax()
|
||||
{
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue