shithub: scc

Download patch

ref: 978f166ff682be738e5374ec004e404ce58a5e16
parent: e01986d6087e1264c1865596d7fe02cadbec6296
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed Dec 14 09:56:44 EST 2016

[cc1] Add symbolic constants for dodcl()

Dodcl() has 4 parameters, and having a 0 or 1 in the first was
not clear at all. These new constants add a bit of information
about the proposal of the parameter.

--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -12,6 +12,10 @@
 
 #define NOSCLASS  0
 
+#define NOREP 0
+#define REP 1
+
+
 struct declarators {
 	unsigned char nr;
 	struct declarator {
@@ -257,7 +261,7 @@
 			*types++ = ellipsistype;
 			break;
 		}
-		if ((sym = dodcl(0, parameter, NS_IDEN, tp)) == NULL)
+		if ((sym = dodcl(NOREP, parameter, NS_IDEN, tp)) == NULL)
 			continue;
 		if (tp->n.elem == -1) {
 			n = -1;
@@ -856,7 +860,7 @@
 
 	if (accept(';'))
 		return;
-	sym = dodcl(1, identifier, NS_IDEN, NULL);
+	sym = dodcl(REP, identifier, NS_IDEN, NULL);
 
 	if (sym->type->op != FTN) {
 		expect(';');
@@ -886,7 +890,7 @@
 	}
 	if (sym->type->prop & TK_R) {
 		while (yytoken != '{') {
-			par = dodcl(1, parameter, NS_IDEN, sym->type);
+			par = dodcl(REP, parameter, NS_IDEN, sym->type);
 			expect(';');
 		}
 	}
@@ -913,7 +917,7 @@
 fieldlist(Type *tp)
 {
 	if (yytoken != ';')
-		dodcl(1, field, tp->ns, tp);
+		dodcl(REP, field, tp->ns, tp);
 	expect(';');
 }
 
@@ -920,5 +924,5 @@
 Type *
 typename(void)
 {
-	return dodcl(0, type, 0, NULL)->type;
+	return dodcl(NOREP, type, 0, NULL)->type;
 }