From 38a6c41730b58c6f122a5c29ad219b0e640d9c6b Mon Sep 17 00:00:00 2001 From: Slava Semushin Date: Sat, 21 Nov 2009 20:44:15 +0600 Subject: [PATCH] Fixed #988 (Tokenizer::simplifyDoWhileAddBraces(): don't add braces after "do" when it not a loop) FIXME: test cases needed. http://sourceforge.net/apps/trac/cppcheck/ticket/988 --- lib/tokenize.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 93ffbd5b7..4a26b8098 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2375,6 +2375,12 @@ void Tokenizer::simplifyDoWhileAddBraces() continue; } + if (tok->next()->str() == ")") + { + // fix for #988 + continue; + } + Token *tok1 = tok; // token with "do" Token *tok2 = NULL; // token with "while" Token *tok3 = tok;