[hackers] [scc] [cc1] Remove lazy printout of types || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Tue, 13 Dec 2016 17:59:10 +0100 (CET)

commit 62ecef167f85476001bf9b22745b9113652077d9
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Dec 13 17:34:11 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Tue Dec 13 17:40:00 2016 +0100

    [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().

diff --git a/cc1/arch/amd64-sysv/arch.c b/cc1/arch/amd64-sysv/arch.c
index 2a257de..cdc2749 100644
--- a/cc1/arch/amd64-sysv/arch.c
+++ b/cc1/arch/amd64-sysv/arch.c
_AT_@ -33,19 +33,18 @@ static Type types[] = {
         { /* 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,
         },
         { /* 2 = booltype */
                 .op = INT,
                 .letter = L_BOOL,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 1,
                 .align = 1,
                 .n.rank = RANK_BOOL,
_AT_@ -53,7 +52,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -61,7 +60,7 @@ static Type types[] = {
         { /* 4 = uchartype */
                 .op = INT,
                 .letter = L_UINT8,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 1,
                 .align = 1,
                 .n.rank = RANK_UCHAR,
_AT_@ -69,7 +68,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -77,7 +76,7 @@ static Type types[] = {
         { /* 6 = ushortype */
                 .op = INT,
                 .letter = L_UINT16,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 2,
                 .align = 2,
                 .n.rank = RANK_USHORT,
_AT_@ -85,7 +84,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -93,7 +92,7 @@ static Type types[] = {
         { /* 8 = uinttype */
                 .op = INT,
                 .letter = L_UINT32,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 4,
                 .align = 4,
                 .n.rank = RANK_UINT,
_AT_@ -101,7 +100,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -109,7 +108,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -117,7 +116,7 @@ static Type types[] = {
         { /* 11 = ulongtype */
                 .op = INT,
                 .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 8,
                 .align = 8,
                 .n.rank = RANK_ULONG,
_AT_@ -125,7 +124,7 @@ static Type types[] = {
         { /* 12 = ullongtype */
                 .op = INT,
                 .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 8,
                 .align = 8,
                 .n.rank = RANK_ULLONG,
_AT_@ -133,7 +132,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -141,7 +140,7 @@ static Type types[] = {
         { /* 14 = floattype */
                 .op = FLOAT,
                 .letter = L_FLOAT,
- .prop = TDEFINED | TARITH | TPRINTED,
+ .prop = TDEFINED | TARITH,
                 .size = 4,
                 .align = 4,
                 .n.rank = RANK_FLOAT,
_AT_@ -149,7 +148,7 @@ static Type types[] = {
         { /* 15 = doubletype */
                 .op = FLOAT,
                 .letter = L_DOUBLE,
- .prop = TDEFINED | TARITH | TPRINTED,
+ .prop = TDEFINED | TARITH,
                 .size = 8,
                 .align = 8,
                 .n.rank = RANK_DOUBLE,
_AT_@ -157,7 +156,7 @@ static Type types[] = {
         { /* 16 = ldoubletype */
                 .op = FLOAT,
                 .letter = L_LDOUBLE,
- .prop = TDEFINED | TARITH | TPRINTED,
+ .prop = TDEFINED | TARITH,
                 .size = 16,
                 .align = 16,
                 .n.rank = RANK_LDOUBLE,
_AT_@ -165,7 +164,7 @@ static Type types[] = {
         { /* 17 = sizettype */
                 .op = INT,
                 .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 8,
                 .align = 8,
                 .n.rank = RANK_UINT,
_AT_@ -173,12 +172,12 @@ static Type types[] = {
         { /* 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,
diff --git a/cc1/arch/i386-sysv/arch.c b/cc1/arch/i386-sysv/arch.c
index 48f1da2..873189b 100644
--- a/cc1/arch/i386-sysv/arch.c
+++ b/cc1/arch/i386-sysv/arch.c
_AT_@ -32,19 +32,18 @@ static Type types[] = {
         { /* 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,
         },
         { /* 2 = booltype */
                 .op = INT,
                 .letter = L_BOOL,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 1,
                 .align = 1,
                 .n.rank = RANK_BOOL,
_AT_@ -52,7 +51,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -60,7 +59,7 @@ static Type types[] = {
         { /* 4 = uchartype */
                 .op = INT,
                 .letter = L_UINT8,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 1,
                 .align = 1,
                 .n.rank = RANK_UCHAR,
_AT_@ -68,7 +67,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -76,7 +75,7 @@ static Type types[] = {
         { /* 6 = ushortype */
                 .op = INT,
                 .letter = L_UINT16,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 2,
                 .align = 2,
                 .n.rank = RANK_USHORT,
_AT_@ -84,7 +83,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -92,7 +91,7 @@ static Type types[] = {
         { /* 8 = uinttype */
                 .op = INT,
                 .letter = L_UINT32,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 4,
                 .align = 4,
                 .n.rank = RANK_UINT,
_AT_@ -100,7 +99,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -108,7 +107,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -116,7 +115,7 @@ static Type types[] = {
         { /* 11 = ulongtype */
                 .op = INT,
                 .letter = L_UINT32,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 4,
                 .align = 4,
                 .n.rank = RANK_ULONG,
_AT_@ -124,7 +123,7 @@ static Type types[] = {
         { /* 12 = ullongtype */
                 .op = INT,
                 .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 8,
                 .align = 4,
                 .n.rank = RANK_ULLONG,
_AT_@ -132,7 +131,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -140,7 +139,7 @@ static Type types[] = {
         { /* 14 = floattype */
                 .op = FLOAT,
                 .letter = L_FLOAT,
- .prop = TDEFINED | TARITH | TPRINTED,
+ .prop = TDEFINED | TARITH,
                 .size = 4,
                 .align = 4,
                 .n.rank = RANK_FLOAT,
_AT_@ -148,7 +147,7 @@ static Type types[] = {
         { /* 15 = doubletype */
                 .op = FLOAT,
                 .letter = L_DOUBLE,
- .prop = TDEFINED | TARITH | TPRINTED,
+ .prop = TDEFINED | TARITH,
                 .size = 8,
                 .align = 4,
                 .n.rank = RANK_DOUBLE,
_AT_@ -156,7 +155,7 @@ static Type types[] = {
         { /* 16 = ldoubletype */
                 .op = FLOAT,
                 .letter = L_LDOUBLE,
- .prop = TDEFINED | TARITH | TPRINTED,
+ .prop = TDEFINED | TARITH,
                 .size = 12,
                 .align = 4,
                 .n.rank = RANK_LDOUBLE,
_AT_@ -164,7 +163,7 @@ static Type types[] = {
         { /* 17 = sizettype */
                 .op = INT,
                 .letter = L_UINT32,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 4,
                 .align = 4,
                 .n.rank = RANK_UINT,
_AT_@ -172,12 +171,12 @@ static Type types[] = {
         { /* 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,
diff --git a/cc1/arch/qbe/arch.c b/cc1/arch/qbe/arch.c
index 6891005..5319adc 100644
--- a/cc1/arch/qbe/arch.c
+++ b/cc1/arch/qbe/arch.c
_AT_@ -33,19 +33,18 @@ static Type types[] = {
         { /* 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,
         },
         { /* 2 = booltype */
                 .op = INT,
                 .letter = L_BOOL,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 1,
                 .align = 1,
                 .n.rank = RANK_BOOL,
_AT_@ -53,7 +52,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -61,7 +60,7 @@ static Type types[] = {
         { /* 4 = uchartype */
                 .op = INT,
                 .letter = L_UINT8,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 1,
                 .align = 1,
                 .n.rank = RANK_UCHAR,
_AT_@ -69,7 +68,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -77,7 +76,7 @@ static Type types[] = {
         { /* 6 = ushortype */
                 .op = INT,
                 .letter = L_UINT16,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 2,
                 .align = 2,
                 .n.rank = RANK_USHORT,
_AT_@ -85,7 +84,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -93,7 +92,7 @@ static Type types[] = {
         { /* 8 = uinttype */
                 .op = INT,
                 .letter = L_UINT32,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 4,
                 .align = 4,
                 .n.rank = RANK_UINT,
_AT_@ -101,7 +100,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -109,7 +108,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -117,7 +116,7 @@ static Type types[] = {
         { /* 11 = ulongtype */
                 .op = INT,
                 .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 8,
                 .align = 8,
                 .n.rank = RANK_ULONG,
_AT_@ -125,7 +124,7 @@ static Type types[] = {
         { /* 12 = ullongtype */
                 .op = INT,
                 .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 8,
                 .align = 8,
                 .n.rank = RANK_ULLONG,
_AT_@ -133,7 +132,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -141,7 +140,7 @@ static Type types[] = {
         { /* 14 = floattype */
                 .op = FLOAT,
                 .letter = L_FLOAT,
- .prop = TDEFINED | TARITH | TPRINTED,
+ .prop = TDEFINED | TARITH,
                 .size = 4,
                 .align = 4,
                 .n.rank = RANK_FLOAT,
_AT_@ -149,7 +148,7 @@ static Type types[] = {
         { /* 15 = doubletype */
                 .op = FLOAT,
                 .letter = L_DOUBLE,
- .prop = TDEFINED | TARITH | TPRINTED,
+ .prop = TDEFINED | TARITH,
                 .size = 8,
                 .align = 8,
                 .n.rank = RANK_DOUBLE,
_AT_@ -157,7 +156,7 @@ static Type types[] = {
         { /* 16 = ldoubletype */
                 .op = FLOAT,
                 .letter = L_LDOUBLE,
- .prop = TDEFINED | TARITH | TPRINTED,
+ .prop = TDEFINED | TARITH,
                 .size = 16,
                 .align = 16,
                 .n.rank = RANK_LDOUBLE,
_AT_@ -165,7 +164,7 @@ static Type types[] = {
         { /* 17 = sizettype */
                 .op = INT,
                 .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 8,
                 .align = 8,
                 .n.rank = RANK_UINT,
_AT_@ -173,12 +172,12 @@ static Type types[] = {
         { /* 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,
diff --git a/cc1/arch/z80/arch.c b/cc1/arch/z80/arch.c
index f41094f..d9e2038 100644
--- a/cc1/arch/z80/arch.c
+++ b/cc1/arch/z80/arch.c
_AT_@ -33,19 +33,18 @@ static Type types[] = {
         { /* 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,
         },
         { /* 2 = booltype */
                 .op = INT,
                 .letter = L_BOOL,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 1,
                 .align = 1,
                 .n.rank = RANK_BOOL,
_AT_@ -53,7 +52,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -61,7 +60,7 @@ static Type types[] = {
         { /* 4 = uchartype */
                 .op = INT,
                 .letter = L_UINT8,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 1,
                 .align = 1,
                 .n.rank = RANK_UCHAR,
_AT_@ -69,7 +68,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -77,7 +76,7 @@ static Type types[] = {
         { /* 6 = ushortype */
                 .op = INT,
                 .letter = L_UINT16,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 2,
                 .align = 1,
                 .n.rank = RANK_USHORT,
_AT_@ -85,7 +84,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -93,7 +92,7 @@ static Type types[] = {
         { /* 8 = uinttype */
                 .op = INT,
                 .letter = L_UINT16,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 2,
                 .align = 1,
                 .n.rank = RANK_UINT,
_AT_@ -101,7 +100,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -109,7 +108,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -117,7 +116,7 @@ static Type types[] = {
         { /* 11 = ulongtype */
                 .op = INT,
                 .letter = L_UINT32,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 4,
                 .align = 1,
                 .n.rank = RANK_ULONG,
_AT_@ -125,7 +124,7 @@ static Type types[] = {
         { /* 12 = ullongtype */
                 .op = INT,
                 .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 8,
                 .align = 1,
                 .n.rank = RANK_ULLONG,
_AT_@ -133,7 +132,7 @@ static Type types[] = {
         { /* 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,
_AT_@ -141,7 +140,7 @@ static Type types[] = {
         { /* 14 = floattype */
                 .op = FLOAT,
                 .letter = L_FLOAT,
- .prop = TDEFINED | TARITH | TPRINTED,
+ .prop = TDEFINED | TARITH,
                 .size = 4,
                 .align = 1,
                 .n.rank = RANK_FLOAT,
_AT_@ -149,7 +148,7 @@ static Type types[] = {
         { /* 15 = doubletype */
                 .op = FLOAT,
                 .letter = L_DOUBLE,
- .prop = TDEFINED | TARITH | TPRINTED,
+ .prop = TDEFINED | TARITH,
                 .size = 8,
                 .align = 1,
                 .n.rank = RANK_DOUBLE,
_AT_@ -157,7 +156,7 @@ static Type types[] = {
         { /* 16 = ldoubletype */
                 .op = FLOAT,
                 .letter = L_LDOUBLE,
- .prop = TDEFINED | TARITH | TPRINTED,
+ .prop = TDEFINED | TARITH,
                 .size = 16,
                 .align = 1,
                 .n.rank = RANK_LDOUBLE,
_AT_@ -165,7 +164,7 @@ static Type types[] = {
         { /* 17 = sizettype */
                 .op = INT,
                 .letter = L_UINT16,
- .prop = TDEFINED | TINTEGER | TARITH | TPRINTED,
+ .prop = TDEFINED | TINTEGER | TARITH,
                 .size = 2,
                 .align = 1,
                 .n.rank = RANK_UINT,
_AT_@ -173,12 +172,12 @@ static Type types[] = {
         { /* 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,
diff --git a/cc1/cc1.h b/cc1/cc1.h
index 9f4c15d..5caf6bb 100644
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
_AT_@ -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 */
_AT_@ -246,7 +245,8 @@ enum op {
         ODECL,
         OBSWITCH,
         OESWITCH,
- OINIT
+ OINIT,
+ OTYP,
 };
 
 /*
diff --git a/cc1/code.c b/cc1/code.c
index 1fcc0de..beb59fe 100644
--- a/cc1/code.c
+++ b/cc1/code.c
_AT_@ -16,7 +16,8 @@ static void emitbin(unsigned, void *),
             emittext(unsigned, void *),
             emitfun(unsigned, void *),
             emitdcl(unsigned, void *),
- emitinit(unsigned, void *);
+ emitinit(unsigned, void *),
+ emittype(unsigned, void *);
 
 char *optxt[] = {
         [OADD] = "+",
_AT_@ -132,7 +133,8 @@ void (*opcode[])(unsigned, void *) = {
         [OESWITCH] = emitsymid,
         [OPAR] = emitbin,
         [OCALL] = emitbin,
- [OINIT] = emitinit
+ [OINIT] = emitinit,
+ [OTYP] = emittype,
 };
 
 void
_AT_@ -236,33 +238,26 @@ emitletter(Type *tp)
 }
 
 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);
                 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",
_AT_@ -275,6 +270,7 @@ emittype(Type *tp)
                 for (sp = tp->p.fields; n-- > 0; ++sp)
                         emit(ODECL, *sp);
                 break;
+ case PTR:
         case FTN:
                 return;
         default:
_AT_@ -377,7 +373,6 @@ emitdcl(unsigned op, void *arg)
 
         if (sym->flags & SEMITTED)
                 return;
- emittype(sym->type);
         emitvar(sym);
         putchar('\t');
         if (sym->type->op == FTN) {
diff --git a/cc1/decl.c b/cc1/decl.c
index ee3f05c..d4cbe17 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -533,6 +533,7 @@ structdcl(void)
         --nested;
 
         typesize(tp);
+ emit(OTYP, tp);
         namespace = ns;
         expect('}');
         return tp;
_AT_@ -555,6 +556,7 @@ enumdcl(void)
         if (tp->prop & TDEFINED)
                 errorp("redefinition of enumeration '%s'", tagsym->name);
         tp->prop |= TDEFINED;
+ emit(OTYP, tp);
         typesize(tp);
         namespace = NS_IDEN;
 
diff --git a/cc1/types.c b/cc1/types.c
index de1540b..c2c8c30 100644
--- a/cc1/types.c
+++ b/cc1/types.c
_AT_@ -308,7 +308,7 @@ mktype(Type *tp, int op, TINT nelem, Type *pars[])
                 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:
Received on Tue Dec 13 2016 - 17:59:10 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 13 2016 - 18:00:31 CET