scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 01d01a1a25cb16603479e6e0a7ae3dbc7c726686
parent 8a1556967443af2e55ef33b3cdab613acbc0ef91
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 10 Jan 2016 11:30:33 +0100

Initialize all the flags of new created types

This change simplify the logic in mktype()

Diffstat:
Mcc1/types.c | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/cc1/types.c b/cc1/types.c @@ -452,7 +452,9 @@ mktype(Type *tp, int op, TINT nelem, Type *pars[]) type.type = tp; type.op = op; + type.defined = 0; type.arith = 0; + type.sign = 0; type.integer = 0; type.printed = 0; type.aggreg = 0; @@ -465,7 +467,7 @@ mktype(Type *tp, int op, TINT nelem, Type *pars[]) switch (op) { case ARY: if (nelem == 0) - goto no_defined; + break; /* PASSTROUGH */ case FTN: case PTR: @@ -475,14 +477,11 @@ mktype(Type *tp, int op, TINT nelem, Type *pars[]) type.printed = 1; type.integer = 1; type.arith = 1; - type.sign = 0; type.n.rank = RANK_INT; - goto no_defined; + break; case STRUCT: case UNION: type.aggreg = 1; - no_defined: - type.defined = 0; break; }