scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit e58e000f02f4ed8c9655eb587cc6f817b84af1f1
parent 5e8ed05e7151c938cdc3342d9dea15b21a8e9491
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 10 Sep 2015 22:33:37 +0200

Integrate initlist in initiliazer()

Diffstat:
Mcc1/expr.c | 23+++++------------------
1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/cc1/expr.c b/cc1/expr.c @@ -980,31 +980,18 @@ condexpr(void) /* TODO: check correctness of the initializator */ /* TODO: emit initializer */ -static void -initlist(void) -{ - Node *np; - - if (yytoken == '}') - return; - - do { - if (accept('{')) - initlist(); - assign(); - } while (accept(',')); - - expect('}'); -} - void initializer(Symbol *sym) { Node *np; + Type *tp = sym->type; int flags = sym->flags; if (accept('{')) { - initlist(); + do { + initializer(sym); + } while (accept(',')); + expect('}'); return; } np = assignop(OINIT, varnode(sym), assign());