ref: 687959e5e85e73b4fbdd9871eea90d5b56c3f577
parent: c79ab0b02b6d74f4fa1b19e82201df136b8ae2e6
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Jan 17 16:55:35 EST 2016
Do not return after found a sub compound in initlist() We can have something like: {{}, {}}, so we only have to pass to the next element instead of returning.
--- a/cc1/init.c
+++ b/cc1/init.c
@@ -79,7 +79,7 @@
default: return ip;
}
- dp->pos = (*fun)(ip);
+ ip->curpos = (*fun)(ip);
expect('=');
return ip;
}
@@ -88,6 +88,7 @@
initlist(Symbol *sym, Type *tp)
{
struct inititlizer *ip;
+ struct designator *dp;
int toomany = 0;
TINT n;
Type *newtp;
@@ -131,9 +132,10 @@
sym = NULL;
break;
}
- if (accept('{'))
- return initlist(sym, tp);
- ip->head->expr = assign(NULL);
+ dp = ip->head;
+ dp->pos = ip->curpos;
+ /* TODO: pass the correct parameters to initlist */
+ dp->expr = (accept('{')) ? initlist(sym, tp) : assign(NULL);
if (!accept(','))
break;