fixed parsing of function parameters

tcc-xref
bellard 2005-09-03 22:51:34 +00:00
parent 7bc5e51847
commit 62c5a5466a
1 changed files with 30 additions and 26 deletions

10
tcc.c
View File

@ -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();