shithub: scc

Download patch

ref: 8a27598f9263fb27d738694e6ad87bf37b7f09f3
parent: c0384f10ac950085bdb5b6f2a5650b3421636d9b
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Dec 13 12:34:11 EST 2016

[cc1] Remove lazy printout of types

Types were printed when was needed, when some variable related
to it was printed. This was a really bad idea because it was
generating a disorder in how the types were printed, and in
some cases global types were printed in the body of a function,
being deleted in flushtypes().

--- a/cc1/arch/amd64-sysv/arch.c
+++ b/cc1/arch/amd64-sysv/arch.c
@@ -33,12 +33,11 @@
 	{       /* 0 = voidtype */
 		.op = VOID,
 		.letter = L_VOID,
-		.prop = TPRINTED,
 	},
 	{       /* 1 = pvoidtype */
 		.op = PTR,
 		.letter = L_POINTER,
-		.prop = TPRINTED | TDEFINED,
+		.prop = TDEFINED,
 		.size = 8,
 		.align = 8,
 	},
@@ -45,7 +44,7 @@
 	{      /* 2 = booltype */
 		.op = INT,
 		.letter = L_BOOL,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_BOOL,
@@ -53,7 +52,7 @@
 	{       /* 3 = schartype */
 		.op = INT,
 		.letter = L_INT8,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_SCHAR,
@@ -61,7 +60,7 @@
 	{      /* 4 = uchartype */
 		.op = INT,
 		.letter = L_UINT8,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_UCHAR,
@@ -69,7 +68,7 @@
 	{      /* 5 = chartype */
 		.op = INT,
 		.letter = L_INT8,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_CHAR,
@@ -77,7 +76,7 @@
 	{       /* 6 = ushortype */
 		.op = INT,
 		.letter = L_UINT16,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 2,
 		.align = 2,
 		.n.rank = RANK_USHORT,
@@ -85,7 +84,7 @@
 	{       /* 7 = shortype */
 		.op = INT,
 		.letter = L_INT16,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 2,
 		.align = 2,
 		.n.rank = RANK_SHORT,
@@ -93,7 +92,7 @@
 	{       /* 8 = uinttype */
 		.op = INT,
 		.letter = L_UINT32,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 4,
 		.align = 4,
 		.n.rank = RANK_UINT,
@@ -101,7 +100,7 @@
 	{       /* 9 = inttype */
 		.op = INT,
 		.letter = L_INT32,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 4,
 		.align = 4,
 		.n.rank = RANK_INT,
@@ -109,7 +108,7 @@
 	{      /* 10 = longtype */
 		.op = INT,
 		.letter = L_INT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 8,
 		.align = 8,
 		.n.rank = RANK_LONG,
@@ -117,7 +116,7 @@
 	{       /* 11 = ulongtype */
 		.op = INT,
 		.letter = L_UINT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 8,
 		.align = 8,
 		.n.rank = RANK_ULONG,
@@ -125,7 +124,7 @@
 	{	/* 12 = ullongtype */
 		.op = INT,
 		.letter = L_UINT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 8,
 		.align = 8,
 		.n.rank = RANK_ULLONG,
@@ -133,7 +132,7 @@
 	{       /* 13 = llongtype */
 		.op = INT,
 		.letter = L_INT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 8,
 		.align = 8,
 		.n.rank = RANK_LLONG,
@@ -141,7 +140,7 @@
 	{       /* 14 = floattype */
 		.op = FLOAT,
 		.letter = L_FLOAT,
-		.prop = TDEFINED | TARITH | TPRINTED,
+		.prop = TDEFINED | TARITH,
 		.size = 4,
 		.align = 4,
 		.n.rank = RANK_FLOAT,
@@ -149,7 +148,7 @@
 	{       /* 15 = doubletype */
 		.op = FLOAT,
 		.letter = L_DOUBLE,
-		.prop = TDEFINED | TARITH | TPRINTED,
+		.prop = TDEFINED | TARITH,
 		.size = 8,
 		.align = 8,
 		.n.rank = RANK_DOUBLE,
@@ -157,7 +156,7 @@
 	{       /* 16 = ldoubletype */
 		.op = FLOAT,
 		.letter = L_LDOUBLE,
-		.prop = TDEFINED | TARITH | TPRINTED,
+		.prop = TDEFINED | TARITH,
 		.size = 16,
 		.align = 16,
 		.n.rank = RANK_LDOUBLE,
@@ -165,7 +164,7 @@
 	{       /* 17 = sizettype */
 		.op = INT,
 		.letter = L_UINT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 8,
 		.align = 8,
 		.n.rank = RANK_UINT,
@@ -173,12 +172,12 @@
 	{      /* 18 = ellipsis */
 		.op = ELLIPSIS,
 		.letter = L_ELLIPSIS,
-		.prop = TDEFINED | TPRINTED,
+		.prop = TDEFINED,
 	},
 	{      /* 19 = pdifftype */
 		.op = INT,
 		.letter = L_INT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 8,
 		.align = 8,
 		.n.rank = RANK_LONG,
--- a/cc1/arch/i386-sysv/arch.c
+++ b/cc1/arch/i386-sysv/arch.c
@@ -32,12 +32,11 @@
 	{       /* 0 = voidtype */
 		.op = VOID,
 		.letter = L_VOID,
-		.prop = TPRINTED,
 	},
 	{       /* 1 = pvoidtype */
 		.op = PTR,
 		.letter = L_POINTER,
-		.prop = TDEFINED | TPRINTED,
+		.prop = TDEFINED,
 		.size = 4,
 		.align = 4,
 	},
@@ -44,7 +43,7 @@
 	{      /* 2 = booltype */
 		.op = INT,
 		.letter = L_BOOL,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_BOOL,
@@ -52,7 +51,7 @@
 	{       /* 3 = schartype */
 		.op = INT,
 		.letter = L_INT8,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_SCHAR,
@@ -60,7 +59,7 @@
 	{      /* 4 = uchartype */
 		.op = INT,
 		.letter = L_UINT8,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_UCHAR,
@@ -68,7 +67,7 @@
 	{      /* 5 = chartype */
 		.op = INT,
 		.letter = L_INT8,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_CHAR,
@@ -76,7 +75,7 @@
 	{       /* 6 = ushortype */
 		.op = INT,
 		.letter = L_UINT16,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 2,
 		.align = 2,
 		.n.rank = RANK_USHORT,
@@ -84,7 +83,7 @@
 	{       /* 7 = shortype */
 		.op = INT,
 		.letter = L_INT16,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 2,
 		.align = 2,
 		.n.rank = RANK_SHORT,
@@ -92,7 +91,7 @@
 	{       /* 8 = uinttype */
 		.op = INT,
 		.letter = L_UINT32,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 4,
 		.align = 4,
 		.n.rank = RANK_UINT,
@@ -100,7 +99,7 @@
 	{       /* 9 = inttype */
 		.op = INT,
 		.letter = L_INT32,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 4,
 		.align = 4,
 		.n.rank = RANK_INT,
@@ -108,7 +107,7 @@
 	{      /* 10 = longtype */
 		.op = INT,
 		.letter = L_INT32,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 4,
 		.align = 4,
 		.n.rank = RANK_LONG,
@@ -116,7 +115,7 @@
 	{       /* 11 = ulongtype */
 		.op = INT,
 		.letter = L_UINT32,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 4,
 		.align = 4,
 		.n.rank = RANK_ULONG,
@@ -124,7 +123,7 @@
 	{	/* 12 = ullongtype */
 		.op = INT,
 		.letter = L_UINT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 8,
 		.align = 4,
 		.n.rank = RANK_ULLONG,
@@ -132,7 +131,7 @@
 	{       /* 13 = llongtype */
 		.op = INT,
 		.letter = L_INT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 8,
 		.align = 4,
 		.n.rank = RANK_LLONG,
@@ -140,7 +139,7 @@
 	{       /* 14 = floattype */
 		.op = FLOAT,
 		.letter = L_FLOAT,
-		.prop = TDEFINED | TARITH | TPRINTED,
+		.prop = TDEFINED | TARITH,
 		.size = 4,
 		.align = 4,
 		.n.rank = RANK_FLOAT,
@@ -148,7 +147,7 @@
 	{       /* 15 = doubletype */
 		.op = FLOAT,
 		.letter = L_DOUBLE,
-		.prop = TDEFINED | TARITH | TPRINTED,
+		.prop = TDEFINED | TARITH,
 		.size = 8,
 		.align = 4,
 		.n.rank = RANK_DOUBLE,
@@ -156,7 +155,7 @@
 	{       /* 16 = ldoubletype */
 		.op = FLOAT,
 		.letter = L_LDOUBLE,
-		.prop = TDEFINED | TARITH | TPRINTED,
+		.prop = TDEFINED | TARITH,
 		.size = 12,
 		.align = 4,
 		.n.rank = RANK_LDOUBLE,
@@ -164,7 +163,7 @@
 	{       /* 17 = sizettype */
 		.op = INT,
 		.letter = L_UINT32,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 4,
 		.align = 4,
 		.n.rank = RANK_UINT,
@@ -172,12 +171,12 @@
 	{      /* 18 = ellipsis */
 		.op = ELLIPSIS,
 		.letter = L_ELLIPSIS,
-		.prop = TDEFINED | TPRINTED,
+		.prop = TDEFINED,
 	},
 	{       /* 19 = pdifftype */
 		.op = INT,
 		.letter = L_INT32,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 4,
 		.align = 4,
 		.n.rank = RANK_INT,
--- a/cc1/arch/qbe/arch.c
+++ b/cc1/arch/qbe/arch.c
@@ -33,12 +33,11 @@
 	{       /* 0 = voidtype */
 		.op = VOID,
 		.letter = L_VOID,
-		.prop = TPRINTED,
 	},
 	{       /* 1 = pvoidtype */
 		.op = PTR,
 		.letter = L_POINTER,
-		.prop = TDEFINED | TPRINTED,
+		.prop = TDEFINED,
 		.size = 8,
 		.align = 8,
 	},
@@ -45,7 +44,7 @@
 	{      /* 2 = booltype */
 		.op = INT,
 		.letter = L_BOOL,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_BOOL,
@@ -53,7 +52,7 @@
 	{       /* 3 = schartype */
 		.op = INT,
 		.letter = L_INT8,
-		.prop = TDEFINED | TINTEGER | TARITH | SIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | SIGNED,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_SCHAR,
@@ -61,7 +60,7 @@
 	{      /* 4 = uchartype */
 		.op = INT,
 		.letter = L_UINT8,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_UCHAR,
@@ -69,7 +68,7 @@
 	{      /* 5 = chartype */
 		.op = INT,
 		.letter = L_INT8,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_CHAR,
@@ -77,7 +76,7 @@
 	{       /* 6 = ushortype */
 		.op = INT,
 		.letter = L_UINT16,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 2,
 		.align = 2,
 		.n.rank = RANK_USHORT,
@@ -85,7 +84,7 @@
 	{       /* 7 = shortype */
 		.op = INT,
 		.letter = L_INT16,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 2,
 		.align = 2,
 		.n.rank = RANK_SHORT,
@@ -93,7 +92,7 @@
 	{       /* 8 = uinttype */
 		.op = INT,
 		.letter = L_UINT32,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 4,
 		.align = 4,
 		.n.rank = RANK_UINT,
@@ -101,7 +100,7 @@
 	{       /* 9 = inttype */
 		.op = INT,
 		.letter = L_INT32,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 4,
 		.align = 4,
 		.n.rank = RANK_INT,
@@ -109,7 +108,7 @@
 	{      /* 10 = longtype */
 		.op = INT,
 		.letter = L_INT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 8,
 		.align = 8,
 		.n.rank = RANK_LONG,
@@ -117,7 +116,7 @@
 	{       /* 11 = ulongtype */
 		.op = INT,
 		.letter = L_UINT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 8,
 		.align = 8,
 		.n.rank = RANK_ULONG,
@@ -125,7 +124,7 @@
 	{	/* 12 = ullongtype */
 		.op = INT,
 		.letter = L_UINT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 8,
 		.align = 8,
 		.n.rank = RANK_ULLONG,
@@ -133,7 +132,7 @@
 	{       /* 13 = llongtype */
 		.op = INT,
 		.letter = L_INT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 8,
 		.align = 8,
 		.n.rank = RANK_LLONG,
@@ -141,7 +140,7 @@
 	{       /* 14 = floattype */
 		.op = FLOAT,
 		.letter = L_FLOAT,
-		.prop = TDEFINED | TARITH | TPRINTED,
+		.prop = TDEFINED | TARITH,
 		.size = 4,
 		.align = 4,
 		.n.rank = RANK_FLOAT,
@@ -149,7 +148,7 @@
 	{       /* 15 = doubletype */
 		.op = FLOAT,
 		.letter = L_DOUBLE,
-		.prop = TDEFINED | TARITH | TPRINTED,
+		.prop = TDEFINED | TARITH,
 		.size = 8,
 		.align = 8,
 		.n.rank = RANK_DOUBLE,
@@ -157,7 +156,7 @@
 	{       /* 16 = ldoubletype */
 		.op = FLOAT,
 		.letter = L_LDOUBLE,
-		.prop = TDEFINED | TARITH | TPRINTED,
+		.prop = TDEFINED | TARITH,
 		.size = 16,
 		.align = 16,
 		.n.rank = RANK_LDOUBLE,
@@ -165,7 +164,7 @@
 	{       /* 17 = sizettype */
 		.op = INT,
 		.letter = L_UINT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 8,
 		.align = 8,
 		.n.rank = RANK_UINT,
@@ -173,12 +172,12 @@
 	{      /* 18 = ellipsis */
 		.op = ELLIPSIS,
 		.letter = L_ELLIPSIS,
-		.prop = TDEFINED | TPRINTED,
+		.prop = TDEFINED,
 	},
 	{      /* 19 = pdifftype */
 		.op = INT,
 		.letter = L_INT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 8,
 		.align = 8,
 		.n.rank = RANK_LONG,
--- a/cc1/arch/z80/arch.c
+++ b/cc1/arch/z80/arch.c
@@ -33,12 +33,11 @@
 	{       /* 0 = voidtype */
 		.op = VOID,
 		.letter = L_VOID,
-		.prop = TPRINTED,
 	},
 	{       /* 1 = pvoidtype */
 		.op = PTR,
 		.letter = L_POINTER,
-		.prop = TDEFINED | TPRINTED,
+		.prop = TDEFINED,
 		.size = 2,
 		.align = 2,
 	},
@@ -45,7 +44,7 @@
 	{      /* 2 = booltype */
 		.op = INT,
 		.letter = L_BOOL,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_BOOL,
@@ -53,7 +52,7 @@
 	{       /* 3 = schartype */
 		.op = INT,
 		.letter = L_INT8,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_SCHAR,
@@ -61,7 +60,7 @@
 	{      /* 4 = uchartype */
 		.op = INT,
 		.letter = L_UINT8,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_UCHAR,
@@ -69,7 +68,7 @@
 	{      /* 5 = chartype */
 		.op = INT,
 		.letter = L_UINT8,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 1,
 		.align = 1,
 		.n.rank = RANK_CHAR,
@@ -77,7 +76,7 @@
 	{       /* 6 = ushortype */
 		.op = INT,
 		.letter = L_UINT16,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 2,
 		.align = 1,
 		.n.rank = RANK_USHORT,
@@ -85,7 +84,7 @@
 	{       /* 7 = shortype */
 		.op = INT,
 		.letter = L_INT16,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 2,
 		.align = 1,
 		.n.rank = RANK_SHORT,
@@ -93,7 +92,7 @@
 	{       /* 8 = uinttype */
 		.op = INT,
 		.letter = L_UINT16,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 2,
 		.align = 1,
 		.n.rank = RANK_UINT,
@@ -101,7 +100,7 @@
 	{       /* 9 = inttype */
 		.op = INT,
 		.letter = L_INT16,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 2,
 		.align = 1,
 		.n.rank = RANK_INT,
@@ -109,7 +108,7 @@
 	{      /* 10 = longtype */
 		.op = INT,
 		.letter = L_INT32,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 4,
 		.align = 1,
 		.n.rank = RANK_LONG,
@@ -117,7 +116,7 @@
 	{       /* 11 = ulongtype */
 		.op = INT,
 		.letter = L_UINT32,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 4,
 		.align = 1,
 		.n.rank = RANK_ULONG,
@@ -125,7 +124,7 @@
 	{	/* 12 = ullongtype */
 		.op = INT,
 		.letter = L_UINT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 8,
 		.align = 1,
 		.n.rank = RANK_ULLONG,
@@ -133,7 +132,7 @@
 	{       /* 13 = llongtype */
 		.op = INT,
 		.letter = L_INT64,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 8,
 		.align = 1,
 		.n.rank = RANK_LLONG,
@@ -141,7 +140,7 @@
 	{       /* 14 = floattype */
 		.op = FLOAT,
 		.letter = L_FLOAT,
-		.prop = TDEFINED | TARITH | TPRINTED,
+		.prop = TDEFINED | TARITH,
 		.size = 4,
 		.align = 1,
 		.n.rank = RANK_FLOAT,
@@ -149,7 +148,7 @@
 	{       /* 15 = doubletype */
 		.op = FLOAT,
 		.letter = L_DOUBLE,
-		.prop = TDEFINED | TARITH | TPRINTED,
+		.prop = TDEFINED | TARITH,
 		.size = 8,
 		.align = 1,
 		.n.rank = RANK_DOUBLE,
@@ -157,7 +156,7 @@
 	{       /* 16 = ldoubletype */
 		.op = FLOAT,
 		.letter = L_LDOUBLE,
-		.prop = TDEFINED | TARITH | TPRINTED,
+		.prop = TDEFINED | TARITH,
 		.size = 16,
 		.align = 1,
 		.n.rank = RANK_LDOUBLE,
@@ -165,7 +164,7 @@
 	{       /* 17 = sizettype */
 		.op = INT,
 		.letter = L_UINT16,
-		.prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH,
 		.size = 2,
 		.align = 1,
 		.n.rank = RANK_UINT,
@@ -173,12 +172,12 @@
 	{      /* 18 = ellipsis */
 		.op = ELLIPSIS,
 		.letter = L_ELLIPSIS,
-		.prop = TDEFINED | TPRINTED,
+		.prop = TDEFINED,
 	},
 	{       /* 7 = pdifftype */
 		.op = INT,
 		.letter = L_INT16,
-		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED | TPRINTED,
+		.prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
 		.size = 2,
 		.align = 1,
 		.n.rank = RANK_SHORT,
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -13,11 +13,10 @@
 enum typeprops {
 	TDEFINED = 1 << 0,    /* type defined */
 	TSIGNED  = 1 << 1,    /* signedness of the type */
-	TPRINTED = 1 << 2,    /* the type was already printed */
-	TINTEGER = 1 << 3,    /* the type is INT of enum */
-	TARITH   = 1 << 4,    /* the type is INT, ENUM or FLOAT */
-	TAGGREG  = 1 << 5,    /* the type is struct or union */
-	TK_R     = 1 << 6,    /* this is a K&R-function */
+	TINTEGER = 1 << 2,    /* the type is INT of enum */
+	TARITH   = 1 << 3,    /* the type is INT, ENUM or FLOAT */
+	TAGGREG  = 1 << 4,    /* the type is struct or union */
+	TK_R     = 1 << 5,    /* this is a K&R-function */
 };
 
 /* data type letters */
@@ -246,7 +245,8 @@
 	ODECL,
 	OBSWITCH,
 	OESWITCH,
-	OINIT
+	OINIT,
+	OTYP,
 };
 
 /*
--- a/cc1/code.c
+++ b/cc1/code.c
@@ -16,7 +16,8 @@
             emittext(unsigned, void *),
             emitfun(unsigned, void *),
             emitdcl(unsigned, void *),
-            emitinit(unsigned, void *);
+            emitinit(unsigned, void *),
+            emittype(unsigned, void *);
 
 char *optxt[] = {
 	[OADD] = "+",
@@ -132,7 +133,8 @@
 	[OESWITCH] = emitsymid,
 	[OPAR] = emitbin,
 	[OCALL] = emitbin,
-	[OINIT] = emitinit
+	[OINIT] = emitinit,
+	[OTYP] = emittype,
 };
 
 void
@@ -236,19 +238,18 @@
 }
 
 static void
-emittype(Type *tp)
+emittype(unsigned op, void *arg)
 {
 	TINT n;
 	Symbol **sp;
 	char *tag;
+	Type *tp = arg;
 
-	if ((tp->prop & TPRINTED) || !(tp->prop & TDEFINED))
+	if (!(tp->prop & TDEFINED))
 		return;
-	tp->prop |= TPRINTED;
 
 	switch (tp->op) {
 	case ARY:
-		emittype(tp->type);
 		emitletter(tp);
 		putchar('\t');
 		emitletter(tp->type);
@@ -255,14 +256,8 @@
 		printf("\t#%c%llX\n",
 		       sizettype->letter, (long long) tp->n.elem);
 		return;
-	case PTR:
-		emittype(tp->type);
-		return;
 	case UNION:
 	case STRUCT:
-		n = tp->n.elem;
-		for (sp = tp->p.fields; n-- > 0; ++sp)
-			emittype((*sp)->type);
 		emitletter(tp);
 		tag = tp->tag->name;
 		printf("\t\"%s\t#%c%lX\t#%c%X\n",
@@ -275,6 +270,7 @@
 		for (sp = tp->p.fields; n-- > 0; ++sp)
 			emit(ODECL, *sp);
 		break;
+	case PTR:
 	case FTN:
 		return;
 	default:
@@ -377,7 +373,6 @@
 
 	if (sym->flags & SEMITTED)
 		return;
-	emittype(sym->type);
 	emitvar(sym);
 	putchar('\t');
 	if (sym->type->op == FTN) {
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -533,6 +533,7 @@
 	--nested;
 
 	typesize(tp);
+	emit(OTYP, tp);
 	namespace = ns;
 	expect('}');
 	return tp;
@@ -555,6 +556,7 @@
 	if (tp->prop & TDEFINED)
 		errorp("redefinition of enumeration '%s'", tagsym->name);
 	tp->prop |= TDEFINED;
+	emit(OTYP, tp);
 	typesize(tp);
 	namespace = NS_IDEN;
 
--- a/cc1/types.c
+++ b/cc1/types.c
@@ -308,7 +308,7 @@
 		break;
 	case ENUM:
 		type.letter = inttype->letter;
-		type.prop |= TPRINTED | TINTEGER | TARITH;
+		type.prop |= TINTEGER | TARITH;
 		type.n.rank = inttype->n.rank;
 		goto create_type;
 	case STRUCT: