Bug 32247

Summary: -Wall enables -Wunused enables -Wunused-parameter
Product: gcc Reporter: cagney
Component: javaAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED WONTFIX    
Severity: normal CC: fche, gcc-bugs, java-prs, tromey
Priority: P3    
Version: 4.3.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

Description cagney 2007-06-07 16:33:27 UTC
The latest java compiler (well in Fedora 7) enables -Wunused as part of -Wall.  Is this such a good idea as this leads to -Wunused-parameter (a relatively common thing in O-O),
Comment 1 Andrew Pinski 2007-06-10 01:56:13 UTC
The java source compiler has been removed from gcc 4.3 so closing as won't fix.
Also I don't think unused parameters are common in OOP but in java.
Comment 2 cagney 2007-06-11 21:38:22 UTC
This bug is refering to the command line options parser and how it maps GCC style options onto ECJ options.
Comment 3 Andrew Pinski 2007-06-11 21:40:21 UTC
ecj1 is not part of GCC.
Comment 4 cagney 2007-06-11 21:44:38 UTC
This is a bug in the GCJ command line parser option parser, not in ECJ.
Comment 5 Andrew Pinski 2007-06-11 21:47:16 UTC
(In reply to comment #4)
> This is a bug in the GCJ command line parser option parser, not in ECJ.

Well I say it is not a bug according to the documentation :).

Really you should use -Wno-unused-paramter if you don't want the warning.
Comment 6 cagney 2007-06-11 21:48:15 UTC
That is something for _java_ developers to decide.
Comment 7 Andrew Pinski 2007-06-11 21:53:53 UTC
Not really because this is a standard GCC option and having it different between java and other languages is wrong.

http://gcc.gnu.org/onlinedocs/gcc-4.2.0/gcc/Warning-Options.html

Please read the documentation before really filing a bug, really an unused parameter is wrong because it usually means either you have conditional code (which case you).

Comment 8 Tom Tromey 2007-06-11 23:44:55 UTC
I'm reopening this.  Andrew P., please leave it open if you would.
We chose what goes into -Wall, and this is a bug in the
implementation of that choice.
Comment 9 Andrew Pinski 2007-06-11 23:50:03 UTC
There were a couple of things wrong with the way this was reported, first it was reported against 4.1 which actually still has a java source compiler but then it was mentioned it was really for ecj connection.  

Can people actually report against what they are really using?  If they use a modified version of GCC from redhat, please report to them first and not to us, we don't always know what is going on with distro's compilers.  This is the main reason why I closed it.  The second reason is because the documentation is quiet clear, that this option is enable.  If you don't program OOP this way, then you have the option of disabling the option, it is not like there is no option.  

This is really a style issue.  I can tell you how many times even in Java code this option is useful.
Comment 10 Manuel López-Ibáñez 2007-06-15 14:07:55 UTC
(In reply to comment #7)
> Not really because this is a standard GCC option and having it different
> between java and other languages is wrong.
> 
> http://gcc.gnu.org/onlinedocs/gcc-4.2.0/gcc/Warning-Options.html
> 
> Please read the documentation before really filing a bug, really an unused
> parameter is wrong because it usually means either you have conditional code
> (which case you).
> 

Actually neither -Wunused nor -Wall should enable -Wunused-parameter according to the documentation. -Wunused-parameter is only enabled by:

1) -Wunused-parameter [+ anything]
2) -Wall -Wextra
3) -Wunused -Wextra

So either Java is doing something wrong or the documentation does not reflect the actual behaviour (very likely as well).

Comment 11 Gopi Reddy 2008-03-14 21:14:26 UTC
(In reply to comment #3)
> ecj1 is not part of GCC.

Well, it should be. I just downloaded gcc4.3.0, compiled it, and tried to compile a simple test program.

$ gcj --version
gcj (GCC) 4.3.0
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcj Hello.java
gcj: error trying to exec 'ecj1': execvp: No such file or directory
Comment 12 Tom Tromey 2008-03-18 17:03:10 UTC
I agree we should probably change ecj1's interpretation of -Wall.

But, ecj1 can't be part of gcc.  That was already decided.
I believe the installation instructions have information on what
to download so that gcj will work properly.  If not, please let me
know and I will fix that.
Comment 13 Manuel López-Ibáñez 2008-08-07 15:22:05 UTC
Unsubscribing: not sure what is to fix here.
Comment 14 Frank Ch. Eigler 2013-03-19 23:50:18 UTC
no comment
Comment 15 Andrew Pinski 2016-09-30 22:49:46 UTC
Closing as won't fix as the Java front-end has been removed from the trunk.