Content-Length: 15565 | pFad | http://lwn.net/Articles/434054/

The world of Chromium [LWN.net]
|
|
Subscribe / Log in / New account

The world of Chromium

The world of Chromium

Posted Mar 17, 2011 10:30 UTC (Thu) by nix (subscriber, #2304)
Parent article: The world of Chromium

-Werror in development code is great. -Werror in released code is great, *if* you know exactly what the compiler will complain about, so you can be sure newer versions won't complain about anything in your code tree. Without that, -Werror is just a way of randomly trapping people compiling your project with a different compiler (and, sometimes, the same compiler on a different architecture) to you.

In practice this means -Werror can only be used safely in released code for projects with enormous testing coverage (the Linux kernel might be able to get away with it if it wanted to), and in GCC bootstraping in stage2 and above, where you really do know what warnings the compiler will emit because you just compiled it.

Using -Werror in any other situation is probably a mistake.


to post comments

The world of Chromium

Posted Mar 17, 2011 11:00 UTC (Thu) by neilbrown (subscriber, #359) [Link] (4 responses)

I distribute mdadm with -Werror selected by default.

My theory is that it increases the likelyhood that any warnings will get reported back to me rather than silently ignored.

and I really do want to know about those warnings, because occasionally they point to real errors.

The world of Chromium

Posted Mar 17, 2011 13:12 UTC (Thu) by nix (subscriber, #2304) [Link]

The problem here is that there are still a number of GCC warnings which depend on details of optimization: a classic one is the 'may be used uninitialized' warning. With these, you have a choice: uglify your code, turn off all such warnings (assuming you know which ones they are and GCC provides a switch), or the warning may go away and come back later: and the warning may well be incorrect (getting the uninitialized warning right in all cases requires solving the halting problem, which is of course impossible).

(Recent GCC versions have moved nearly all such warnings into the front- and early middle-end, where they are not affected by architectural details and are consistent across platforms. #pragma GCC diagnostic may help, as well, but again is only supported on recent GCC versions.)

The world of Chromium

Posted Mar 17, 2011 23:15 UTC (Thu) by dirtyepic (guest, #30178) [Link] (2 responses)

And the first thing we do when packaging it is sed it out. :P

The world of Chromium

Posted Mar 17, 2011 23:32 UTC (Thu) by neilbrown (subscriber, #359) [Link] (1 responses)

You don't need sed, just
make CWFLAGS=
(I'm sure you do report warnings when you see them though, don't you?)

The world of Chromium

Posted Mar 18, 2011 4:55 UTC (Fri) by dirtyepic (guest, #30178) [Link]

Sorry I meant in general, not mdadm specifically. ;)

I'm a Gentoo developer, and as you can imagine the combination of -Werror with a largely uncontrolled build environment (eg. toolchain versions, CFLAGS, etc. are user-managed) makes us a little grumpy.

I can understand your point of view here, but when users can set any -W flag they want then bailing on every warning just isn't possible.

We do log "important" warning messages (ie. those most likely to be an actual problem in practice) and ask the user to report them upstream.

The world of Chromium

Posted Mar 17, 2011 23:31 UTC (Thu) by dirtyepic (guest, #30178) [Link]

Because most distributions enable additional warnings by default (eg. -Wformat, -D_FORTIFY_SOURCE=2), even the later stages of a GCC build are full of them (mostly from glibc functions declared with attribute warn_unused_result). A 2.6.38 kernel build with GCC 4.6 is full of unused-but-set warnings. -Werror by default is never a good idea.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://lwn.net/Articles/434054/

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy