From d5f154ed760d0929530fdce5409d5772a708ea05 Mon Sep 17 00:00:00 2001 From: lemon Date: Thu, 23 Oct 2025 17:48:22 +0200 Subject: c: make builtin va_list an opaque struct --- c/c.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'c') diff --git a/c/c.c b/c/c.c index 2983018..5bfee6e 100644 --- a/c/c.c +++ b/c/c.c @@ -3995,11 +3995,19 @@ function(struct comp *cm, struct function *fn, const char **pnames, const struct void docomp(struct comp *cm) { + static union type valistty; struct token tk[1]; if (!cm->env) cm->env = &toplevel; - putdecl(cm, &(struct decl) { mktype(TYVALIST), SCTYPEDEF, .name = intern("__builtin_va_list") }); + if (!valistty.t) { + struct typedata td = { + .t = TYSTRUCT, .siz = targ_valistsize, .align = targ_primalign[TYPTR], .nmemb = 1, + .fld = (struct namedfield [1]){{"?"}} + }; + valistty = mktagtype(intern("__builtin_va_list"), &td); + } + putdecl(cm, &(struct decl) { valistty, SCTYPEDEF, .name = intern("__builtin_va_list") }); while (peek(cm, tk) != TKEOF) { struct declstate st = { DTOPLEVEL }; -- cgit v1.2.3