Bug 15004 - [3.4 Regression] [unit-at-a-time] no warning for unused paramater in static function
Summary: [3.4 Regression] [unit-at-a-time] no warning for unused paramater in static f...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.4.0
: P2 minor
Target Milestone: 3.4.1
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2004-04-18 15:53 UTC by Andrew Pinski
Modified: 2004-10-30 21:10 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.3.3 4.0.0
Known to fail: 3.4.0
Last reconfirmed: 2004-04-18 21:56:15


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2004-04-18 15:53:58 UTC
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);
}
Comment 1 Jan Hubicka 2004-04-18 21:14:49 UTC
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
Comment 2 Andrew Pinski 2004-04-18 21:29:13 UTC
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.
Comment 3 Wolfgang Bangerth 2004-04-18 22:31:43 UTC
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. 
Comment 4 CVS Commits 2004-04-28 20:40:59 UTC
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

Comment 5 Andrew Pinski 2004-04-29 00:17:42 UTC
Fixed on the mainline right now.
Comment 6 CVS Commits 2004-05-05 23:24:39 UTC
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

Comment 7 Jan Hubicka 2004-05-05 23:27:50 UTC
Commited a fix to 3.4 branch.