From 6314d04a04c3ae954b1430048d42cd47e010d1f5 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Fri, 27 Jan 2012 16:47:26 +0100 Subject: [PATCH] Tokenizer: Add 'BOOST_FOREACH' pattern where it was missing. --- lib/tokenize.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index c9fc01b1a..d3017d30d 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -1957,7 +1957,7 @@ bool Tokenizer::tokenize(std::istream &code, // if MACRO for (const Token *tok = _tokens; tok; tok = tok->next()) { - if (Token::Match(tok, "if|for|while %var% (")) { + if (Token::Match(tok, "if|for|while|BOOST_FOREACH %var% (")) { syntaxError(tok); return false; } @@ -6278,7 +6278,7 @@ bool Tokenizer::simplifyKnownVariablesSimplify(Token **tok2, Token *tok3, unsign // then it can't be changed by the function call. if (tok3->str() == ")" && tok3->link() && Token::Match(tok3->link()->tokAt(-2), "[;{}] %var% (") && - !Token::Match(tok3->link()->previous(), "if|for|while|switch")) + !Token::Match(tok3->link()->previous(), "if|for|while|switch|BOOST_FOREACH")) break; // Stop if something like 'while (--var)' is found @@ -7057,7 +7057,7 @@ bool Tokenizer::duplicateDefinition(Token ** tokPtr, const Token * name) if (end) { if (Token::simpleMatch(end, ") {")) { // function parameter ? // make sure it's not a conditional - if (Token::Match(end->link()->previous(), "if|for|while|switch")) + if (Token::Match(end->link()->previous(), "if|for|while|switch|BOOST_FOREACH")) return false; // look backwards