Eivind LM wrote:
On Tue, 24 Feb 2009 18:57:58 +0100, Harvey Chapman
<hchapman-gcc-help@xxxxxxxx> wrote:
Ian Lance Taylor wrote:
The name -Wall was chosen some 20 years ago. Perhaps it was a mistake,
however it was decided, and documented, and has been used successfully,
for a long time. I think it would take a very persuasive argument to
change it now. That argument would need to be more than merely "the
name doesn't seem right for what it does." You need to consider the
cost of changing all the Makefiles out there which use it, and the
benefits of making the change.
Why not change it to -Wmost or -Wpopular and then mark -Wall as
deprecated for 3-5 years before removal. I would think that would be
a reasonable time frame for such a change with so much history. Or
just leave -Wall as-is, and just discourage further use via a
deprecated warning.
Deprecation sounds like a great idea. If I have a vote for new name,
then I give it to "-Wselect-popular-warnings" as suggested by Eljay.
I can think of three groups of people who would benefit from the
deprecation:
1) People who use the flag and believe that it actually means all
warnings. Why check the docs on something so obvious? These people
will be happy about the deprecation because it will make them realize
that there are more warnings they can enable.
I've been using GCC since '96 or so. I've always understood "-Wall" to
mean all relevant warnings, not every possible warning but the ones that
are deemed reasonable to find bugs in code.
2) People who have read the docs and are confused about the name (I am
in this group now). These people will keep asking questions about the
name unless it is deprecated.
Or they can learn from experience that "every possible warning under the
sun" is not actually a good thing, and then stop asking for that
functionality.
3) People who know the docs by heart and don't really think it matters
if the name says something else than what it does. These people won't
have to explain the flag over and over again for people from group 2.
I'm more interested in not breaking GCC. If my projects start building
with 1000s of useless warnings it means I'll have to either "fix" them
in the code (useless casts, etc) or disable them in my makefile. And
instead of just having -Wall -W I'd have "-Wall -Wno-stupid-warning1
-Wno-stuipid-warning2 .... 100 chars more ... -Wno-stupid-warning100".
I think most long term developers really just want the warnings for two
things. Things that are undefined behaviour, and things that are likely
a typo, e.g.
if (a = 4)
or
if (a << 1 + b)
etc...
Other arguments:
1) The name says "all", while the flag does not enable all.
It enables all useful flags, where "useful" is subjective but from what
I understand means "likely to flag real problems." Your flaw in your
reasoning is you think additional "scrutiny" is meaningful in the face
of a well understood standard.
2) The flag might change between versions. So some warnings included
in the flag might be removed, whereas the name suggests that it
includes at least everything you had before.
That's at least a reasonable concern.
3) Because it seems like a lot of people agree that the name is not
right, and has proven to cause confusion.
Wait till you have 10-15-20 years of development under your belt. Your
attitude will change.
4) It's not an argument to keep it even if it might have been
inconsistent for 20 years.
I don't know, it's served people well.
5) Deprecating it would avoid confusion with a possible future flag
that might actually enable all warnings.
And require [albeit trivial] changes to software for no net gain.
6) I might be running out of arguments, but I will buy you a beer once
it is deprecated, Ian :)
Learn C, then buy the beer.
To me "-Wall" should reflect all warnings that are likely to result in
the undesired behaviour. For things (like the type promotions you
posted earlier) where there is a clearly defined behaviour, it's less
desirable.
Sure in the expression (a << 1 + b) we know that + has precedence over
<<, but this is a classic typo people make when they probably meant (a
<< 1) + b. So that's worthy, in my opinion, of a warning.
Whereas, something like
float a = 4;
or
char b = 'c';
Are not since it's without a doubt clear what it means. And if your
only argument for more warnings is that you're unsure of the language
standard, then you need to re-evaluate what you're asking.
Tom