On Sat, Nov 21, 2009 at 7:21 AM, rahul <rahulsin...@gmail.com> wrote:
>>I happen to find this warning very useful, just as I find our policy
>>to make warnings hard errors in our own code helpful.
> Yes, of course. That's a good practice. But what about the end-users
> who have to deal with warnings as hard errors.

I have been meaning to bring this up again.  I think I proposed this
before but was shot down.

We should whitelist known compiler versions that build successfully
with -Werror, and then turn it off for the rest.  Unless we have a
buildbot tracking a given compiler version, it is likely that -Werror
makes us unable to build with that version of the compiler.

Concrete proposal:
 - whitelist the compiler version used on our buildbots to always use -Werror
 - turn off -Werror by default on other compilers
 - make it easy to turn on -Werror back on if someone wants to fight
some warnings

I have been particularly frustrated with gcc warning bugs that have
been fixed in newer versions of gcc.  In older gccs, the following
code produces a "variable may be used uninitialized" warning depending
on your optimization settings.
  int x;
  { x = 3; }
  printf("%d\n", x);
The fix is to put in a redundant initialization of x, but people
(reasonably) will remove them when working on the code.
Here's a patch I've been working on to add these redundant initializers:
  
http://build.chromium.org/buildbot/try-server/builders/linux/builds/9235/steps/gclient/logs/patch
Smarter compilers already recognize the existing code is correct, but gcc warns.


Some example changes I have made in this area recently:
  "This is needed to work around a gcc bug when building with -Os."
(on the older gcc 4.3 only)
  http://src.chromium.org/viewvc/chrome?view=rev&revision=32186

  "fix a warning in the process_util unittest" (that only came up on
fta's build, not on our builds on ghardy or karmic)
  http://src.chromium.org/viewvc/chrome?view=rev&revision=32648

-- 
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev

Reply via email to