scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit bd3704ba7221b1432934c82a3ec6181849d8ebd8
parent d27d299ee050ee5a26d277cbf9839a7d3eb2fb14
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat,  8 Aug 2015 17:05:40 +0200

Mark auto as invalid storage class for parameters

The only valid storage class for a parameter is register.

Diffstat:
Mcc1/decl.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 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 *));