Fix FP ignoredReturnValue (#4783)

This commit is contained in:
chrchr-github 2023-02-11 10:46:04 +01:00 committed by GitHub
parent 132a5a31cf
commit 2379239aed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -254,7 +254,7 @@ void CheckFunctions::checkIgnoredReturnValue()
const Token *parent = tok->next()->astParent();
while (Token::Match(parent, "%cop%")) {
if (Token::Match(parent, "<<|>>") && !parent->astParent())
if (Token::Match(parent, "<<|>>|*") && !parent->astParent())
break;
parent = parent->astParent();
}

View File

@ -1451,6 +1451,10 @@ private:
"}", "test.cpp", &settings2);
ASSERT_EQUALS("[test.cpp:2]: (warning) Return value of function mystrcmp() is not used.\n", errout.str());
check("void f(std::vector<int*> v) {\n"
" delete *v.begin();\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
void checkIgnoredErrorCode() {