diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index c4568b35e..796f61470 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -7607,16 +7607,16 @@ void Tokenizer::simplifyEnum() // previous value or 0 if it is the first one. std::map enumValues; for (; tok1 && tok1 != end; tok1 = tok1->next()) { - Token * enumName = 0; - Token * enumValue = 0; - Token * enumValueStart = 0; - Token * enumValueEnd = 0; - if (tok1->str() == "(") { tok1 = tok1->link(); continue; } + Token * enumName = 0; + Token * enumValue = 0; + Token * enumValueStart = 0; + Token * enumValueEnd = 0; + if (Token::Match(tok1->previous(), ",|{ %type% ,|}")) { // no value specified enumName = tok1; @@ -7872,8 +7872,10 @@ void Tokenizer::simplifyEnum() ++indentlevel; else if (enumtok->str() == ")") --indentlevel; - if (indentlevel == 0) - hasOp |= enumtok->isOp(); + if (indentlevel == 0 && enumtok->isOp()) { + hasOp = true; + break; + } } if (!hasOp) tok2 = copyTokens(tok2, ev->start, ev->end); @@ -8128,7 +8130,7 @@ void Tokenizer::eraseDeadCode(Token *begin, const Token *end) { if (!begin) return; - bool isgoto = Token::Match(begin->tokAt(-2), "goto %var% ;"); + const bool isgoto = Token::Match(begin->tokAt(-2), "goto %var% ;"); unsigned int indentlevel = 1, indentcase = 0, indentswitch = 0,