commit 687959e5e85e73b4fbdd9871eea90d5b56c3f577
Author:     Roberto E. Vargas Caballero <k...@shike2.com>
AuthorDate: Sun Jan 17 21:55:35 2016 +0100
Commit:     Roberto E. Vargas Caballero <k...@shike2.com>
CommitDate: Sun Jan 17 21:55:35 2016 +0100

    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.

diff --git a/cc1/init.c b/cc1/init.c
index 8265ef2..aa601ce 100644
--- a/cc1/init.c
+++ b/cc1/init.c
@@ -79,7 +79,7 @@ designation(Init *ip)
        default:  return ip;
        }
 
-       dp->pos  = (*fun)(ip);
+       ip->curpos  = (*fun)(ip);
        expect('=');
        return ip;
 }
@@ -88,6 +88,7 @@ static Node *
 initlist(Symbol *sym, Type *tp)
 {
        struct inititlizer *ip;
+       struct designator *dp;
        int toomany = 0;
        TINT n;
        Type *newtp;
@@ -131,9 +132,10 @@ initlist(Symbol *sym, Type *tp)
                        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;

Reply via email to