Fixed #3414 (false positive: (error) Uninitialized variable: SOutput)

This commit is contained in:
Daniel Marjamäki 2011-12-15 18:30:59 +01:00
parent 005b1cff61
commit 6221145be8
2 changed files with 9 additions and 2 deletions

View File

@ -1123,8 +1123,8 @@ bool CheckUninitVar::checkScopeForVariable(const Token *tok, const unsigned int
}
}
// TODO: handle loops etc
if (Token::simpleMatch(tok, ") {")) {
// TODO: handle loops, try, etc
if (Token::simpleMatch(tok, ") {") || Token::Match(tok, "%var% {")) {
ret = true;
return false;
}

View File

@ -1784,6 +1784,13 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
// try
checkUninitVar2("void f() {\n"
" int i, *p = &i;\n"
" try { }\n"
"}");
ASSERT_EQUALS("", errout.str());
// exit
checkUninitVar2("void f() {\n"
" int x;\n"