shithub: scc

Download patch

ref: a47da4831e6000e825decbeb876cfc604082d41f
parent: 051206f55c018f7f9b7660cb444c554f568df348
author: Roberto E. Vargas Caballero <[email protected]>
date: Sun Nov 16 01:13:26 EST 2014

Undefined structs at the end of the context

Types are never deleted, because it is expensive delete them, and usually
they have file scope. This approach has a problem with structures, because
it means that a structure type is always defined even when the original
type is no longer valid.

--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -40,6 +40,8 @@
 			break;
 		if (ns == NS_LABEL && !sym->s.isdefined)
 			error("label '%s' is not defined", sym->name);
+		if (ns == NS_TAG)
+			sym->type->defined = 0;
 		tbl->htab[hash(sym->name)] = sym->hash;
 		next = tbl->head = sym->next;
 		free(sym->name);