diff options
Diffstat (limited to 'src/parse.cff')
| -rw-r--r-- | src/parse.cff | 6 |
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); |