[hackers] [scc] [cc1] Create deftype() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 15 Dec 2016 13:39:09 +0100 (CET)

commit c73e0b8d57ea9f47ac5de40e54eb32aacdca28f6
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Dec 14 13:41:37 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Dec 15 13:38:40 2016 +0100

    [cc1] Create deftype()
    
    This function does all the steps needed when a new type is defined,
    instead of copying the same all the time.

diff --git a/cc1/types.c b/cc1/types.c
index fa6f6e9..25a6561 100644
--- a/cc1/types.c
+++ b/cc1/types.c
_AT_@ -252,7 +252,7 @@ deftype(Type *tp)
 }
 
 static Type *
-newtype(Type *base)
+newtype(Type *base, int defined)
 {
         Type *tp;
 
_AT_@ -265,10 +265,8 @@ newtype(Type *base)
                 tp->next = localtypes;
                 localtypes = tp;
         }
- if (tp->prop & TDEFINED) {
- typesize(tp);
- emit(OTYP, tp);
- }
+ if (defined)
+ deftype(tp);
         return tp;
 }
 
_AT_@ -298,11 +296,9 @@ mktype(Type *tp, int op, TINT nelem, Type *pars[])
                 type.op = FTN;
         case FTN:
                 type.letter = L_FUNCTION;
- type.prop |= TDEFINED;
                 break;
         case PTR:
                 type.letter = L_POINTER;
- type.prop |= TDEFINED;
                 break;
         case ENUM:
                 type.letter = inttype->letter;
_AT_@ -317,7 +313,7 @@ mktype(Type *tp, int op, TINT nelem, Type *pars[])
                 type.letter = L_UNION;
                 type.prop |= TAGGREG;
         create_type:
- return newtype(&type);
+ return newtype(&type, 0);
         default:
                 abort();
         }
_AT_@ -335,7 +331,7 @@ mktype(Type *tp, int op, TINT nelem, Type *pars[])
                 }
         }
 
- bp = newtype(&type);
+ bp = newtype(&type, 1);
         bp->h_next = *tbl;
         *tbl = bp;
 
Received on Thu Dec 15 2016 - 13:39:09 CET

This archive was generated by hypermail 2.3.0 : Thu Dec 15 2016 - 13:48:27 CET