simplifyIfAddBraces : Added check to cppcheck as it seems to work pretty good now
This commit is contained in:
parent
c3b9b3dfd5
commit
7fda68c662
|
@ -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) );
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -1025,6 +1025,8 @@ void Tokenizer::simplifyTokenList()
|
|||
}
|
||||
}
|
||||
|
||||
simplifyIfAddBraces();
|
||||
|
||||
bool modified = true;
|
||||
while ( modified )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue