Re: Using -Werror in CFLAGS for a debian package build
peter green <email@example.com> writes:
> (note: this message quotes from multiple mails by different people)
> Wouter>First and foremost, I do not believe that setting -Werror in a
> Wouter>debian/rules file is the best way to maintain a package; -Werror is a
> Wouter>development option which should not be used in a release build (which a
> Wouter>Debian package is). When a package sets -Werror in its debian/rules
> Wouter>file, it *will* FTBFS when the default compiler is changed, while not
> Wouter>necessarily breaking the package itself. I don't think it adds value.
> The thing is that there are some warnings that really SHOULD be errors as
> code that generates them is almost certainly wrong. Generally a build
> failure is less serious than a subtuly broken package.
> A package maintainer could try and identify such warnings individually
> but I don't think many maintainers would be willing to go to that
> Maybe what is really needed is a -Werror=serious or similar option that
> turns the worst warnings (stuff like converting a pointer to/from an
> integer of the wrong size, incompatible implicit declarations and
> other stuff that indicates something is SERIOUSLY wrong) into errors
> leaving minor warnings (things that really just indicate that the code
> could do with a little cleanup) as warnings.
There should be an option to tune the severity of individual
warnings. Some warnings are seriously wrong code, other warnings though
are allways completly harmless (e.g. unused vars). It would be nice if
one could say
gcc -Werror -Wunused=info
to make warnings an error except -Wunused would be only informational
and not an error. That way one could explicitly ignore save warnings and
catch everything else.
Or the reverse
to turn only format warnings into errors.
Once you have that level of control suitable aliase could be defined to
toggle common sets of warnings into errors or info. Maybe something for
next years GSoC?