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 <[email protected]>
Date: Thu, 5 May 2016 14:25:49 +0100
Subject: [PATCH] print return type only when function is declared

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

diff --git a/cc1/code.c b/cc1/code.c
index e140d56..fd0fe91 100644
--- 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)
-- 
2.7.0

Reply via email to