From 347e1eae205b33a15e948c8be80b5334cdf69f91 Mon Sep 17 00:00:00 2001 From: Martin Ettl Date: Sun, 10 Nov 2013 00:40:42 +0100 Subject: [PATCH] Fixed #5162: Tokenizer:simplifyInitVar: Unused pointer value (UNUSED_VALUE) returned_pointer: Pointer tok2 returned by tok2->next() is never used (CID 1124084). --- lib/tokenize.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index a79f6ea20..98f9aa50e 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -6139,14 +6139,9 @@ void Tokenizer::simplifyInitVar() while (tok1->str() != ",") tok1 = tok1->next(); tok1->str(";"); - unsigned int num = 0; - const Token *tok2 = tok; - if (Token::Match(tok2, "class|struct|union")) { - num++; - tok2 = tok2->next(); - } - num++; - list.insertTokens(tok1, tok, num); + + const unsigned int numTokens = (Token::Match(tok, "class|struct|union")) ? 2U : 1U; + list.insertTokens(tok1, tok, numTokens); tok = initVar(tok); } }