shithub: scc

Download patch

ref: 238917d95a6b7e0d4b36bd7712657cb93bc1694e
parent: e58e000f02f4ed8c9655eb587cc6f817b84af1f1
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Sep 10 18:53:50 EDT 2015

Avoid initiliazers in functions

--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -985,7 +985,19 @@
 {
 	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 {