scc

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

commit ff9a7ec77a798f1555fa184a1516f3f721943560
parent b4b8c8c5ff06d158b4aaa3811bcb39ce2a7c07e8
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 13 Jul 2014 06:57:39 +0200

Remove qualifier() function

Diffstat:
Mcc1/cc1.h | 3+--
Mcc1/decl.c | 4++--
Mcc1/types.c | 16----------------
3 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/cc1/cc1.h b/cc1/cc1.h @@ -89,8 +89,7 @@ struct symbol { struct symbol *hash; }; -extern Type *qualifier(Type *tp, uint8_t qlf), - *ctype(int8_t type, int8_t sign, int8_t size), +extern Type *ctype(int8_t type, int8_t sign, int8_t size), *mktype(Type *tp, uint8_t op, uint16_t nelem); extern Symbol diff --git a/cc1/decl.c b/cc1/decl.c @@ -156,7 +156,7 @@ declarator(Type *tp, int8_t flags) for (bp = declarator0(data, flags); bp >= data; --bp) { switch (bp->op) { case PTR: - tp = qualifier(mktype(tp, PTR, 0), bp->u.qlf); + tp = mktype(tp, PTR, 0); break; case ARY: tp = mktype(tp, ARY, bp->u.nelem); @@ -254,7 +254,7 @@ check_types: *sclass = cls; if (!tp) tp = ctype(type, sign, size); - return (qlf) ? qualifier(tp, qlf) : tp; + return tp; invalid_type: error("invalid type specification"); diff --git a/cc1/types.c b/cc1/types.c @@ -180,19 +180,3 @@ mktype(Type *tp, uint8_t op, uint16_t nelem) return *tbl = bp; } -Type * -qualifier(Type *tp, uint8_t qlf) -{ - uint8_t q = tp->op; - - if (!qlf) - return tp; - if (q & TQUALIFIER) { - if (q == qlf) - return tp; - tp = tp->type; - qlf |= q; - } - return mktype(tp, qlf|TQUALIFIER, 0); -} -