scc

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

commit 238917d95a6b7e0d4b36bd7712657cb93bc1694e
parent e58e000f02f4ed8c9655eb587cc6f817b84af1f1
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 10 Sep 2015 22:53:50 +0200

Avoid initiliazers in functions

Diffstat:
Mcc1/expr.c | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/cc1/expr.c b/cc1/expr.c @@ -985,7 +985,19 @@ initializer(Symbol *sym) { Node *np; Type *tp = sym->type; - int flags = sym->flags; + int flags = sym->flags, scalar; + + switch (tp->op) { + case FTN: + error("function '%s' is initialized like a variable", sym->name); + case PTR: + case INT: + scalar = 1; + break; + default: + scalar = 0; + break; + } if (accept('{')) { do {