Unreachable code : minor bug fixes

This commit is contained in:
Daniel Marjamäki 2008-12-06 16:54:45 +00:00
parent 4ef7839d6a
commit d3f68a9a5d
1 changed files with 3 additions and 1 deletions

View File

@ -806,9 +806,11 @@ void CheckOther::unreachableCode()
// Locate the end of the 'return' statement
while ( tok && ! TOKEN::Match(tok, ";") )
tok = tok->next;
while ( tok && TOKEN::Match(tok->next, ";") )
tok = tok->next;
// If there is a statement below the return it is unreachable
if (!TOKEN::Match(tok, "; case|default|}") && !TOKEN::Match(tok, "; %var% :"))
if (!TOKEN::Match(tok, "; case|default|}|#") && !TOKEN::Match(tok, "; %var% :"))
{
std::ostringstream errmsg;
errmsg << _tokenizer->fileLine(tok->next) << ": Unreachable code below a 'return'";