shithub: scc

Download patch

ref: 9c1de335c83c3160411fe897d9533f1629714577
parent: b8a5015e5759505472294abea476ffffa4c387e7
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Aug 14 07:50:41 EDT 2015

Avoid warnings about non used parameters in prototypes

Obviously parameters in prototypes are not going to be used ever,
so it is a really stupid warning.

--- a/cc1/code.c
+++ b/cc1/code.c
@@ -327,8 +327,11 @@
 	puts("\t{");
 
 	n = sym->type->n.elem;
-	for (sp = sym->u.pars; n-- > 0; ++sp)
+	for (sp = sym->u.pars; n-- > 0; ++sp) {
+		/* enable non used warnings in parameters */
+		(*sp)->flags &= ~ISUSED;
 		emit(ODECL, *sp);
+	}
 	puts("-");
 }
 
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -157,6 +157,7 @@
 			error("redefinition of parameter '%s'", name);
 	}
 	sym->type = tp;
+	sym->flags |= ISUSED;    /* avoid non used warnings in prototypes */
 
 	if (n++ == NR_FUNPARAM)
 		error("too much parameters in function definition");