[hackers] [scc] Fix grammar of aggregate initializers || Roberto E. Vargas Caballero
commit 3939d91c2494e9de10f4f7e8a692544416c5f021
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Sep 8 22:36:19 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
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
_AT_@ -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;
}
_AT_@ -376,7 +380,6 @@ initializer(Symbol *sym)
emit(OEXPR, assignop(OINIT, varnode(sym), np));
return;
}
- return;
}
static Symbol *
Received on Tue Sep 08 2015 - 22:37:33 CEST
This archive was generated by hypermail 2.3.0
: Tue Sep 08 2015 - 22:48:10 CEST