simplifyIfAddBraces : Added check to cppcheck as it seems to work pretty good now

This commit is contained in:
Daniel Marjamäki 2008-12-22 20:49:56 +00:00
parent c3b9b3dfd5
commit 7fda68c662
3 changed files with 4 additions and 2 deletions

View File

@ -104,7 +104,7 @@ private:
{
const char code1[] = " void f() { int a; bool use = true; if( use ) a=0; else a=1; int c=1; } ";
const char code2[] = " void f() { int a; bool use = true; a=0; int c=1; } ";
const char code2[] = " void f() { int a; bool use = true; { a=0; } int c=1; } ";
ASSERT_EQUALS( tok(code2), tok(code1) );
}

View File

@ -226,7 +226,7 @@ private:
std::ostringstream ostr;
for (const TOKEN *tok = tokenizer.tokens(); tok; tok = tok->next())
ostr << " " << tok->str();
ASSERT_EQUALS( std::string(" void f ( ) { ; }"), ostr.str() );
ASSERT_EQUALS( std::string(" void f ( ) { { ; } }"), ostr.str() );
}
void ifAddBraces1()

View File

@ -1025,6 +1025,8 @@ void Tokenizer::simplifyTokenList()
}
}
simplifyIfAddBraces();
bool modified = true;
while ( modified )
{