John (Eljay) Love-Jensen wrote:
Hi everyone,
[Tom]> 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...
I don¹t mind keeping -Wall with the current meaning, and not deprecating it.
I, as a long term developer who has been developing for over 30 years, and
in C/C++ for over 20 years, using GCC since 2.95 came out, do wish that
there was a -Weverything flag that enabled all -W* toggle warnings.
I'm actually ok with *adding* a new macro flag [e.g. -Weverything]. I
just don't want the defaults to change so radically.
Why?
Because I use GCC as a lint-like tool.
I like to be able to see what warnings my code generates, vet those warnings
and vet my code, then decide to disable the warning or fix my code.
Which sounds reasonable to me. I don't dismiss things like splint
because I'm lazy or dislike standards. My position stems from
experience with the tools and to this day never finding a bug in my
software because of it. -Wall has found bugs, valgrind/gdb have helped
me find bugs, but never have I ran splint on my code base and actually
found a bug.
Maybe your situation is different, and I don't dismiss that.
I deeply appreciate that GCC has taken on incorporating (sensible) lint-like
functionality into the compiler itself, which uses -Wfoo toggles. (I can
even appreciate that -Wall is "select popular warnings", and -Wextra is
"select additional less popular warnings".)
Right now, I have a command-line for GCC g++ that is very, very, very, very
long, because I enable the warnings I know about. But I may have missed one
or two. And more may come out with the next version of GCC that I am
unaware about.
I wish I had a -Weverything flag.
I'd be more interested in better static analysis than more syntax
warnings. And GCC has done a bit of that, if for example, you use a
constant in an array index for an array of known dimensions GCC will
warn if the value is out of range. Things like that are more useful I'd
think.
I guess it also depends on your work flow standards too. Where I work
our standards are basically reasonably close to ISO C (except where we
start doing kernel or embedded work), and pass with the standard set of
"-Wall -W" flags without warnings.
Not to say we're 100% defect free, but of the (few) defects we have had,
extra syntax checks would not have found them. Typically they'd be
things like structure size mismatches, off by one errors, etc.
As long as I'm making wishes, I also wish warnings were emitted like this:
test.cpp:6: -Wunused warning: unused variable 'u'
...rather than...
test.cpp:6: warning: unused variable 'u'
Just my $0.02.
Perhaps a variant of that where it outputs a code instead and you can
look it up in a manpage so the output isn't as verbose, e.g.
test.cpp:6: (W43) warning: blah
Where W43 refers to -Wunused or something.
If you want to get on about formatting though, it would be nice to give
gcc a "I'm in 2009 with an ANSI VT100 terminal can you please highlight
text for me" option so that file names, line numbers, and the warning
appear in different colours allowing them to be scanned relatively quickly.
:-)
Tom