shithub: scc

Download patch

ref: 8f51e18e15eac2e434a0f51cf788d3b6b621566c
parent: 6a8265d1262a3c63665f78a29d59d84387e8f68a
author: Roberto E. Vargas Caballero <[email protected]>
date: Sat Aug 8 08:07:25 EDT 2015

Fix check of storage validity in functions

Symbols have not yet the storage flags in declarator(),
so the correct point where do this validation is in
dodcl() after setting the flags.

--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -202,8 +202,6 @@
 	}
 
 	sym->u.pars = pars;
-	if (tp->op == FTN && sym->flags & (ISREGISTER|ISAUTO))
-		error("invalid storage class for function '%s'", sym->name);
 
 	/* TODO: deal with external array declarations of []  */
 	if (!tp->defined && sym->name)
@@ -528,6 +526,10 @@
 		case TYPEDEF:
 			sym->token = TYPEIDEN;
 			break;
+		}
+		if (tp->op == FTN && (sym->flags & (ISREGISTER|ISAUTO))) {
+			error("invalid storage class for function '%s'",
+			      sym->name);
 		}
 		(*fun)(sym, sclass, type);
 	} while (rep && !curfun && accept(','));