shithub: scc

Download patch

ref: 426818d5e07f09bdfe91272450dd2234f89f8096
parent: ebdb4f888f8180ff7f937b9270cb003cb61bab7b
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Apr 17 11:48:53 EDT 2014

emit functions only when they are defined

The code was emiting functions all the times, even when they
where only declared.

--- a/decl.c
+++ b/decl.c
@@ -498,11 +498,11 @@
 			if (!(sclass & STATIC))
 				sym->s.isglobal = 1;
 			if (BTYPE(tp) == FTN) {
-				emitfun(sym);
 				if (yytoken == '{') {
 					extern Symbol *curfun;
 
 					curfun = sym;
+					emitfun(sym);
 					emitsframe(sym);
 					context(compound);
 					emiteframe(sym); /* FIX: sym is not used */