Fix knownArgument false positive when sizeof is used
This commit is contained in:
parent
514b7f4da4
commit
c08e1a9a94
|
@ -3126,6 +3126,8 @@ void CheckOther::checkKnownArgument()
|
||||||
}
|
}
|
||||||
return ChildrenToVisit::none;
|
return ChildrenToVisit::none;
|
||||||
}
|
}
|
||||||
|
if (Token::simpleMatch(child->previous(), "sizeof ("))
|
||||||
|
return ChildrenToVisit::none;
|
||||||
return ChildrenToVisit::op1_and_op2;
|
return ChildrenToVisit::op1_and_op2;
|
||||||
});
|
});
|
||||||
if (varexpr.empty())
|
if (varexpr.empty())
|
||||||
|
|
|
@ -8830,6 +8830,13 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("char *yytext;\n"
|
||||||
|
"void re_init_scanner() {\n"
|
||||||
|
" int size = 256;\n"
|
||||||
|
" yytext = xmalloc(size * sizeof *yytext);\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// #8986
|
// #8986
|
||||||
check("void f(int);\n"
|
check("void f(int);\n"
|
||||||
"void g() {\n"
|
"void g() {\n"
|
||||||
|
|
Loading…
Reference in New Issue