Tokenizer: Fix wrong simplification when checking linux kernel

This commit is contained in:
Daniel Marjamäki 2015-01-03 21:35:03 +01:00
parent 014f8e3c71
commit eb1c048d2a
2 changed files with 2 additions and 1 deletions

View File

@ -4957,7 +4957,7 @@ void Tokenizer::simplifyUndefinedSizeArray()
Token *tok2 = tok->next();
while (tok2 && tok2->str() == "*")
tok2 = tok2->next();
if (!Token::Match(tok2, "%var% [ ]"))
if (!Token::Match(tok2, "%var% [ ] ;|["))
continue;
tok = tok2->previous();

View File

@ -4137,6 +4137,7 @@ private:
ASSERT_EQUALS("int * * * x ;", tok("int * x [][];"));
ASSERT_EQUALS("int * * * * x ;", tok("int * * x [][];"));
ASSERT_EQUALS("void f ( int x [ ] , double y [ ] ) { }", tok("void f(int x[], double y[]) { }"));
ASSERT_EQUALS("int x [ 13 ] = { [ 11 ] = 2 , [ 12 ] = 3 } ;", tok("int x[] = {[11]=2, [12]=3};"));
}
void simplifyArrayAddress() { // ticket #3304