On Mon, Jan 2, 2012 at 7:37 AM, Boris Zbarsky <
bzba...@mit.edu> wrote:
>
> In a sane world, yes. In practice, some of gcc's warnings are downright
> batty, and whether they appear or not depends on random things. Yes, I
> realize we're probably not going to make those particular warnings into
> errors, per prior discussion.
Can you specify which warnings you think are batty? I've looked
through all the GCC warnings recently and experimented extensively
with getting rid of the ones that appear in Mozilla. Apart from
-Winitialized, which has already been mentioned as a difficult mixed
bag, the only ones I think that we currently use that are clearly not
worthwhile are -Woverlength-strings (which triggers about 22 warnings,
and which bug 711895 will disable) and -Wmain (which triggers about 11
warnings).
> The other important bit is that a lot of the gcc warnings only appear in opt
> builds, which is the opposite of the usual setup where a debug build will
> tend to show problems (via assertions, etc) better than an opt build.
Can you give examples? dholbert mentioned -Winitialized and ones
relating to variables that are unused in opt builds due to them only
being used in assertions. Are there any other warnings that only show
up in opt builds?
> I
> almost never build opt locally except for performance testing, so if
> warning-as-error is enabled for opt-only warnings, I'd pretty much have to
> push every single patch I write to try.
Can you estimate what fraction of your patches you don't push to try?
For me it's a small number, maybe 10%.
(BTW, in case it's of interest, I've included some stats below about
which warnings get triggered for linux64 debug builds. They're from a
build that's a few weeks old so the numbers are a little out of date.
And I think I missed some in my post-processing.)
Nick
-----------------------------------------------------------------------------
currently enabled warnings (82408:5b4a90374698)
-----------------------------------------------------------------------------
total: 972 warnings
( 1) 173 (17.8%, 17.8%): -Wunused-but-set-variable [-Wall]
( 2) 134 (13.8%, 31.6%): -Wuninitialized [-Wall/-Wextra]
( 3) 126 (13.0%, 44.5%): -Wenum-compare [-Wall]
( 4) 70 ( 7.2%, 51.7%): -Woverloaded-virtual [C++ only,
specified explicitly]
( 5) 69 ( 7.1%, 58.8%): -Wformat [-Wall]
( 6) 65 ( 6.7%, 65.5%): -Wsign-compare [-Wextra [but
occurs for C++ code??]]
( 7) 44 ( 4.5%, 70.1%): -Wint-to-pointer-cast [default]
( 8) 42 ( 4.3%, 74.4%): -Wwrite-strings [default in C++]
( 9) 35 ( 3.6%, 78.0%): -Wparentheses [-Wall]
(10) 34 ( 3.5%, 81.5%): -Wmissing-field-initializers [-Wextra,
WARNINGS_CFLAGS only]
(11) 29 ( 3.0%, 84.5%): -Wpointer-to-int-cast [C only, default]
(12) 24 ( 2.5%, 86.9%): -Wunused-variable [-Wall]
(13) 23 ( 2.4%, 89.3%): -Wunused-result [default]
(14) 22 ( 2.3%, 91.6%): -Woverlength-strings [-pedantic]
(15) 15 ( 1.5%, 93.1%): -Wreorder [C++ only, -Wall]
(16) 11 ( 1.1%, 94.2%): -Wmain [default in C++,
-Wall/-pedantic in C]
(17) 11 ( 1.1%, 95.4%): -Wcpp [default]
(18) 9 ( 0.9%, 96.3%): -Wswitch [-Wall]
(19) 9 ( 0.9%, 97.2%): -Wdeprecated-declarations [default]
(20) 8 ( 0.8%, 98.0%): -Wunused-function [-Wall]
(21) 6 ( 0.6%, 98.7%): -Wconversion-null [C++ only, default]
(22) 4 ( 0.4%, 99.1%): -Wold-style-declaration [C only, -Wextra]
(23) 3 ( 0.3%, 99.4%): -Woverflow [default]
(24) 2 ( 0.2%, 99.6%): -Wtype-limits [-Wextra,
WARNINGS_CFLAGS only]
(25) 1 ( 0.1%, 99.7%): -Waddress [-Wall]
(26) 1 ( 0.1%, 99.8%): -Wclobbered [-Wextra,
WARNINGS_CFLAGS only]
(27) 1 ( 0.1%, 99.9%): -Wvla [-pedantic]
(28) 1 ( 0.1%,100.0%): -Wunused-value [-Wall]