Since t is inlined and no longer even tried to be emitted anymore there is no unused paramater warning for t. static int t(int i) { return 0; } int tt() { return t(0); }
Subject: Re: [3.4/3.5 Regression] [unit-at-a-time] no warning for unused paramater in static function Do we realy want this to have warned? We never did so for C++ and it would be pretty expensive to throw all the function into backend just to get the warnings out. Perhaps we may want to have such warnings only for code that is really used... Honza
Yes we want this, as if the function is too big to be inlined the function is warned about but if it is okay to be inlined it will be inlined and not warned about which right now is causing a bootstrap failure on some targets as the warning only applies to some targets only. Maybe this warning needs to be done earlier for C and C++ in that needs to be moved into the front-end or moved so that goes through some of these warnings no matter what.
From a user's perspective: yes, we want the warning. It is confusing if the warning depends on the inlining strategy or optimization flags. Besides this, the warning usually shows a real deficiency in user's code, which we certainly don't want to paper over just because we inline the function. W.
Subject: Bug 15004 CVSROOT: /cvs/gcc Module name: gcc Changes by: hubicka@gcc.gnu.org 2004-04-28 20:40:55 Modified files: gcc : ChangeLog Makefile.in cgraphunit.c function.c function.h gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.dg: unused-6.c Log message: * gcc.dg/unused-6.c: New test. PR c/15004 * function.c (do_warn_unused_parameter): Break out form ... (expand_function_end): ... here; warn only when not using cgraphunit. * function.h (do_warn_unused_parameter): Declare. * cgraphunit.c: Include function.h. (cgraph_finalize_function): Do unused parameter warning. * Makefile.in (cgraphunit.o): Depend on function.h Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3504&r2=2.3505 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/Makefile.in.diff?cvsroot=gcc&r1=1.1273&r2=1.1274 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cgraphunit.c.diff?cvsroot=gcc&r1=1.55&r2=1.56 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.c.diff?cvsroot=gcc&r1=1.512&r2=1.513 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.h.diff?cvsroot=gcc&r1=1.112&r2=1.113 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3704&r2=1.3705 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/unused-6.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
Fixed on the mainline right now.
Subject: Bug 15004 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: hubicka@gcc.gnu.org 2004-05-05 23:24:31 Modified files: gcc : ChangeLog Makefile.in cgraphunit.c function.c function.h Log message: PR c/15004 * function.c (do_warn_unused_parameter): Break out form ... (expand_function_end): ... here; warn only when not using cgraphunit. * function.h (do_warn_unused_parameter): Declare. * cgraphunit.c: Include function.h. (cgraph_finalize_function): Do unused parameter warning. * Makefile.in (cgraphunit.o): Depend on function.h Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.432&r2=2.2326.2.433 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/Makefile.in.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1223.2.15&r2=1.1223.2.16 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cgraphunit.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.46.2.5&r2=1.46.2.6 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.483.4.11&r2=1.483.4.12 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.108.4.2&r2=1.108.4.3
Commited a fix to 3.4 branch.