This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Should -Wmaybe-uninitialized be included in -Wall?


Hi,

On Thu, 11 Jul 2013, Gabriel Dos Reis wrote:

> > Arg, no.  -Werror is very useful for development and I'm sure that 
> > code quality increases because of it, but it should never be enabled 
> > by default for releases.  I think about 80% of the bugs we've had 
> > filed so far for packages failing to build against 4.8 are due to 
> > -Werror.
> 
> The fact that you have 80% failing to build is not in itself an argument 
> for not including -Werror in release mode. The real issue is whether 
> those warnings uncovered any real bugs.  If they don't, then either we 
> are emitting too many false positives, or those packages should have 
> turned off the offending diagnostics.

Not quite.  The problem is that the compiler is used for two completely 
different things:

1) by developers to develop their code, a development too.  They will use
   a certain version of GCC, hence enabling -Wall -Werror is indeed 
   good practice; even with the expectation that the developer will 
   eventually change the used GCC version implying different errors; this 
   will merely result in the source base to be improved by that developer 
   to also conform to the new warnings (and hopefully not in a way that 
   it warns with the old compiler again)
2) by users of software (which includes distributors as one of the largest 
   consumers of random source codes) as sort of install tool.  This 
   will most of the time _not_ be the version of the compiler that the 
   developer used when the software was released.  As we already 
   determined adding -Werror effectively makes the software require a very 
   specific GCC version, but only because of warnings.  
   Individual consumers of software usually are not inherently interested 
   in such warnings, and distributors have different ways of enforcing
   policies related to source code quality (e.g. by parsing build logs).
   Adding -Werror by developers for their released software is hence 
   neither required, nor even advised, it'll merely make life harder for 
   consumers.

Then, of course, there's a mixture between consumers and developers, who 
might indeed be interested in warnings with the intention of helping the 
sources developers.  Well, as they are developers themself, they should 
know a way to add -Werror themself.

So, no, -Werror for delivered stuff is no good idea.

> > Also, several distros patch gcc to enable additional warnings by 
> > default (eg. Debian, Ubuntu, and Gentoo enable -Wformat=security) that 
> > upstream may not see or be interested in. It's a big enough headache 
> > that we had to ban use of -Werror from our tree (instead we flag 
> > important warnings and output them at the end of the build).
> 
> Well, the issue isn't as clear cut as you make it sound.  Some distros
> build service
> monitor compiler outputs for some of these warnings and abort builds
> even if the package does not supply -Werror.

Yes, one reason why -Werror for application delivery is unnecessary.


Ciao,
Michael.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]