mirror of
https://github.com/frida/tinycc
synced 2025-01-03 10:34:37 +03:00
fixing decl_initializer() for size_only: don't eat ')'
a test program: struct { int c[1]; } s1[] = { (int)0 }; /* OK */ struct { int c[1]; } s2[] = { { ((int)0) } }; /* OK */ struct { int c[1]; } s3[] = { 0 }; /* OK */ struct { int c[1]; } sx[] = { ((int)0) }; /* error: ')' expected (got "}") */ int main() { return 0; }
This commit is contained in:
parent
4b92dbf923
commit
d9b87c087c
10
tccgen.c
10
tccgen.c
@ -5605,12 +5605,18 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c,
|
||||
(tok != '}' && tok != ',')) && tok != -1) {
|
||||
if (tok == '(')
|
||||
parlevel++;
|
||||
else if (tok == ')')
|
||||
else if (tok == ')') {
|
||||
if (parlevel == 0 && parlevel1 == 0)
|
||||
break;
|
||||
parlevel--;
|
||||
}
|
||||
else if (tok == '{')
|
||||
parlevel1++;
|
||||
else if (tok == '}')
|
||||
else if (tok == '}') {
|
||||
if (parlevel == 0 && parlevel1 == 0)
|
||||
break;
|
||||
parlevel1--;
|
||||
}
|
||||
next();
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user