shithub: scc

Download patch

ref: 15b5db8b6c5c767cf9c538f3cdafa8926b4b7430
parent: 542b9640930da321fa75bc470c03274bd274fb21
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Oct 9 18:35:30 EDT 2013

Some changes in function names

We were calling struct_spec to the function called from spec, but we
were calling union_dcl to the similar function for unions, and it was
confusing, because struct_dcl was the function where struct fields
were defined. This patch change struct_dcl to field_dcl, and struct_spec
to struct_dcl, so the code is more clever now.

--- a/decl.c
+++ b/decl.c
@@ -101,10 +101,10 @@
 	tp->sym = sym;
 }
 
-static struct ctype * spec(void);
+static struct ctype *spec(void);
 
 static struct ctype *
-struct_dcl(unsigned char ns)
+field_dcl(unsigned char ns)
 {
 	register struct ctype *tp, *base;
 
@@ -141,7 +141,7 @@
 }
 
 static struct ctype *
-struct_spec(register struct ctype *tp)
+struct_dcl(register struct ctype *tp)
 {
 	new_struct(tp);
 
@@ -151,7 +151,7 @@
 		error("struct/union already defined");
 
 	do
-		struct_dcl(tp->ns);
+		field_dcl(tp->ns);
 	while (!accept('}'));
 
 	tp->forward = 0;
@@ -214,7 +214,7 @@
 		case STRUCT:   case UNION:
 			tp = btype(tp, yytoken);
 			next();
-			return struct_spec(tp);
+			return struct_dcl(tp);
 		case IDEN:
 			if (!tp || !tp->type) {
 				struct symbol *sym;