diff options
Diffstat (limited to 'bootstrap/cgen.c')
| -rw-r--r-- | bootstrap/cgen.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bootstrap/cgen.c b/bootstrap/cgen.c index b0cfd92..7519982 100644 --- a/bootstrap/cgen.c +++ b/bootstrap/cgen.c @@ -541,7 +541,7 @@ liftdecl(struct decl *decl) { static int id; switch (decl->t) { case Dfn: - if (decl->fn.body || (decl->container && !decl->externp)) { + if ((decl->fn.body || (decl->container && !decl->externp)) && !*decl->_cname) { if (decl->container) *decl->_cname = xasprintf("__m%s_%s%d", decl->container->agg.name, decl->fn.name, decl->fn.id); else @@ -710,6 +710,12 @@ defctype(const struct type *ty, void *_) { } break; case TYslice: + if (ty->child->konst) { + const struct type *ty2 = unconstifychild(ty); + defctype(ty2, NULL); + *cname = (char *)ty2->_cname; + return; + } defctype(ty->child, NULL); *cname = xasprintf("__ty%d", id++); pri("typedef struct { %t *ptr; size_t len; } %s;\n", |