parent
e2b2fc2684
commit
a75392307f
|
@ -250,7 +250,7 @@ void CheckFunctions::checkIgnoredReturnValue()
|
|||
else if (Token::Match(tok, "[(<]") && tok->link())
|
||||
tok = tok->link();
|
||||
|
||||
if (tok->varId() || !Token::Match(tok, "%name% (") || tok->isKeyword())
|
||||
if (tok->varId() || tok->isKeyword() || tok->isStandardType() || !Token::Match(tok, "%name% ("))
|
||||
continue;
|
||||
|
||||
const Token *parent = tok->next()->astParent();
|
||||
|
|
|
@ -1310,7 +1310,7 @@ void CheckStl::negativeIndex()
|
|||
const SymbolDatabase* const symbolDatabase = mTokenizer->getSymbolDatabase();
|
||||
for (const Scope * scope : symbolDatabase->functionScopes) {
|
||||
for (const Token* tok = scope->bodyStart->next(); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
if (!Token::Match(tok, "%var% [") || WRONG_DATA(!tok->next()->astOperand2(), tok))
|
||||
if (!Token::Match(tok, "%var% [") || !tok->next()->astOperand2())
|
||||
continue;
|
||||
const Variable * const var = tok->variable();
|
||||
if (!var || tok == var->nameToken())
|
||||
|
|
|
@ -1826,6 +1826,7 @@ private:
|
|||
void checkLibraryMatchFunctions() {
|
||||
const auto settings_old = settings;
|
||||
settings.checkLibrary = true;
|
||||
settings.daca = true;
|
||||
|
||||
check("void f() {\n"
|
||||
" lib_func();"
|
||||
|
@ -1992,6 +1993,11 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f() {\n" // #11604
|
||||
" int (*g)() = nullptr;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
settings = settings_old;
|
||||
}
|
||||
|
||||
|
|
|
@ -2319,6 +2319,16 @@ private:
|
|||
" return sum;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
const auto oldSettings = settings;
|
||||
settings.daca = true;
|
||||
|
||||
check("void f() {\n"
|
||||
" const char a[][5] = { \"1\", \"true\", \"on\", \"yes\" };\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
settings = oldSettings;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue