shithub: scc

Download patch

ref: 7aa7271a9ad01e7368fffa0c5d7426e86a696dcb
parent: 1c72bb640a82a82459a4224efeea82fde5faa22b
author: Roberto E. Vargas Caballero <[email protected]>
date: Sun Nov 16 01:27:22 EST 2014

Make symbols defined by default

The common case is define symbols defined, except in the case of
labels and in extern. This patch makes symbols defined by default.

--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -414,7 +414,6 @@
 
 	do {
 		sym = declarator(tp, ID_EXPECTED, NS_IDEN);
-		sym->s.isdefined = 1;
 		isfun = sym->type->op == FTN;
 
 		switch (sclass) {
@@ -484,7 +483,6 @@
 			tp = sym->type;
 			sym->s.isstatic = 1;
 			sym->s.isglobal= 1;
-			sym->s.isdefined = 1;
 
 			switch (sclass) {
 			case REGISTER: case AUTO:
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -90,7 +90,7 @@
 	sym->ctx = curctx;
 	sym->token = IDEN;
 	sym->id = (curctx) ? ++localcnt : ++globalcnt;
-	sym->s.isdefined = 0;
+	sym->s.isdefined = 1;
 	sym->ns = ns;
 	tbl = &symtab[(ns > NS_STRUCTS) ? NS_STRUCTS : ns];
 	sym->next = tbl->head;