Don't show checkLibraryFunction warning for types with unusedvar configuration (#4765)

This commit is contained in:
chrchr-github 2023-02-07 21:58:44 +01:00 committed by GitHub
parent 8af1026696
commit 132ae52428
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -637,6 +637,9 @@ void CheckFunctions::checkLibraryMatchFunctions()
if (mSettings->library.podtype(tok->expressionString()))
continue;
if (mSettings->library.getTypeCheck("unusedvar", functionName) != Library::TypeCheck::def)
continue;
const Token* start = tok;
while (Token::Match(start->tokAt(-2), "%name% ::"))
start = start->tokAt(-2);

View File

@ -1957,6 +1957,11 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
check("auto f() {\n"
" return std::runtime_error(\"abc\");\n"
"}\n");
ASSERT_EQUALS("", errout.str());
settings = settings_old;
}