shithub: scc

Download patch

ref: 15cfc88a6819c09e4c93054b31c0be4d48b0aeb0
parent: cf5c3a1d54e206326de7e2a7b9e12f6c179e866e
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Jul 5 05:09:17 EDT 2013

Change c_type to c_typedef

The struct ctype has also a type variable, so it was a bit confusing
each time you write one of them know what variable was used.

--- a/decl.c
+++ b/decl.c
@@ -18,7 +18,7 @@
 {
 	register unsigned char sns, ns;
 
-	ns = tp->c_type ? NS_TYPEDEF : NS_IDEN;
+	ns = tp->c_typedef ? NS_TYPEDEF : NS_IDEN;
 	sns = yyval.sym->ns;
 
 	if (sns == NS_ANY) {     /* First appearence of the symbol */
--- a/symbol.h
+++ b/symbol.h
@@ -22,7 +22,7 @@
 
 struct ctype {
 	unsigned type : 5;
-	bool c_type : 1;
+	bool c_typedef : 1;
 	bool c_extern : 1;
 	bool c_static : 1;
 	bool c_auto : 1;
--- a/types.c
+++ b/types.c
@@ -26,7 +26,7 @@
 {
 	if (!tp)
 		return;
-	tp->c_type = 0;              /* this flag only is important in */
+	tp->c_typedef = 0;              /* this flag only is important in */
 	if (--tp->refcnt == 0) {        /* the parsing */
 		if (tp->base)
 			delctype(tp->base);
@@ -168,16 +168,16 @@
 		tp = newctype();
 	switch (mod) {
 	case TYPEDEF:
-		if (tp->c_type)
+		if (tp->c_typedef)
 			goto duplicated;
 		if (tp->c_extern | tp->c_auto | tp->c_reg | tp->c_static)
 			goto two_storage;
-		tp->c_type = 1;
+		tp->c_typedef = 1;
 		return tp;
 	case EXTERN:
 		if (tp->c_extern)
 			goto duplicated;
-		if (tp->c_type | tp->c_auto | tp->c_reg | tp->c_static)
+		if (tp->c_typedef | tp->c_auto | tp->c_reg | tp->c_static)
 			goto two_storage;
 		tp->c_extern = 1;
 		return tp;
@@ -184,7 +184,7 @@
 	case STATIC:
 		if (tp->c_static)
 			goto duplicated;
-		if (tp->c_type | tp->c_extern | tp->c_auto | tp->c_reg)
+		if (tp->c_typedef | tp->c_extern | tp->c_auto | tp->c_reg)
 			goto two_storage;
 		tp->c_static = 1;
 		return tp;
@@ -191,7 +191,7 @@
 	case AUTO:
 		if (curctx != CTX_OUTER)
 			goto bad_file_scope_storage;
-		if (tp->c_type | tp->c_extern | tp->c_static | tp->c_reg)
+		if (tp->c_typedef | tp->c_extern | tp->c_static | tp->c_reg)
 			goto two_storage;
 		if (tp->c_auto)
 			goto duplicated;
@@ -200,7 +200,7 @@
 	case REGISTER:
 		if (curctx != CTX_OUTER)
 			goto bad_file_scope_storage;
-		if (tp->c_type | tp->c_extern | tp->c_auto | tp->c_static)
+		if (tp->c_typedef | tp->c_extern | tp->c_auto | tp->c_static)
 			goto two_storage;
 		if (tp->c_reg)
 			goto duplicated;
--