diff options
-rw-r--r-- | cc.h | 15 | ||||
-rw-r--r-- | decl.c | 6 | ||||
-rw-r--r-- | expr.c | 4 | ||||
-rw-r--r-- | targ.c | 8 | ||||
-rw-r--r-- | type.c | 10 |
5 files changed, 19 insertions, 24 deletions
@@ -163,15 +163,12 @@ enum typekind { enum typeprop { PROPNONE, - PROPOBJECT = 1<<0, - PROPCHAR = 1<<1, - PROPINT = 1<<2, - PROPREAL = 1<<3, - PROPARITH = 1<<4, - PROPSCALAR = 1<<5, - PROPAGGR = 1<<6, - PROPDERIVED = 1<<7, - PROPFLOAT = 1<<8 + PROPCHAR = 1<<0, + PROPINT = 1<<1, + PROPREAL = 1<<2, + PROPARITH = 1<<3, + PROPSCALAR = 1<<4, + PROPFLOAT = 1<<5 }; struct param { @@ -179,9 +179,7 @@ tagspec(struct scope *s) *t = typeuint; t->kind = kind; } else { - t = mktype(kind, PROPOBJECT); - if (kind == TYPESTRUCT) - t->prop |= PROPAGGR; + t = mktype(kind, 0); t->size = 0; t->align = 0; t->u.structunion.tag = tag; @@ -507,7 +505,7 @@ declaratortypes(struct scope *s, struct list *result, char **name, bool allowabs case TLPAREN: /* function declarator */ next(); func: - t = mktype(TYPEFUNC, PROPDERIVED); + t = mktype(TYPEFUNC, 0); t->qual = QUALNONE; t->u.func.isprototype = false; t->u.func.isvararg = false; @@ -262,7 +262,7 @@ mkbinaryexpr(struct location *loc, enum tokenkind op, struct expr *l, struct exp if (l->type->kind != TYPEPOINTER || !(rp & PROPINT)) error(loc, "invalid operands to '+' operator"); t = l->type; - if (t->base->incomplete || !(t->base->prop & PROPOBJECT)) + if (t->base->incomplete || t->base->kind == TYPEFUNC) error(loc, "pointer operand to '+' must be to complete object type"); r = mkbinaryexpr(loc, TMUL, exprconvert(r, &typeulong), mkconstexpr(&typeulong, t->base->size)); break; @@ -273,7 +273,7 @@ mkbinaryexpr(struct location *loc, enum tokenkind op, struct expr *l, struct exp } if (l->type->kind != TYPEPOINTER || !(rp & PROPINT) && r->type->kind != TYPEPOINTER) error(loc, "invalid operands to '-' operator"); - if (l->type->base->incomplete || !(l->type->base->prop & PROPOBJECT)) + if (l->type->base->incomplete || l->type->base->kind == TYPEFUNC) error(loc, "pointer operand to '-' must be to complete object type"); if (rp & PROPINT) { t = l->type; @@ -10,10 +10,10 @@ static const struct target alltargs[] = { .name = "x86_64", .typewchar = &typeint, .typevalist = &(struct type){ - .kind = TYPEARRAY, .prop = PROPOBJECT|PROPDERIVED|PROPAGGR, + .kind = TYPEARRAY, .align = 8, .size = 24, .u.array = {1}, .base = &(struct type){ - .kind = TYPESTRUCT, .prop = PROPOBJECT|PROPAGGR, + .kind = TYPESTRUCT, .align = 8, .size = 24, }, }, @@ -22,7 +22,7 @@ static const struct target alltargs[] = { { .name = "aarch64", .typevalist = &(struct type){ - .kind = TYPESTRUCT, .prop = PROPOBJECT|PROPAGGR, + .kind = TYPESTRUCT, .align = 8, .size = 32, .u.structunion.tag = "va_list", }, @@ -31,7 +31,7 @@ static const struct target alltargs[] = { { .name = "riscv64", .typevalist = &(struct type){ - .kind = TYPEPOINTER, .prop = PROPOBJECT|PROPDERIVED|PROPSCALAR, + .kind = TYPEPOINTER, .prop = PROPSCALAR, .align = 8, .size = 8, .base = &typevoid, }, @@ -8,14 +8,14 @@ #define INTTYPE(k, n, s, p) { \ .kind = k, .size = n, .align = n, .u.basic.issigned = s, \ - .prop = PROPOBJECT|PROPSCALAR|PROPARITH|PROPREAL|PROPINT|p, \ + .prop = PROPSCALAR|PROPARITH|PROPREAL|PROPINT|p, \ } #define FLTTYPE(k, n) { \ .kind = k, .size = n, .align = n, \ - .prop = PROPOBJECT|PROPSCALAR|PROPARITH|PROPREAL|PROPFLOAT, \ + .prop = PROPSCALAR|PROPARITH|PROPREAL|PROPFLOAT, \ } -struct type typevoid = {.kind = TYPEVOID, .prop = PROPOBJECT, .incomplete = true}; +struct type typevoid = {.kind = TYPEVOID, .incomplete = true}; struct type typebool = INTTYPE(TYPEBOOL, 1, false, 0); @@ -61,7 +61,7 @@ mkpointertype(struct type *base, enum typequal qual) { struct type *t; - t = mktype(TYPEPOINTER, PROPOBJECT|PROPDERIVED|PROPSCALAR); + t = mktype(TYPEPOINTER, PROPSCALAR); t->base = base; t->qual = qual; t->size = 8; @@ -75,7 +75,7 @@ mkarraytype(struct type *base, enum typequal qual, unsigned long long len) { struct type *t; - t = mktype(TYPEARRAY, PROPOBJECT|PROPDERIVED|PROPAGGR); + t = mktype(TYPEARRAY, 0); t->base = base; t->qual = qual; t->u.array.length = len; |