shithub: scc

Download patch

ref: 6946e8df6d64cfd59a1c4ad9c22bbfb6914543d4
parent: 3921cb9b1dcf2f448c59c391ad182c6eb474b303
author: [email protected] <[email protected]>
date: Thu May 5 10:37:23 EDT 2016

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

--- a/cc1/code.c
+++ b/cc1/code.c
@@ -228,11 +228,6 @@
 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 @@
 	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)