--- cc1/code.c | 5 +++++ cc2/arch/qbe/code.c | 2 +- cc2/cc2.h | 1 + cc2/parser.c | 6 +++++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cc1/code.c b/cc1/code.c index ff7f27e..e9f1698 100644 --- a/cc1/code.c +++ b/cc1/code.c _AT_@ -226,6 +226,11 @@ emitsym(unsigned op, void *arg) static void emitletter(Type *tp) { + if (tp->op == FTN) { + emitletter(tp->type); + putchar('\t'); + } + putchar(tp->letter); switch (tp->op) { case ARY: diff --git a/cc2/arch/qbe/code.c b/cc2/arch/qbe/code.c index 06dbfd9..c9ea287 100644 --- a/cc2/arch/qbe/code.c +++ b/cc2/arch/qbe/code.c _AT_@ -167,7 +167,7 @@ writeout(void) if (curfun->kind == GLOB) fputs("export ", stdout); - printf("function w %s(", symname(curfun)); + printf("function %s $%s(", size2asm(&curfun->rtype), symname(curfun)); for (p = locals; p && p->type.flags & PARF; p = p->next) printf("%s %s,", size2asm(&p->type), symname(p)); diff --git a/cc2/cc2.h b/cc2/cc2.h index eb63665..ba7d3d6 100644 --- a/cc2/cc2.h +++ b/cc2/cc2.h _AT_@ -131,6 +131,7 @@ struct type { struct symbol { Type type; + Type rtype; unsigned short id; unsigned short numid; char *name; diff --git a/cc2/parser.c b/cc2/parser.c index b036fbd..c542d88 100644 --- a/cc2/parser.c +++ b/cc2/parser.c _AT_@ -524,13 +524,15 @@ decl(Symbol *sym) static void vardecl(void) { - Type *tp; + Type *tp, *rp; Node *np; Symbol *sym; char *name; name = pop(); tp = pop(); + if (tp->flags & FUNF) + rp = pop(); np = pop(); sym = np->u.sym; _AT_@ -542,6 +544,8 @@ vardecl(void) free(sym->name); sym->name = name; sym->type = *tp; + if (tp->flags & FUNF) + sym->rtype = *rp; sym->kind = sclass; if (ininit) -- 2.1.4Received on Fri Apr 15 2016 - 12:54:42 CEST
This archive was generated by hypermail 2.3.0 : Fri Apr 15 2016 - 13:00:19 CEST