This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: -Wall by default
On 8 April 2012 16:16, James Cloos wrote:
>
> Sure. ?Making a few more of the -W flags on by default may be OK,
> depending on the chosen list. ?It is the idea of turing all possible
> warning options on by default which is unreasonable.
Noone's suggested doing that. As Gaby said, -Wall doesn't turn on all warnings.
> Defaulting to -Wall also fails as a user interface design. ?-Wall is
> a nice, short, sweet, easy to type optiong which one readily can add
> at any time.
So is -Wno-all
> ?Forcing one to have to find all of the -Wno-... options
> to avoid unwanted annoyances,
That applies even if -Wall isn't on by default. People who use -Wall
(which means lots of people) still have to use -Wno-xxx to disable the
warnings they don't want. Making -Wall on by default doesn't change
that.
Anyway, GCC prints the option that controls a warning as part of the
diagnostic, so it's trivial to find which options control the
diagnostics that are annoying you.
> or to the -Wno-all and a set of -Ws
> which one does want is far more cumbersome.
Why is using -Wno-all -Wfoo -Wbar "far more cumbersome" than what you
have to do to get the same effect today? i.e. -Wfoo -Wbar
Those points apply equally to what we have today and so aren't really
relevant to whether -Wall should be on by default or not.
> And what if new warning are added. ?Does anyone really want them *all*
> on by default as soon as the code lands?
That argument also applies equally to -Wall as it is today,
maintainers need to decide if new warnings should be included in -Wall
or not, as that affects everyone who uses -Wall (which is a large
number of users.) That wouldn't be any different if -Wall was enabled
by default.
> If there are some useful warning not already on by default which tend
> not to false-positive and provide useful, beneficial information when
> triggered, then it is reasonable to look into starting to default-enable
> them.
That's not far from what has been proposed (although -Wall currently
contains some warnings that don't fit into that category, so maybe a
-Wstandard set would be useful.
> ?Turning *all* of them on willy-nilly is not.
Noone's suggesting that.
FWIW we do sometimes have to close invalid bugzilla reports that
complain about no warning when the user simply failed to use -Wall, or
because the code is clearly wrong and they would have been told so if
they'd just used -Wall. That does imply that people who don't know
what they're doing (and so might benefit most from enabling warnings)
aren't aware of -Wall. The people who don't want -Wall (or
-Wstandard) enabled are likely to be the ones who know how to use
-Wno-all or whatever to get what they want.