diff options
| author | 2022-08-12 11:20:43 +0200 | |
|---|---|---|
| committer | 2022-08-12 11:20:43 +0200 | |
| commit | eff929f0d323559f3b2e9272e3c1d4aa82fc5c80 (patch) | |
| tree | c3dd54fe4ed4a3082f455c8fe37436f767760977 /bootstrap/parse.c | |
| parent | 19f1093f0929b989a06cdee2e7d175e6db15559c (diff) | |
va list, cont fix
Diffstat (limited to 'bootstrap/parse.c')
| -rw-r--r-- | bootstrap/parse.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/bootstrap/parse.c b/bootstrap/parse.c index d0bea8e..7c31ce1 100644 --- a/bootstrap/parse.c +++ b/bootstrap/parse.c @@ -1416,7 +1416,32 @@ pexpostfix(struct parser *P) { if (lexpeek(P).t != '(') lexexpect(P, '('); + } else if (ex.ty->t == TYvalist) { + if (!strcmp(fnam, "start")) { + lexexpect(P, '('); + struct expr ex2 = parseexpr(P); + lexexpect(P, ')'); + ex = (struct expr) { + Evastart, ex.span, ty_void, + .binop.lhs = exprdup(ex), + .binop.rhs = exprdup(ex2) + }; + } else if (!strcmp(fnam, "arg")) { + lexexpect(P, '('); + ty = parsetype(P); + lexexpect(P, ')'); + ex = (struct expr) { + Evaarg, ex.span, ty, .child = exprdup(ex) + }; + } else if (!strcmp(fnam, "end")) { + lexexpect(P, '('); + lexexpect(P, ')'); + ex = (struct expr) { + Evaend, ex.span, ty_void, .child = exprdup(ex) + }; + } else goto badmet; } else { + badmet: fatal(P, tok.span, "cannot call `->%s': left-hand-side is not an aggregate (%t)", fnam, ex.ty); } |