[hackers] [scc] Do not return after found a sub compound in initlist() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sun, 17 Jan 2016 21:57:55 +0100 (CET)

commit 687959e5e85e73b4fbdd9871eea90d5b56c3f577
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sun Jan 17 21:55:35 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_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
_AT_@ -79,7 +79,7 @@ designation(Init *ip)
         default: return ip;
         }
 
- dp->pos = (*fun)(ip);
+ ip->curpos = (*fun)(ip);
         expect('=');
         return ip;
 }
_AT_@ -88,6 +88,7 @@ static Node *
 initlist(Symbol *sym, Type *tp)
 {
         struct inititlizer *ip;
+ struct designator *dp;
         int toomany = 0;
         TINT n;
         Type *newtp;
_AT_@ -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;
Received on Sun Jan 17 2016 - 21:57:55 CET

This archive was generated by hypermail 2.3.0 : Sun Jan 17 2016 - 22:00:31 CET