ref: 18f8c9b9a58001bdc8f00443b2b349ff01bac518
parent: af9f64086ce4a32c58c096e56b6ca8432d1fcf88
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue May 13 13:41:43 EDT 2014
Remove sym field of Type This field was used when fields of aggregate types were stored as identifiers with custom namespace. Since we are not using this representation anymore this field is not needed anymore.
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -37,7 +37,6 @@
char letter; /* letter of the type */
bool defined : 1; /* type defined (is not a forward reference) */
bool sign : 1; /* sign type */
- struct symbol *sym; /* symbol of the tag identifier */
struct ctype *type; /* base type */
struct ctype *next; /* next element in the hash */
union {
@@ -93,8 +92,7 @@
extern Type *qualifier(Type *tp, uint8_t qlf),
*ctype(int8_t type, int8_t sign, int8_t size),
- *mktype(Type *tp,
- uint8_t op, Symbol *tag, uint16_t nelem);
+ *mktype(Type *tp, uint8_t op, uint16_t nelem);
extern Symbol
*lookup(char *s, unsigned char ns),
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -143,13 +143,13 @@
for (bp = declarator0(data, flags); bp >= data; --bp) {
switch (bp->op) {
case PTR:
- tp = qualifier(mktype(tp, PTR, NULL, 0), bp->u.qlf);
+ tp = qualifier(mktype(tp, PTR, 0), bp->u.qlf);
break;
case ARY:
- tp = mktype(tp, ARY, NULL, bp->u.nelem);
+ tp = mktype(tp, ARY, bp->u.nelem);
break;
case FTN:
- tp = mktype(tp, FTN, NULL, 0);
+ tp = mktype(tp, FTN, 0);
break;
case IDEN:
sym = bp->u.sym;
@@ -348,8 +348,7 @@
} else {
sym = install("", NS_TAG);
}
- tp = sym->type = mktype(NULL, tag, NULL, 0);
- tp->sym = sym;
+ tp = sym->type = mktype(NULL, tag, 0);
return tp;
bad_tag:
--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -90,7 +90,7 @@
{
Type *tp;
- tp = mktype(np->utype->type, PTR, NULL, 0);
+ tp = mktype(np->utype->type, PTR, 0);
return unarycode(OADDR, tp, np);
}
@@ -374,7 +374,7 @@
goto no_lvalue;
if (np->b.symbol && np->u.sym->s.isregister)
goto reg_address;
- return unarycode(op, mktype(np->type, PTR, NULL, 0), np);
+ return unarycode(op, mktype(np->type, PTR, 0), np);
no_lvalue:
err = "lvalue required in unary expression";
--- a/cc1/lex.c
+++ b/cc1/lex.c
@@ -184,7 +184,7 @@
*bp = '\0';
sym = install("", NS_IDEN);
sym->u.s = xstrdup(buf);
- sym->type = mktype(chartype, PTR, NULL, 0);
+ sym->type = mktype(chartype, PTR, 0);
yynlval.sym = sym;
return STRING;
}
--- a/cc1/types.c
+++ b/cc1/types.c
@@ -141,8 +141,7 @@
}
Type *
-mktype(Type *tp, uint8_t op,
- Symbol *sym, uint16_t nelem)
+mktype(Type *tp, uint8_t op, uint16_t nelem)
{
static Type *typetab[NR_TYPE_HASH], **tbl;
static uint8_t t;
@@ -157,7 +156,7 @@
if (op != FTN || op != STRUCT || op != UNION || op != ENUM) {
for (bp = *tbl; bp; bp = bp->next) {
if (bp->type == tp && bp->op == op &&
- bp->sym == sym && bp->u.nelem == nelem) {
+ (op != ARY || bp->u.nelem == nelem)) {
return bp;
}
}
@@ -176,7 +175,6 @@
bp->type = tp;
bp->op = op;
bp->u.nelem = nelem;
- bp->sym = sym;
bp->letter = letter;
return *tbl = bp;
}
@@ -194,6 +192,6 @@
tp = tp->type;
qlf |= q;
}
- return mktype(tp, qlf|TQUALIFIER, NULL, 0);
+ return mktype(tp, qlf|TQUALIFIER, 0);
}