aboutsummaryrefslogtreecommitdiff
path: root/src/parse.cff
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-30 20:20:06 +0200
committerlemon <lsof@mailbox.org>2022-08-30 20:20:06 +0200
commitf1d4407044b5cd5eaabf0a53d1d7cb5d8b270ea6 (patch)
tree10f845b0ffa0eaf63a7bd48b6fc6c1f2582617ef /src/parse.cff
parentdd3b12d8114176d8433f961a11b7f53c1083ade0 (diff)
fix some type size errors
Diffstat (limited to 'src/parse.cff')
-rw-r--r--src/parse.cff6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/parse.cff b/src/parse.cff
index 46d71d8..bd5262e 100644
--- a/src/parse.cff
+++ b/src/parse.cff
@@ -689,7 +689,7 @@ fn parseenum(P *Parser, name *const u8, lax bool) *const Type {
: max < 1i64 << 31 ? ty_i32
: ty_i64);
static id int = 0;
- return interntype(&Type{ .u: :Enum { intty, name, lax, id++, vals->move(P.alloc) }});
+ return interntype(&Type{ intty.size, intty.align, .u: :Enum { intty, name, lax, id++, vals->move(P.alloc) }});
}
fn isdecltokt(t TokT) bool {
@@ -735,7 +735,6 @@ fn parseagg(P *Parser, loc Loc, kind AggKind, name *const u8, retdecl **Decl) *c
let size = 0z, align = 1z;
let flds Vec<AggField> = {};
let havedecls = #f;
- let f0align = 0zs;
while !lexmatch(P, &tok, '}') {
if isdecltokt(lexpeek(P).t) {
havedecls = #t;
@@ -747,7 +746,6 @@ fn parseagg(P *Parser, loc Loc, kind AggKind, name *const u8, retdecl **Decl) *c
if !(kind == :EUnion and lexpeek(P).t == ',') {
type = parsetype(P);
- f0align = MAX(type.align, f0align);
}
if type != #null and !completetype(type) {
err(P, tok.loc, "field `%s' is of incomplete type (%t)", name, type);
@@ -793,7 +791,7 @@ fn parseagg(P *Parser, loc Loc, kind AggKind, name *const u8, retdecl **Decl) *c
}
agg.enumty = interntype(&enumty);
- let off = f0align < 0 ? 0z : ALIGNUP(enumty.size, f0align);
+ let off = ALIGNUP(enumty.size, ty.align);
ty.size += off;
align = MAX(align, enumty.align);
ty.size = ALIGNUP(ty.size, align);