Fix --check-library warning for int(i) (#4293)

This commit is contained in:
chrchr-github 2022-07-19 20:41:18 +02:00 committed by GitHub
parent c736fe8787
commit 5e537a666f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -268,7 +268,7 @@ static bool isLocalVarNoAutoDealloc(const Token *varTok, const bool isCpp)
static const Token * isFunctionCall(const Token * nameToken)
{
if (nameToken->isName()) {
if (!nameToken->isStandardType() && nameToken->isName()) {
nameToken = nameToken->next();
// check if function is a template
if (nameToken && nameToken->link() && nameToken->str() == "<") {

View File

@ -208,6 +208,7 @@ private:
TEST_CASE(configuration2);
TEST_CASE(configuration3);
TEST_CASE(configuration4);
TEST_CASE(configuration5);
TEST_CASE(ptrptr);
@ -2371,6 +2372,13 @@ private:
ASSERT_EQUALS("[test.c:4]: (information) --check-library: Function set_data() should have <use>/<leak-ignore> configuration\n", errout.str());
}
void configuration5() {
check("void f() {\n"
" int(i);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
void ptrptr() {
check("void f() {\n"
" char **p = malloc(10);\n"