shithub: scc

Download patch

ref: bd3704ba7221b1432934c82a3ec6181849d8ebd8
parent: d27d299ee050ee5a26d277cbf9839a7d3eb2fb14
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Aug 8 13:05:40 EDT 2015

Mark auto as invalid storage class for parameters

The only valid storage class for a parameter is register.

--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -69,10 +69,10 @@
 		error("incorrect function type for a function parameter");
 	if (tp->op == ARY)
 		tp = mktype(tp->type, PTR, 0, NULL);
+	if (sym->flags & (ISSTATIC|ISEXTERN|ISAUTO))
+		error("bad storage class in function parameter");
 	if (!sclass)
 		sym->flags |= ISAUTO;
-	if (sym->flags & (ISSTATIC|ISEXTERN))
-		error("bad storage class in function parameter");
 	if (n++ == NR_FUNPARAM)
 		error("too much parameters in function definition");
 	funtp->pars = xrealloc(funtp->pars, n * sizeof(Type *));