From a1a839fadc33342e7119e7551c9ab4b764a8e7cd Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Fri, 7 Oct 2011 08:11:48 -0400 Subject: [PATCH] fix tokenizer and symbol database to not mistake goto statement for variable declaration --- lib/symboldatabase.cpp | 5 +++++ lib/tokenize.cpp | 3 +++ 2 files changed, 8 insertions(+) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index b8f6b538b..118cba76e 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -1697,6 +1697,11 @@ void Scope::getVariableList() continue; else if (Token::Match(tok, ";|{|}")) continue; + else if (Token::Match(tok, "goto %var% ;")) + { + tok = tok->next()->next(); + continue; + } tok = checkVariable(tok, varaccess); diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 9dffa72e7..d866d42c2 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3737,6 +3737,9 @@ void Tokenizer::setVarId() continue; } + if (Token::Match(tok, "goto %any% ;")) + continue; + if (Token::Match(tok, "else|return|typedef|delete|sizeof")) continue;