Uninitialized variables: Fix FP for unknown macro like 'list_for_each'
This commit is contained in:
parent
f009cfc845
commit
dbc6771a0b
|
@ -1059,7 +1059,7 @@ int CheckUninitVar::isFunctionParUsage(const Token *vartok, bool pointer, Alloc
|
|||
if (!start)
|
||||
return -1;
|
||||
|
||||
if (Token::simpleMatch(start->link(), ") {"))
|
||||
if (Token::simpleMatch(start->link(), ") {") && Token::Match(start->previous(), "if|for|while|switch"))
|
||||
return (!pointer || alloc == NO_ALLOC);
|
||||
|
||||
// is this a function call?
|
||||
|
|
|
@ -2874,6 +2874,13 @@ private:
|
|||
" buf[1] = buf[0];\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// unknown macro
|
||||
checkUninitVar("void f() {\n"
|
||||
" struct listnode *item;\n"
|
||||
" list_for_each(item, &key_list) {}\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void uninitvar2_value() {
|
||||
|
|
Loading…
Reference in New Issue