scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 9c1de335c83c3160411fe897d9533f1629714577
parent b8a5015e5759505472294abea476ffffa4c387e7
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 14 Aug 2015 11:50:41 +0200

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.

Diffstat:
cc1/code.c | 5++++-
cc1/decl.c | 1+
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/cc1/code.c b/cc1/code.c @@ -327,8 +327,11 @@ emitfun(unsigned op, void *arg) 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("-"); } diff --git a/cc1/decl.c b/cc1/decl.c @@ -157,6 +157,7 @@ parameter(struct decl *dcl) 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");