[hackers] [scc] Avoid warnings about non used parameters in prototypes || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 14 Aug 2015 17:08:59 +0200 (CEST)

commit 9c1de335c83c3160411fe897d9533f1629714577
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Aug 14 11:50:41 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Aug 14 11:50:41 2015 +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.

diff --git a/cc1/code.c b/cc1/code.c
index 09f499a..9932694 100644
--- a/cc1/code.c
+++ b/cc1/code.c
_AT_@ -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
index 087f5af..673b091 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -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");
Received on Fri Aug 14 2015 - 17:08:59 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 14 2015 - 17:12:13 CEST