Remove some redundant semicolons - part 8

This commit is contained in:
Edoardo Prezioso 2011-12-04 18:56:12 +01:00
parent 4946b036ad
commit 9cadd7c17a
2 changed files with 19 additions and 5 deletions

View File

@ -940,6 +940,10 @@ void Tokenizer::simplifyTypedef()
tok->deleteThis(); tok->deleteThis();
tok->deleteThis(); tok->deleteThis();
tok->deleteThis(); tok->deleteThis();
if (tok->next())
tok->deleteThis();
//now the next token to process is 'tok', not 'tok->next()';
goback = true;
continue; continue;
} else { } else {
const std::string pattern("struct " + tok->strAt(2) + " {|:"); const std::string pattern("struct " + tok->strAt(2) + " {|:");
@ -1102,6 +1106,9 @@ void Tokenizer::simplifyTypedef()
if (typeName->str() == "void") { if (typeName->str() == "void") {
unsupportedTypedef(typeDef); unsupportedTypedef(typeDef);
tok = deleteInvalidTypedef(typeDef); tok = deleteInvalidTypedef(typeDef);
if (tok == _tokens)
//now the next token to process is 'tok', not 'tok->next()';
goback = true;
continue; continue;
} }
@ -1111,6 +1118,9 @@ void Tokenizer::simplifyTypedef()
Token::Match(tok->linkAt(offset)->tokAt(-3), ":: * %var% ) (")) { Token::Match(tok->linkAt(offset)->tokAt(-3), ":: * %var% ) (")) {
unsupportedTypedef(typeDef); unsupportedTypedef(typeDef);
tok = deleteInvalidTypedef(typeDef); tok = deleteInvalidTypedef(typeDef);
if (tok == _tokens)
//now the next token to process is 'tok', not 'tok->next()';
goback = true;
continue; continue;
} }
@ -1152,6 +1162,9 @@ void Tokenizer::simplifyTypedef()
else { else {
unsupportedTypedef(typeDef); unsupportedTypedef(typeDef);
tok = deleteInvalidTypedef(typeDef); tok = deleteInvalidTypedef(typeDef);
if (tok == _tokens)
//now the next token to process is 'tok', not 'tok->next()';
goback = true;
continue; continue;
} }
} }
@ -1289,6 +1302,9 @@ void Tokenizer::simplifyTypedef()
else { else {
unsupportedTypedef(typeDef); unsupportedTypedef(typeDef);
tok = deleteInvalidTypedef(typeDef); tok = deleteInvalidTypedef(typeDef);
if (tok == _tokens)
//now the next token to process is 'tok', not 'tok->next()';
goback = true;
continue; continue;
} }

View File

@ -3611,9 +3611,7 @@ private:
"abc e1;\n" "abc e1;\n"
"XYZ e2;"; "XYZ e2;";
const char expected[] = const char expected[] = "int e1 ; "
"; "
"int e1 ; "
"int e2 ;"; "int e2 ;";
ASSERT_EQUALS(expected, tok(code, false)); ASSERT_EQUALS(expected, tok(code, false));
@ -4878,7 +4876,7 @@ private:
" localEntitiyAddFunc_t f;\n" " localEntitiyAddFunc_t f;\n"
"}\n"; "}\n";
// The expected result.. // The expected result..
const std::string expected("; void f ( ) { int b ; int * f ; }"); const std::string expected("void f ( ) { int b ; int * f ; }");
ASSERT_EQUALS(expected, sizeof_(code, false)); ASSERT_EQUALS(expected, sizeof_(code, false));
// Check for output.. // Check for output..