aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/parse.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-08 06:29:26 +0200
committerlemon <lsof@mailbox.org>2022-08-08 06:29:26 +0200
commit8e94bb58ca91b26c0916210a179157b1280489be (patch)
treed42f1a4842b34ba282213f290a05582e2e515dd8 /bootstrap/parse.c
parentc6ea883724ed389143dbed1806916aa09157b655 (diff)
tweak
Diffstat (limited to 'bootstrap/parse.c')
-rw-r--r--bootstrap/parse.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/bootstrap/parse.c b/bootstrap/parse.c
index 59d3b5f..02980cc 100644
--- a/bootstrap/parse.c
+++ b/bootstrap/parse.c
@@ -2327,7 +2327,8 @@ parsefn(struct decl *decl, struct parser *P) {
putdecl(P, tok.span, &decl);
}
fn->body = xcalloc(1, sizeof *fn->body);
- *fn->body = parseblock(P);
+ WITH_TMPCHANGE(int, P->varid, 0)
+ *fn->body = parseblock(P);
popenv(P);
}
}
@@ -2599,8 +2600,11 @@ parseagg(struct parser *P, const char *name, int kind, struct decl **retdecl) {
}
}
+ if (!flds.length && kind == TYeunion)
+ fatal(P, tok.span, "enum union must have at least 1 variant");
+
struct type *ppty = (struct type *)pty;
- ppty->size = ALIGNUP(size, align);
+ ppty->size = size ? ALIGNUP(size, align) : 1;
ppty->align = align;
vec_slice_cpy(&ppty->agg.flds, &flds);