From 8e94bb58ca91b26c0916210a179157b1280489be Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 8 Aug 2022 06:29:26 +0200 Subject: tweak --- bootstrap/parse.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'bootstrap/parse.c') 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); -- cgit v1.2.3