scc

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

commit 0e78d39ed924847e4e78662581c43ffdbe0d1ef4
parent 047f9b79d1942d292ee3718858be7c6fb1002320
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 22 Jul 2015 08:58:12 +0200

Fix declaration of structs, unions and enums

Another specifiers are not allowed after a struct/unions/enums

Diffstat:
Mcc1/decl.c | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/cc1/decl.c b/cc1/decl.c @@ -216,11 +216,13 @@ specifier(unsigned *sclass) switch (yylval.token) { case ENUM: dcl = enumdcl; - p = &type; break; + p = &type; + break; case STRUCT: case UNION: dcl = structdcl; - p = &type; break; + p = &type; + break; case VOID: case BOOL: case CHAR: @@ -231,7 +233,8 @@ specifier(unsigned *sclass) break; case SIGNED: case UNSIGNED: - p = &sign; break; + p = &sign; + break; case LONG: if (size == LONG) { size = LLONG; @@ -252,6 +255,7 @@ specifier(unsigned *sclass) if (size || sign) goto invalid_type; tp = (*dcl)(); + goto return_type; } else { next(); }