[hackers] [scc] Avoid initiliazers in functions || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 10 Sep 2015 22:57:32 +0200 (CEST)

commit 238917d95a6b7e0d4b36bd7712657cb93bc1694e
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Sep 10 22:53:50 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
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
_AT_@ -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 {
Received on Thu Sep 10 2015 - 22:57:32 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 10 2015 - 23:00:18 CEST