shithub: scc

Download patch

ref: aec48c1290fc79d01782a4406a6ebbb2e1f6cb44
parent: eff19eac25f2541f43bf17de94f6730a97ac0908
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue May 31 05:12:20 EDT 2016

[cc2-qbe] Add support for void functions

Void functions are dealt as int functions which return a
value which will not be used.

--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
@@ -243,6 +243,10 @@
 		pars[n] = cgen(p->left);
 
 	switch (tp->size) {
+	case 0:
+		np->left = tmpnode(newnode(OTMP));
+		op = ASCALLW;
+		break;
 	case 1:
 		op = ASCALLB;
 		break;