public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* GCC: How to get all warnings?
@ 2011-08-10  3:15 Jeffrey Walton
  2011-08-10  4:12 ` Jędrzej Dudkiewicz
  2011-08-10  7:25 ` Jonathan Wakely
  0 siblings, 2 replies; 9+ messages in thread
From: Jeffrey Walton @ 2011-08-10  3:15 UTC (permalink / raw)
  To: GCC Users List

Hi All,

How does one get all warnings out of GCC? -Wall does not do it, and
-Wextra does not do it. Is there a -Wall++ or -Wextra++? I find it
maddening I can't get GCC to give me everything (I can chose to back
off what does not matter at a later date). Or maybe worded
differently: I can't figure out what makes up 'everything' in GCC in
the context of warnings.

Even better, I want a method that works now and in the future. That
is, when a warning is added to GCC, it is also added to -Wall++ so I
don't have to go to specify -Wall++ -Wnew-warning?

Jeff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GCC: How to get all warnings?
  2011-08-10  3:15 GCC: How to get all warnings? Jeffrey Walton
@ 2011-08-10  4:12 ` Jędrzej Dudkiewicz
  2011-08-10  7:25 ` Jonathan Wakely
  1 sibling, 0 replies; 9+ messages in thread
From: Jędrzej Dudkiewicz @ 2011-08-10  4:12 UTC (permalink / raw)
  To: GCC Users List

On Wed, Aug 10, 2011 at 5:15 AM, Jeffrey Walton <noloader@gmail.com> wrote:
> Hi All,
>
> How does one get all warnings out of GCC? -Wall does not do it, and
> -Wextra does not do it. Is there a -Wall++ or -Wextra++? I find it
> maddening I can't get GCC to give me everything (I can chose to back
> off what does not matter at a later date).

I don't think there is such switch, and for good reason. It's
usefulness would be pretty low, as "everything" would most probably
mean, that some options with n levels should be set to max. I tried to
compile code with such settings and "fix it", so no warnings would
appear. I gave up, amount of seemingly bogus warnings stemming from
some obscure, though probably valid, optimizations is gigantic and in
most cases fixing them makes code unreadable. Of course YMMV.

-- 
Jędrzej Dudkiewicz

I really hate this damn machine, I wish that they would sell it.
It never does just what I want, but only what I tell it.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GCC: How to get all warnings?
  2011-08-10  3:15 GCC: How to get all warnings? Jeffrey Walton
  2011-08-10  4:12 ` Jędrzej Dudkiewicz
@ 2011-08-10  7:25 ` Jonathan Wakely
  2011-08-10  8:10   ` Jeffrey Walton
  1 sibling, 1 reply; 9+ messages in thread
From: Jonathan Wakely @ 2011-08-10  7:25 UTC (permalink / raw)
  To: noloader; +Cc: GCC Users List

On 10 August 2011 04:15, Jeffrey Walton <noloader@gmail.com> wrote:
> Hi All,
>
> How does one get all warnings out of GCC? -Wall does not do it, and
> -Wextra does not do it. Is there a -Wall++ or -Wextra++? I find it
> maddening I can't get GCC to give me everything (I can chose to back
> off what does not matter at a later date). Or maybe worded
> differently: I can't figure out what makes up 'everything' in GCC in
> the context of warnings.
>
> Even better, I want a method that works now and in the future. That
> is, when a warning is added to GCC, it is also added to -Wall++ so I
> don't have to go to specify -Wall++ -Wnew-warning?

They're all listed in the manual.  If you really want every warning,
some of which give too many false positives or are only useful to some
people, then just go through the manual and add them all.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GCC: How to get all warnings?
  2011-08-10  7:25 ` Jonathan Wakely
@ 2011-08-10  8:10   ` Jeffrey Walton
  2011-08-10  9:22     ` Jonathan Wakely
  0 siblings, 1 reply; 9+ messages in thread
From: Jeffrey Walton @ 2011-08-10  8:10 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: GCC Users List

On Wed, Aug 10, 2011 at 3:24 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 10 August 2011 04:15, Jeffrey Walton <noloader@gmail.com> wrote:
>> Hi All,
>>
>> How does one get all warnings out of GCC? -Wall does not do it, and
>> -Wextra does not do it. Is there a -Wall++ or -Wextra++? I find it
>> maddening I can't get GCC to give me everything (I can chose to back
>> off what does not matter at a later date). Or maybe worded
>> differently: I can't figure out what makes up 'everything' in GCC in
>> the context of warnings.
>>
>> Even better, I want a method that works now and in the future. That
>> is, when a warning is added to GCC, it is also added to -Wall++ so I
>> don't have to go to specify -Wall++ -Wnew-warning?
>
> They're all listed in the manual.  If you really want every warning,
> some of which give too many false positives or are only useful to some
> people, then just go through the manual and add them all.
This is probably going to sound like a dumb question, but here goes:
why doen't GCC offer a switch to enable all warnings? And even better,
Why was -Wall named -Wall - wouldn't -Wsome be better?

Jeff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GCC: How to get all warnings?
  2011-08-10  8:10   ` Jeffrey Walton
@ 2011-08-10  9:22     ` Jonathan Wakely
  2011-08-10 10:22       ` Marc Glisse
  2011-08-15 10:15       ` Andrew Haley
  0 siblings, 2 replies; 9+ messages in thread
From: Jonathan Wakely @ 2011-08-10  9:22 UTC (permalink / raw)
  To: noloader; +Cc: GCC Users List

On 10 August 2011 09:10, Jeffrey Walton wrote:
> This is probably going to sound like a dumb question, but here goes:
> why doen't GCC offer a switch to enable all warnings? And even better,

Noone has implemented it, gcc devs don't think it's useful (or not
more useful than fixing bugs or adding more useful features first, and
don't want to have to maintain it) and apparently noone else wants it
badly enough to do more than open bugzilla reports requesting it.

It probably wouldn't be useful to many people, even the people who
think they want it.

e.g. do you really want to enable -Wdouble-promotion ?
That's useful for people writing for targets without efficient
'double' operations in hardware, but pretty useless for everyone else.

       The following -W... options are not implied by -Wall.  Some
       of them warn about constructions that users generally do not
       consider questionable, but which occasionally you might wish
       to check for; others warn about constructions that are nec-
       essary or hard to avoid in some cases, and there is no sim-
       ple way to modify the code to suppress the warning.


> Why was -Wall named -Wall - wouldn't -Wsome be better?

History, I guess.  It's too late to change it, if -Wall suddenly
enabled *all* warnings then millions of makefiles using -Wall would
produce spurious warnings and -Wall would have to be removed from
those makefiles, which would be a much bigger problem for a far larger
number of people than the few who think that -Wall should enable
literally all warnings.  It's a misnomer, but so what?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GCC: How to get all warnings?
  2011-08-10  9:22     ` Jonathan Wakely
@ 2011-08-10 10:22       ` Marc Glisse
  2011-08-10 11:09         ` Jonathan Wakely
  2011-08-15 10:15       ` Andrew Haley
  1 sibling, 1 reply; 9+ messages in thread
From: Marc Glisse @ 2011-08-10 10:22 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: noloader, GCC Users List

On Wed, 10 Aug 2011, Jonathan Wakely wrote:

> On 10 August 2011 09:10, Jeffrey Walton wrote:
>> This is probably going to sound like a dumb question, but here goes:
>> why doen't GCC offer a switch to enable all warnings? And even better,
>
> Noone has implemented it, gcc devs don't think it's useful (or not
> more useful than fixing bugs or adding more useful features first, and
> don't want to have to maintain it) and apparently noone else wants it
> badly enough to do more than open bugzilla reports requesting it.
>
> It probably wouldn't be useful to many people, even the people who
> think they want it.
>
> e.g. do you really want to enable -Wdouble-promotion ?

I can see why one might want all warnings. When you want to know what 
warnings would be useful to you, you can trust Wall/Wextra to make the 
right choice, or you have to go through the doc and add the warnings that 
seem relevant one by one. On the other hand, you could start with all 
warnings and remove the ones that are too noisy one by one, which might be 
easier (especially now that gcc prints the name of the W flag that 
controls a warning next to it), and reduces the chances that you'll miss 
a useful one. It doesn't mean at all that you are going to really use all 
warnings.

Obviously it would need someone willing to implement it...

-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GCC: How to get all warnings?
  2011-08-10 10:22       ` Marc Glisse
@ 2011-08-10 11:09         ` Jonathan Wakely
  2011-08-10 22:14           ` Andi Hellmund
  0 siblings, 1 reply; 9+ messages in thread
From: Jonathan Wakely @ 2011-08-10 11:09 UTC (permalink / raw)
  To: gcc-help; +Cc: noloader

On 10 August 2011 11:22, Marc Glisse wrote:
>
> Obviously it would need someone willing to implement it...

After that it needs to be maintained: if it's implemented naively then
everyone who adds a new warning has to include an additional change to
add the new warning to the "really all" set, which is an extra (small,
but not zero) burden on lots of people, lots of times in the future.

It has some value, but it also has some cost.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GCC: How to get all warnings?
  2011-08-10 11:09         ` Jonathan Wakely
@ 2011-08-10 22:14           ` Andi Hellmund
  0 siblings, 0 replies; 9+ messages in thread
From: Andi Hellmund @ 2011-08-10 22:14 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help, noloader

Hi,
> After that it needs to be maintained: if it's implemented naively then
> everyone who adds a new warning has to include an additional change to
> add the new warning to the "really all" set, which is an extra (small,
> but not zero) burden on lots of people, lots of times in the future.
>
> It has some value, but it also has some cost.
>    
I agree, but how about automatically generating a function from the 
*.opt files to enable all the warnings for the language and target begin 
in use. I think this could be a kind of "easy" from the attributes set 
for each option ...

But surely, someone has to do it :-)

Andi

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GCC: How to get all warnings?
  2011-08-10  9:22     ` Jonathan Wakely
  2011-08-10 10:22       ` Marc Glisse
@ 2011-08-15 10:15       ` Andrew Haley
  1 sibling, 0 replies; 9+ messages in thread
From: Andrew Haley @ 2011-08-15 10:15 UTC (permalink / raw)
  To: gcc-help

On 08/10/2011 10:22 AM, Jonathan Wakely wrote:
> On 10 August 2011 09:10, Jeffrey Walton wrote:
>> This is probably going to sound like a dumb question, but here goes:
>> why doen't GCC offer a switch to enable all warnings? And even better,
> 
> Noone has implemented it, gcc devs don't think it's useful (or not
> more useful than fixing bugs or adding more useful features first, and
> don't want to have to maintain it) and apparently noone else wants it
> badly enough to do more than open bugzilla reports requesting it.
> 
> It probably wouldn't be useful to many people, even the people who
> think they want it.

We can't even guarantee that some of the more obscure coding
standard warnings aren't mutually exclusive.  IME, most people
who say they want "all" warnings soon change their minds when
they discover the amount of useless crap that implies.

Andrew.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-08-15 10:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-10  3:15 GCC: How to get all warnings? Jeffrey Walton
2011-08-10  4:12 ` Jędrzej Dudkiewicz
2011-08-10  7:25 ` Jonathan Wakely
2011-08-10  8:10   ` Jeffrey Walton
2011-08-10  9:22     ` Jonathan Wakely
2011-08-10 10:22       ` Marc Glisse
2011-08-10 11:09         ` Jonathan Wakely
2011-08-10 22:14           ` Andi Hellmund
2011-08-15 10:15       ` Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).