commit 465a3c169b168fec1da5e95ede3cbdb7c71fd83e
parent f87b1cd627c937f65d162f7450ed366b955bc6d7
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 13 Jul 2017 18:35:20 +0200
[cc1] Allow non constant initializers in scalar vars
They aren't a problem, aggregate variables are the problem
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/cc1/init.c b/cc1/init.c
@@ -296,18 +296,20 @@ autoinit(Symbol *sym, Node *np)
Type *tp = sym->type;
size_t n; /* FIXME: It should be SIZET */
- if (!(np->flags & NCONST))
- abort(); /* TODO: Implement not constant initializers */
repeat:
switch (tp->op) {
case UNION:
+ if (!(np->flags & NCONST))
+ abort(); /* TODO */
n = tp->n.elem-1;
tp = tp->p.fields[n]->type;
np = np->sym->u.init[n];
goto repeat;
case ARY:
case STRUCT:
+ if (!(np->flags & NCONST))
+ abort(); /* TODO */
hidden = newsym(NS_IDEN, NULL);
hidden->type = sym->type;
hidden->flags |= SLOCAL | SHASINIT;