On Tuesday 04 August 2015 18:28:05 Lankswert, Patrick wrote:
> John,
> 
> I have mixed thoughts in this space. There are a number of contributions
> that the contributor clearly did not look at the warnings. In addition,
> there may be cases where a warning may be ok.

When I introduced -Werror for Qt, I got a LOT of negative comments and lots of 
people were disappointed and/or angry. A year later, our codebase is cleaner 
and -Werror catches real mistakes.

My solution is as follows:
 a) it's opt-in: no *user* of the library should ever see a -Werror 
compilation failure unless they want to (which implies they want to send a 
patch fixing it);

 b) it's a whitelist: we check which compilers we free of warnings with and 
then we add them to the whitelist. Untested compilers, including new versions 
of known compilers, don't get -Werror until someone makes a build and fixes the 
new warnings;

 c) it requires selectively disabling some errors or warnings
  c.1) the build has a few -Wno-error=xxxx that are pathological and cannot be 
fixed, like GCC's "-Wstrict-overflow" (assuming signed overflow does not occur 
when assuming that (X + c) < X is always false)

  c.2) the source code has quite a few #pragma (hidden behind a macro) to turn 
warnings on and off where they are false positives

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

Reply via email to