parent
5a7c7b9b5a
commit
4654b6561b
|
@ -3149,7 +3149,7 @@ static ExprUsage getFunctionUsage(const Token* tok, int indirect, const Settings
|
||||||
} else if (ftok->isControlFlowKeyword()) {
|
} else if (ftok->isControlFlowKeyword()) {
|
||||||
return ExprUsage::Used;
|
return ExprUsage::Used;
|
||||||
} else if (ftok->str() == "{") {
|
} else if (ftok->str() == "{") {
|
||||||
return ExprUsage::Used;
|
return indirect == 0 ? ExprUsage::Used : ExprUsage::Inconclusive;
|
||||||
} else {
|
} else {
|
||||||
const bool isnullbad = settings->library.isnullargbad(ftok, argnr + 1);
|
const bool isnullbad = settings->library.isnullargbad(ftok, argnr + 1);
|
||||||
if (indirect == 0 && astIsPointer(tok) && !addressOf && isnullbad)
|
if (indirect == 0 && astIsPointer(tok) && !addressOf && isnullbad)
|
||||||
|
|
|
@ -6197,6 +6197,12 @@ private:
|
||||||
" x = i;\n"
|
" x = i;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: i\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: i\n", errout.str());
|
||||||
|
|
||||||
|
valueFlowUninit("void f() {\n" // #11890
|
||||||
|
" int x;\n"
|
||||||
|
" int* a[] = { &x };\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void valueFlowUninitBreak() { // Do not show duplicate warnings about the same uninitialized value
|
void valueFlowUninitBreak() { // Do not show duplicate warnings about the same uninitialized value
|
||||||
|
|
Loading…
Reference in New Issue