Enable Werrror by default
RFC 1/1 Enable Werrror by default
I'd like to enable Werror by default. I've been using --enable-werror locally for a while now, and it's been extremely useful in picking up dumb errors (like the recent stellaris_enet.c breakage).
Any objections?
You can of course configure with --disable-werror if you really want the force things to build.
Paul
From 5ccaebfce38fc161a776725c6c945b2173459397 Mon Sep 17 00:00:00 2001
From: Paul Brook <[email protected]>
Date: Thu, 11 Jun 2009 13:31:46 +0100
Subject: [PATCH] Enable Werror by default
--- configure | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
configure +1 -5
@@ -356,11 +356,7 @@ else fi [ -f "$workdir/vl.c" ] || source_path_used="yes" -werror="no" -# generate compile errors on warnings for development builds -#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then -#werror="yes"; -#fi +werror="yes" for opt do optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
Signature · 1 line
1.6.3.1
Quoted 5 lines · Paul Brook
I'd like to enable Werror by default. I've been using --enable-werror locally for a while now, and it's been extremely useful in picking up dumb errors (like the recent
stellaris_enet.cbreakage).Any objections?
IIRC, qemu is not warnings clean on Darwin.
But adding -Werror may increase the pressure :-)
Quoted 4 lines · Paul Brook
I'd like to enable Werror by default. I've been using --enable-werror locally for a while now, and it's been extremely useful in picking up dumb errors (like the recent
stellaris_enet.cbreakage).Any objections?
It's going to break Windows and more recent versions of GCC.
Regards,
Anthony Liguori
Quoted 4 lines
You can of course configure with --disable-werror if you really want the force things to build.
Paul
Quoted 11 lines · On Thursday 11 June 2009 14:46:18 Tristan Gingold wrote:
Quoted 7 lines · Paul Brook
I'd like to enable Werror by default. I've been using --enable- werror locally
for a while now, and it's been extremely useful in picking up dumb errors
(like the recentstellaris_enet.cbreakage).Any objections?
IIRC, qemu is not warnings clean on Darwin.
But adding -Werror may increase the pressure :-)
pthreads are not -Wshadow or -Wnested-extern warning clean by design on many OS's.
Christoph
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
Quoted 8 lines · Paul Brook
I'd like to enable Werror by default. I've been using --enable-werror locally for a while now, and it's been extremely useful in picking up dumb errors (like the recent
stellaris_enet.cbreakage).Any objections?
You can of course configure with --disable-werror if you really want the force things to build.
Based on experiences with other projects:
1) Release tarballs should not ship with -Werror on by default - e.g. new gcc comes along with new warnings and the tarball build fails with no benefit to anyone
2) Anyone submitting patches should build with -Werror and make sure they don't introduce new warnings
3) People with newer gcc are likely to be tripped up by warnings introduced by others with older gcc[1]
4) It's debatable whether builds from git should default to -Werror - on the plus side it helps ensure (2) happens, on the minus side if a warning does sneak in, it makes life a pain for everyone until a fix gets applied
IMHO, we should enable it by default for git builds.
Cheers,
Mark.
[1] e.g. with gcc-4.4.0, but not with gcc-4.3.2:
hw/virtio-blk.c:302: warning: ‘blkcfg.size_max’ is used uninitialized in this function
Quoted 10 lines · On Thursday 11 June 2009 15:14:46 Mark McLoughlin wrote:
Quoted 8 lines · Paul Brook
I'd like to enable Werror by default. I've been using --enable-werror locally for a while now, and it's been extremely useful in picking up dumb errors (like the recent
stellaris_enet.cbreakage).Any objections?
You can of course configure with --disable-werror if you really want the force things to build.
Quoted 8 lines
Based on experiences with other projects:
1) Release tarballs should not ship with -Werror on by default - e.g. new gcc comes along with new warnings and the tarball build fails with no benefit to anyone
2) Anyone submitting patches should build with -Werror and make sure they don't introduce new warnings
Newer gcc enable warnings by default older versions already have as well.
Quoted 10 lines
3) People with newer gcc are likely to be tripped up by warnings introduced by others with older gcc[1]
4) It's debatable whether builds from git should default to -Werror - on the plus side it helps ensure (2) happens, on the minus side if a warning does sneak in, it makes life a pain for everyone until a fix gets applied
IMHO, we should enable it by default for git builds.
Quoted 7 lines
Cheers,
Mark.[1] e.g. with gcc-4.4.0, but not with gcc-4.3.2:
hw/virtio-blk.c:302: warning: ‘blkcfg.size_max’ is used uninitialized in
this function
You should see the same warning with gcc 4.3.2 -Wuninitialized , too.
Christoph
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
Quoted 2 lines
hw/virtio-blk.c:302: warning: ‘blkcfg.size_max’ is used uninitialized in
this function
By my reading that's an actual bug, and uninitialized data is leaking out to the guest.
Paul
Am 11.06.2009 um 14:46 schrieb Tristan Gingold:
Quoted 11 lines · Paul Brook
Quoted 6 lines
I'd like to enable Werror by default. I've been using --enable-werror locally for a while now, and it's been extremely useful in picking up dumb errors (like the recent
stellaris_enet.cbreakage).Any objections?
IIRC, qemu is not warnings clean on Darwin.
But adding -Werror may increase the pressure :-)
Those producing the warnings != those seeing the build breakage.
We've been reporting an incredibly large number of warnings on Solaris 10 in --std=gnu99 mode (which had become necessary, unfortunately), fixing which would seem to require a major refactoring of the softfloat support iirc.
And yes, there is at least one warning on Darwin, outside Cocoa. I'll take a look at that later.
Other packages restrict such flags to an --enable-maintainer-mode configure flag btw.
Andreas
Quoted 2 lines · Mark McLoughlin
2) Anyone submitting patches should build with -Werror and make sure they don't introduce new warnings
And in libvirt this is codified in the HACKING file, along with several other tests that patch submitters are required to run:
http://git.et.redhat.com/?p=libvirt.git;a=blob;f=HACKING;hb=HEAD
(tip #5)
Rich.
Signature · 4 lines
Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 75 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
Quoted 7 lines · Paul Brook
I'd like to enable Werror by default. I've been using --enable-werror locally
for a while now, and it's been extremely useful in picking up dumb errors (like the recentstellaris_enet.cbreakage).Any objections?
I would recommend only making this the default for linux-x86 and linux-x86_64 hosts,
My experience is that it is extremely unlikely that codes that compiles warning-free on Linux
will do the same on Windows or Darwin. Even changing compiler versions can result in
very surprising things.
Quoted 1 line · David Turner
Even changing compiler versions can result in very surprising things.
For this reason, amongst others, I prefer not to use -Werror by default.
I gather that changing code optimisation settings can also result in surprising things... and then there's FORTIFY_SOURCE...
Using more specific options such as -Werror=format on versions of GCC that support it might be more reasonable... but care needs to be taken. -Werror[=-]implicit-function-declaration is probably a sensible one, but note that GCC 4.4 seems to have a different name for that option than earlier releases.
Otherwise, you can almost certainly guarantee there there will be distributions that forget to disable -Werror, forcing you to alter their packages to get them to build. :-(
Note also that enabling -Werror will *discourage* the use of additional warning options that would be helpful, despite being slightly noisy.
Signature · 1 line
Stuart Brady
Quoted 22 lines · Mark McLoughlin
Quoted 6 lines · Paul Brook
I'd like to enable Werror by default. I've been using --enable-werror locally for a while now, and it's been extremely useful in picking up dumb errors (like the recent
stellaris_enet.cbreakage).Any objections?
You can of course configure with --disable-werror if you really want the force things to build.
Based on experiences with other projects:
1) Release tarballs should not ship with -Werror on by default - e.g. new gcc comes along with new warnings and the tarball build fails with no benefit to anyone
2) Anyone submitting patches should build with -Werror and make sure they don't introduce new warnings
3) People with newer gcc are likely to be tripped up by warnings introduced by others with older gcc[1]
Quoted 7 lines
4) It's debatable whether builds from git should default to -Werror - on the plus side it helps ensure (2) happens, on the minus side if a warning does sneak in, it makes life a pain for everyone until a fix gets applied
IMHO, we should enable it by default for git builds.
How about the following? It currently only enables werror for Linux hosts and git builds.
Regards,
Anthony Liguori
commit ba59b4615be2b9b989b425bad2499f47a6928d5c
Author: Anthony Liguori <[email protected]> Date: Thu Jun 11 13:28:25 2009 -0500
Enable -Werror by default for git builds on Linux hosts
Additional hosts can be added to the white list as they are confirmed to build with --enable-werror.
configure +13 -5
@@ -356,11 +356,7 @@ else fi [ -f "$workdir/vl.c" ] || source_path_used="yes" -werror="no" -# generate compile errors on warnings for development builds -#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then -#werror="yes"; -#fi +werror="" for opt do optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
@@ -657,6 +653,18 @@ if test ! -x "$(which cgcc 2>/dev/null)"; then sparse="no" fi +# Consult white-list to determine whether to enable werror +# by default. Only enable by default for git builds +if test -z "$werror" ; then + z_version=`cut -f3 -d. $source_path/VERSION` + if test "$z_version" = "50" -a \ + "$linux" = "yes" ; then + werror="yes" + else + werror="no" + fi +fi + # # Solaris specific configure tool chain decisions #
Quoted 3 lines · Anthony Liguori
How about the following? It currently only enables werror for Linux hosts and git builds.
...
configure if test ! -x "$(which cgcc 2>/dev/null)"; then · line 660
Quoted 5 lines
configure +5
-0+# Consult white-list to determine whether to enable werror +# by default. Only enable by default for git builds +if test -z "$werror" ; then + z_version=`cut -f3 -d. $source_path/VERSION` + if test "$z_version" = "50" -a \
Looks good, except this will enable it in kvm-XX releases, and not in future stable branches.
How about just 'test -d $source_path/.git/' ?
Cheers,
Mark.
Quoted 8 lines · Mark McLoughlin
Quoted 3 lines · Anthony Liguori
How about the following? It currently only enables werror for Linux hosts and git builds.
...
Quoted 10 lines
configure if test ! -x "$(which cgcc 2>/dev/null)"; then · line 660
Quoted 6 lines
configure +5
-0+# Consult white-list to determine whether to enable werror +# by default. Only enable by default for git builds +if test -z "$werror" ; then + z_version=`cut -f3 -d. $source_path/VERSION` + if test "$z_version" = "50" -a \Looks good, except this will enable it in kvm-XX releases, and not in future stable branches.
My main requirement is that I don't have to change anything when making a tarball release.
kvm releases carry a KVM_VERSION file that could be used to disable werror.
It's a good point about the stable branch though. I don't know the best way to deal with that. Disabling werror more than we could is certainly better than enabling it more than we should though.
Quoted 2 lines
How about just 'test -d $source_path/.git/' ?
Makes me a little nervous to add git-knowledge to configure.
Regards,
Anthony Liguori
Quoted 4 lines
Cheers,
Mark.
configure if test ! -x "$(which cgcc 2>/dev/null)"; then · line 660
Quoted 4 lines
How about the following? It currently only enables werror for Linux hosts and git builds.
configure +2
-0+ z_version=`cut -f3 -d. $source_path/VERSION` + if test "$z_version" = "50" -a \
Looks ok to me.
FWIW I think testing for the presence of .git would be a bad idea.
Paul