diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 111d789e9..4e99f0c69 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5244,7 +5244,11 @@ void Tokenizer::simplifyVarDecl(Token * tokBegin, Token * tokEnd, bool only_k_r_ if (isstatic) { if (Token::Match(tok2->next(), "%num% ,")) tok2 = tok2->tokAt(2); - else + else if (Token::Match(tok2->next(), "( %num% ) ,")) { // ticket #4450 + tok2->deleteNext(); + tok2->next()->deleteNext(); + tok2 = tok2->tokAt(2); + } else tok2 = NULL; } else if (isconst && !ispointer) { //do not split const non-pointer variables.. diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 3c23180a1..ba9f66610 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -5581,6 +5581,13 @@ private: const char code[] = "static unsigned int *a=0, *b=0;"; ASSERT_EQUALS("static unsigned int * a = 0 ; static unsigned int * b = 0 ;", tokenizeAndStringify(code)); } + + { + const char code[] = "static int large_eeprom_type = (13 | (5)), " + "default_flash_type = 42;"; + ASSERT_EQUALS("static int large_eeprom_type = 13 ; static int default_flash_type = 42 ;", + tokenizeAndStringify(code)); + } } void vardecl6() {