aboutsummaryrefslogtreecommitdiff
path: root/src/parse.cff
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse.cff')
-rw-r--r--src/parse.cff7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/parse.cff b/src/parse.cff
index dc3cad3..85d9de5 100644
--- a/src/parse.cff
+++ b/src/parse.cff
@@ -739,15 +739,13 @@ fn parseagg(P *Parser, loc Loc, kind AggKind, name *const u8, retdecl **Decl) *c
havedecls = #t;
break;
}
- let off = size;
+ let off = kind == :Struct ? size : 0;
let name = (tok = lexexpects(P, :ident, "field name")).u.ident;
let type *const Type = #null;
if !(kind == :EUnion and lexpeek(P).t == ',') {
type = parsetype(P);
- if f0align < 0 {
- f0align = type.align;
- }
+ f0align = MAX(type.align, f0align);
}
if type != #null and !completetype(type) {
err(P, tok.loc, "field `%s' is of incomplete type (%t)", name, type);
@@ -758,6 +756,7 @@ fn parseagg(P *Parser, loc Loc, kind AggKind, name *const u8, retdecl **Decl) *c
size = kind == :Struct ? off + type.size
: MAX(size, type.size);
}
+ efmt("%s\t %s\t off %z\n", agg.name ?? "?", name, off);
flds->push({ name, type, off });
if !lexmatch(P, #null, ',') {