forked from Mirrors/tinycc
fixed parsing of function parameters
parent
7bc5e51847
commit
62c5a5466a
10
tcc.c
10
tcc.c
|
@ -6853,7 +6853,8 @@ static void post_type(CType *type, AttributeDef *ad)
|
||||||
l = 0;
|
l = 0;
|
||||||
first = NULL;
|
first = NULL;
|
||||||
plast = &first;
|
plast = &first;
|
||||||
while (tok != ')') {
|
if (tok != ')') {
|
||||||
|
for(;;) {
|
||||||
/* read param name and compute offset */
|
/* read param name and compute offset */
|
||||||
if (l != FUNC_OLD) {
|
if (l != FUNC_OLD) {
|
||||||
if (!parse_btype(&pt, &ad1)) {
|
if (!parse_btype(&pt, &ad1)) {
|
||||||
|
@ -6873,6 +6874,8 @@ static void post_type(CType *type, AttributeDef *ad)
|
||||||
} else {
|
} else {
|
||||||
old_proto:
|
old_proto:
|
||||||
n = tok;
|
n = tok;
|
||||||
|
if (n < TOK_UIDENT)
|
||||||
|
expect("identifier");
|
||||||
pt.t = VT_INT;
|
pt.t = VT_INT;
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
@ -6880,8 +6883,9 @@ static void post_type(CType *type, AttributeDef *ad)
|
||||||
s = sym_push(n | SYM_FIELD, &pt, 0, 0);
|
s = sym_push(n | SYM_FIELD, &pt, 0, 0);
|
||||||
*plast = s;
|
*plast = s;
|
||||||
plast = &s->next;
|
plast = &s->next;
|
||||||
if (tok == ',') {
|
if (tok == ')')
|
||||||
next();
|
break;
|
||||||
|
skip(',');
|
||||||
if (l == FUNC_NEW && tok == TOK_DOTS) {
|
if (l == FUNC_NEW && tok == TOK_DOTS) {
|
||||||
l = FUNC_ELLIPSIS;
|
l = FUNC_ELLIPSIS;
|
||||||
next();
|
next();
|
||||||
|
|
Loading…
Reference in New Issue