shithub: scc

Download patch

ref: 51cf75b9b31e81acf9570ab07cc59fe95408816f
parent: b86fdca96b49c9000d32995a427f2ac8fad4ef6a
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Jul 24 14:55:23 EDT 2015

Don't install tags that are already installed

The code was installing all the tags it found, even in the cases
the tag was already installed, creating wrong symbols without
type.

--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -303,7 +303,8 @@
 	case IDEN:
 	case TYPEIDEN:
 		sym = yylval.sym;
-		install(NS_TAG);
+		if ((sym->flags & ISDEFINED) == 0)
+			install(NS_TAG);
 		next();
 		break;
 	default:
@@ -317,7 +318,6 @@
 		sym->type->ns = ns++;
 	}
 
-	sym->flags |= ISDEFINED;
 	if ((op = sym->type->op) != tag &&  op != INT)
 		error("'%s' defined as wrong kind of tag", sym->name);
 	return sym;