commit 9c1de335c83c3160411fe897d9533f1629714577
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Fri Aug 14 11:50:41 2015 +0200
Commit:     Roberto E. Vargas Caballero <[email protected]>
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
@@ -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
@@ -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");

Reply via email to