Unreachable code : minor bug fixes
This commit is contained in:
parent
4ef7839d6a
commit
d3f68a9a5d
|
@ -806,9 +806,11 @@ void CheckOther::unreachableCode()
|
||||||
// Locate the end of the 'return' statement
|
// Locate the end of the 'return' statement
|
||||||
while ( tok && ! TOKEN::Match(tok, ";") )
|
while ( tok && ! TOKEN::Match(tok, ";") )
|
||||||
tok = tok->next;
|
tok = tok->next;
|
||||||
|
while ( tok && TOKEN::Match(tok->next, ";") )
|
||||||
|
tok = tok->next;
|
||||||
|
|
||||||
// If there is a statement below the return it is unreachable
|
// 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;
|
std::ostringstream errmsg;
|
||||||
errmsg << _tokenizer->fileLine(tok->next) << ": Unreachable code below a 'return'";
|
errmsg << _tokenizer->fileLine(tok->next) << ": Unreachable code below a 'return'";
|
||||||
|
|
Loading…
Reference in New Issue