Fixed #3414 (false positive: (error) Uninitialized variable: SOutput)
This commit is contained in:
parent
005b1cff61
commit
6221145be8
|
@ -1123,8 +1123,8 @@ bool CheckUninitVar::checkScopeForVariable(const Token *tok, const unsigned int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: handle loops etc
|
// TODO: handle loops, try, etc
|
||||||
if (Token::simpleMatch(tok, ") {")) {
|
if (Token::simpleMatch(tok, ") {") || Token::Match(tok, "%var% {")) {
|
||||||
ret = true;
|
ret = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1784,6 +1784,13 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
// try
|
||||||
|
checkUninitVar2("void f() {\n"
|
||||||
|
" int i, *p = &i;\n"
|
||||||
|
" try { }\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// exit
|
// exit
|
||||||
checkUninitVar2("void f() {\n"
|
checkUninitVar2("void f() {\n"
|
||||||
" int x;\n"
|
" int x;\n"
|
||||||
|
|
Loading…
Reference in New Issue