commit 238917d95a6b7e0d4b36bd7712657cb93bc1694e
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Thu Sep 10 22:53:50 2015 +0200
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Thu Sep 10 22:53:50 2015 +0200

    Avoid initiliazers in functions

diff --git a/cc1/expr.c b/cc1/expr.c
index 3b92485..7c405b7 100644
--- 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 {

Reply via email to