Skip to content

Commit 132ae52

Browse files
Don't show checkLibraryFunction warning for types with unusedvar configuration (#4765)
1 parent 8af1026 commit 132ae52

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

lib/checkfunctions.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,9 @@ void CheckFunctions::checkLibraryMatchFunctions()
637637
if (mSettings->library.podtype(tok->expressionString()))
638638
continue;
639639

640+
if (mSettings->library.getTypeCheck("unusedvar", functionName) != Library::TypeCheck::def)
641+
continue;
642+
640643
const Token* start = tok;
641644
while (Token::Match(start->tokAt(-2), "%name% ::"))
642645
start = start->tokAt(-2);

test/testfunctions.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,6 +1957,11 @@ class TestFunctions : public TestFixture {
19571957
"}\n");
19581958
ASSERT_EQUALS("", errout.str());
19591959

1960+
check("auto f() {\n"
1961+
" return std::runtime_error(\"abc\");\n"
1962+
"}\n");
1963+
ASSERT_EQUALS("", errout.str());
1964+
19601965
settings = settings_old;
19611966
}
19621967

0 commit comments

Comments
 (0)