shithub: scc

Download patch

ref: cdd649037ff739763ef976d4ca707ec021f24401
parent: e703cf33b768fa08ab5b26ca5f85eba756212088
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Aug 4 13:26:29 EDT 2015

Remove STRUCT emit() operators

These operators must be removed because they must be emited
in emittype(), like all the other types.

--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -260,12 +260,10 @@
 	OLABEL,
 	ODEFAULT,
 	OCASE,
-	OSTRUCT,
 	OJUMP,
 	OBRANCH,
 	OEXPR,
 	OEFUN,
-	OESTRUCT,
 	OELOOP,
 	OBLOOP,
 	OFUN,
--- a/cc1/code.c
+++ b/cc1/code.c
@@ -56,11 +56,9 @@
 	[OLABEL] = "L%d\n",
 	[ODEFAULT] = "\tf\tL%d\n",
 	[OCASE] = "\tw\tL%d",
-	[OSTRUCT] = "S%d\t(\n",
 	[OJUMP] = "\tj\tL%d\n",
 	[OBRANCH] = "\tj\tL%d",
 	[OEFUN] = "}",
-	[OESTRUCT] = ")",
 	[OELOOP] = "\tb",
 	[OBLOOP] = "\td"
 };
@@ -111,11 +109,9 @@
 	[OLABEL] = emitsymid,
 	[ODEFAULT] = emitsymid,
 	[OCASE] = emitsymid,
-	[OSTRUCT] = emitsymid,
 	[OJUMP] = emitsymid,
 	[OBRANCH] = emitsymid,
 	[OEFUN] = emittext,
-	[OESTRUCT] = emittext,
 	[OELOOP] = emittext,
 	[OBLOOP] = emittext,
 	[OFUN] = emitfun,
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -342,7 +342,6 @@
 	if (tagtype->defined)
 		error("redefinition of struct/union '%s'", yytext);
 	tagtype->defined = 1;
-	emit(OSTRUCT, tagsym);
 
 	while (!accept('}')) {
 		Type *base, *tp;
@@ -378,7 +377,6 @@
 		expect(';');
 	}
 
-	emit(OESTRUCT, NULL);
 	if ((n = bp - buff) != 0) {
 		siz = sizeof(Type *) * n;
 		tagtype->n.elem = n;