shithub: scc

Download patch

ref: b0126dcc1e00f427b21754693c8d6dcbf5101e58
parent: 28af012e9746a4adacc4e2909d0cfb5e9d8e94e9
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Oct 30 04:23:30 EDT 2013

Change NS_STRUCT to NS_TAG

This is a better name for this namespace, because it is used in
the tags of struct, union and enum definitions, and it is the name
used in the standard for it.

--- a/decl.c
+++ b/decl.c
@@ -11,8 +11,8 @@
 char parser_out_home;
 
 static struct symbol *cursym;
-static unsigned char nr_structs = NS_STRUCT;
-static unsigned char nested_struct;
+static unsigned char nr_tags = NS_TAG;
+static unsigned char nested_tags;
 
 static void declarator(struct ctype *tp, unsigned char ns);
 
@@ -64,13 +64,13 @@
 	struct symbol *sym = NULL;
 
 	if (yytoken == IDEN) {
-		sym = lookup(yytext, NS_STRUCT);
+		sym = lookup(yytext, NS_TAG);
 		sym->ctype = tp;
 		next();
 	}
-	if (nr_structs == NS_STRUCT + NR_MAXSTRUCTS)
+	if (nr_tags == NS_TAG + NR_MAXSTRUCTS)
 		error("too much structs/unions/enum defined");
-	tp->ns = ++nr_structs;
+	tp->ns = ++nr_tags;
 	tp->forward = 1;
 	tp->sym = sym;
 }
@@ -117,10 +117,10 @@
 structdcl(register struct ctype *tp)
 {
 	aggregate(tp);
-	if (nested_struct == NR_STRUCT_LEVEL)
+	if (nested_tags == NR_STRUCT_LEVEL)
 		error("too much nested structs/unions");
 
-	++nested_struct;
+	++nested_tags;
 	if (!accept('{'))
 		return tp;
 	if (!tp->forward)
@@ -129,7 +129,7 @@
 	do
 		fielddcl(tp->ns);
 	while (!accept('}'));
-	--nested_struct;
+	--nested_tags;
 
 	tp->forward = 0;
 	return tp;
--- a/symbol.h
+++ b/symbol.h
@@ -14,7 +14,7 @@
 	NS_IDEN,
 	NS_KEYWORD,
 	NS_LABEL,
-	NS_STRUCT
+	NS_TAG
 };
 
 struct ctype {