scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 44f9e2933acbab1af87cd114eb43f5ead70409ff
parent aeb22ab4157f5e6f61991b8c1205e65960f52ba8
Author: rain1@openmailbox.org <rain1@openmailbox.org>
Date:   Thu,  5 May 2016 14:37:23 +0100

fix TEST043

this patch fixes TEST043 by moving printing of return types for
functions to happen on declarations only.

From 7948150ac8cfe75879f9b480e7d1a36bc8140571 Mon Sep 17 00:00:00 2001
From: rain1 <rain1@openmailbox.org>
Date: Thu, 5 May 2016 14:25:49 +0100
Subject: [PATCH] print return type only when function is declared

Diffstat:
Mcc1/code.c | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/cc1/code.c b/cc1/code.c @@ -228,11 +228,6 @@ 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: @@ -388,6 +383,10 @@ emitdcl(unsigned op, void *arg) emittype(sym->type); emitvar(sym); putchar('\t'); + if (sym->type->op == FTN) { + emitletter(sym->type->type); + putchar('\t'); + } emitletter(sym->type); printf("\t\"%s", (sym->name) ? sym->name : ""); if (sym->flags & ISFIELD)