commit 3939d91c2494e9de10f4f7e8a692544416c5f021
Author: Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Tue Sep 8 22:36:19 2015 +0200
Commit: Roberto E. Vargas Caballero <[email protected]>
CommitDate: Tue Sep 8 22:36:19 2015 +0200
Fix grammar of aggregate initializers
After last commits, the grammar was incorrect because
there was no loop until no accept(,').
diff --git a/cc1/decl.c b/cc1/decl.c
index bb12e81..9e6a2de 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -363,11 +363,15 @@ return_type:
static void
initializer(Symbol *sym)
{
- Type *tp = sym->type;
Node *np;
if (accept('{')) {
- initializer(sym);
+ do {
+ if (yytoken == '}')
+ break;
+ initializer(sym);
+ } while (accept(',');
+
expect('}');
return;
}
@@ -376,7 +380,6 @@ initializer(Symbol *sym)
emit(OEXPR, assignop(OINIT, varnode(sym), np));
return;
}
- return;
}
static Symbol *