commit bd3704ba7221b1432934c82a3ec6181849d8ebd8
Author: Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Sat Aug 8 17:05:40 2015 +0200
Commit: Roberto E. Vargas Caballero <[email protected]>
CommitDate: Sat Aug 8 17:05:40 2015 +0200
Mark auto as invalid storage class for parameters
The only valid storage class for a parameter is register.
diff --git a/cc1/decl.c b/cc1/decl.c
index 3ea8de2..227848a 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -69,10 +69,10 @@ parameter(Symbol *sym, int sclass, Type *data)
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 *));