Fixed #3132 (Analysis failed. If the code is valid then please report this failure.)

This commit is contained in:
Edoardo Prezioso 2011-10-03 19:38:37 +02:00 committed by Daniel Marjamäki
parent 155eeb8e0a
commit bc74213036
2 changed files with 3 additions and 1 deletions

View File

@ -4963,7 +4963,7 @@ void Tokenizer::removeRedundantCodeAfterReturn()
}
else
{
if (indentcase >= indentret && indentlevel > indentlabel)
if (indentcase > indentret && indentlevel > indentlabel)
{
tok = tok->previous();
tok->deleteNext();

View File

@ -5929,6 +5929,8 @@ private:
ASSERT_EQUALS("int f ( int n ) { switch ( n ) { case 0 : return 0 ; default : ; return n ; } return -1 ; }",
tokenizeAndStringify("int f(int n) { switch (n) {case 0: return 0; n*=2; default: return n; n*=6;} return -1; foo();}"));
//ticket #3132
ASSERT_EQUALS("void f ( int i ) { goto label ; switch ( i ) { label : ; return ; } }",tokenizeAndStringify("void f (int i) { goto label; switch(i) { label: return; } }"));
{
const char code[] = "void f(){ "