From ff0573998aaa2a86042f0344f2c1c80f52dddfcd Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Wed, 6 Jan 2010 01:32:05 +0200 Subject: [PATCH] Added more validating code to tokenizer. Currently commented out. --- lib/tokenize.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 333c62edc..407ac5bbe 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5068,9 +5068,10 @@ void Tokenizer::removeExceptionSpecifications(Token *tok) const bool Tokenizer::validate() const { std::stack linktok; - + const Token *lastTok = 0; for (const Token *tok = tokens(); tok; tok = tok->next()) { + lastTok = tok; if (Token::Match(tok, "[{([]")) { if (tok->link() == 0) @@ -5126,6 +5127,15 @@ bool Tokenizer::validate() const return false; } + if (lastTok != _tokensBack) + { + // TODO, the two lines below should be uncommented and + // problems that appear with testrunner should be fixed + + //cppcheckError(lastTok); + //return false; + } + return true; }