compiler warnings, -Werror, etc.
- From: Colin Walters <walters verbum org>
- To: desktop-devel-list gnome org
- Subject: compiler warnings, -Werror, etc.
- Date: Fri, 27 Jul 2012 10:57:31 -0400
Hi,
TL;DR version
=============
I'd like to avoid having to pass various different configure flags to
modules to disable -Werror.
For compiler warning defaults, I think something similar what Dan
Winship has in libsoup is what we should replicate across more GNOME
modules:
http://git.gnome.org/browse/libsoup/tree/configure.ac?id=f5902fce98ae0314f0d9ca6e544895548c94a456#n339
It's better than the GNOME_COMPILE_WARNINGS macro in gnome-common right
now, and *definitely* better than various modules having -Wall -Werror.
Longer version
==============
First, compiler warnings range widely in how important they are. Some
of them, like -Wmissing-prototypes, are pretty much always indicative of
a serious problem in your code. Others like -Wmaybe-uninitialzed are
actually *heuristics* - the GCC manual clearly states that GCC may in
fact be wrong, and that one even has "maybe" in the name.
This gets to the next problem, which is that -Wall includes
-Wmaybe-uninitialized and other heuristics like -Wstrict-aliasing. Then
combine that with the fact that some people have got it in their head
that "-Wall -Werror" is the Right Thing, what actually ends up happening
is your code only compiles on a *particular version* of gcc. That just
doesn't work in a distributed project like GNOME, where various bits get
reused by different projects and products on different schedules etc.
Also, -Wdeprecated-declarations with -Werror makes the entire concept of
deprecating things pointless. The GNOME build shouldn't immediately
blow up because we deprecate something in GLib.
Finally, sadly -Wformat-security *isn't* in -Wall (at least in GCC 4.7),
but regardless, everyone should add -Werror=format-security like
basically now =)
So I think what Dan has is more the Right Thing - make the compiler
warnings that you should *never* hit into explicit errors. That
establishes a minimum baseline. Maintainers should feel free to make
some other things into errors as they wish (-Werror=unused-but-set), but
please don't use -Werror=deprecated-declarations or
-Werror=mabe-uninitialized.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]