Source: btrfs-tools
Version: 0.19+20101101-1
Severity: important
User: debian-...@lists.debian.org
Usertags: ftbfs-gcc-4.6
Tags: upstream

Hi,

btrfs-tools sets a number of variables it doesn't use.  See patch 1
for an example (I didn't fix the rest since I imagine upstream likes
to keep this code in sync with the linux-2.6 copy).

Unfortunately, that means gcc-4.6 -Wall -Werror errors out.  I think
for everyone's sanity, we should not be using -Werror for this --- gcc
may have subtly different warnings in different versions and on
different platforms that just do not matter for the build result.  So
how about this patch (#2)?

(Currently Debian's gcc-4.6 _works around_ the problem by making
-Wall -Werror imply -Wno-error=unused-but-set-variable.  So you might
want to use -Werror=unused-but-set-variable when testing.  See [1] for
details.)

Thanks for packaging btrfs userspace.  I'm happy to know it will be
there when I need it. :)

Regards,
Jonathan

[1] http://lists.debian.org/debian-devel-announce/2011/02/msg00012.html
From: Jonathan Nieder <jrnie...@gmail.com>
Date: Thu, 3 Mar 2011 03:01:31 -0600
Subject: Remove unused variable

This variable was never used, even when first introduced in v0.19~4
(Mixed back reference  (FORWARD ROLLING FORMAT CHANGE), 2009-05-29).
The function just uses btrfs_header_generation(buf) where needed
directly.

Noticed by "gcc-4.6 -Wunused-but-set-variable".

Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
---
 ctree.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/ctree.c b/ctree.c
index f70e10c..9dcb682 100644
--- a/ctree.c
+++ b/ctree.c
@@ -262,7 +262,6 @@ int __btrfs_cow_block(struct btrfs_trans_handle *trans,
                             struct extent_buffer **cow_ret,
                             u64 search_start, u64 empty_size)
 {
-       u64 generation;
        struct extent_buffer *cow;
        struct btrfs_disk_key disk_key;
        int level;
@@ -272,7 +271,6 @@ int __btrfs_cow_block(struct btrfs_trans_handle *trans,
        WARN_ON(root->ref_cows && trans->transid != root->last_trans);
 
        level = btrfs_header_level(buf);
-       generation = btrfs_header_generation(buf);
 
        if (level == 0)
                btrfs_item_key(buf, &disk_key, 0);
-- 
1.7.4.1

From: Jonathan Nieder <jrnie...@gmail.com>
Date: Thu, 3 Mar 2011 03:39:40 -0600
Subject: Making the build less brittle by no longer passing -Werror to gcc

While at it, use dpkg-buildflags to retrieve build flags for
consistent results whether we are being built using dpkg-buildpackage
or debian/rules directly.  Previously the rules would use CFLAGS from
the environment but it did not matter since the CFLAGS setting in the
upstream Makefile had higher precedence.

Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
---
 debian/changelog |    8 ++++++++
 debian/control   |    3 ++-
 debian/rules     |    7 ++++++-
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1a7b47b..ba78f8f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+btrfs-tools (0.19+20101101-1.1) local; urgency=low
+
+  * Removing -Werror from flags passed to gcc, for a less brittle build.
+  * Using dpkg-buildflags in rules to handle DEB_BUILD_OPTIONS=noopt and
+    DEB_CFLAGS_APPEND=-Werror from the build-time environment.
+
+ -- Jonathan Nieder <jrnie...@gmail.com>  Thu, 03 Mar 2011 03:38:24 -0600
+
 btrfs-tools (0.19+20101101-1) experimental; urgency=low
 
   * Merging upstream version 0.19+20101101.
diff --git a/debian/control b/debian/control
index 2a44180..7be2254 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,8 @@ Priority: optional
 Maintainer: Daniel Baumann <dan...@lists.debian-maintainers.org>
 Uploaders: Daniel Baumann <dan...@debian.org>
 Build-Depends:
- debhelper (>= 8), e2fslibs-dev, libacl1-dev, uuid-dev, zlib1g-dev
+ debhelper (>= 8), dpkg (>= 1.14.7),
+ e2fslibs-dev, libacl1-dev, uuid-dev, zlib1g-dev
 Standards-Version: 3.9.1
 Homepage: http://btrfs.wiki.kernel.org/
 Vcs-Browser: http://git.debian-maintainers.org/?p=daniel/btrfs-tools.git
diff --git a/debian/rules b/debian/rules
index 0ecd125..88cafb0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,6 +1,11 @@
 #!/usr/bin/make -f
 
 SHELL := sh -e
+CFLAGS := $(shell dpkg-buildflags --get CFLAGS)
+
+# NEEDSWORK: dpkg-buildflags could benefit from a more
+# peaceful way to specify the default optimization level.
+CFLAGS := $(patsubst -O2,-Os,$(CFLAGS))
 
 %:
        dh ${@}
@@ -11,7 +16,7 @@ override_dh_auto_clean:
        rm -f btrfs-image btrfstune version.h
 
 override_dh_auto_build:
-       CFLAGS="$(CFLAGS)" $(MAKE) all btrfsck btrfstune btrfs-image convert
+       $(MAKE) all btrfsck btrfstune btrfs-image convert CFLAGS='$(CFLAGS)'
 
 override_dh_auto_install:
        $(MAKE) DESTDIR=$(CURDIR)/debian/btrfs-tools prefix=/ bindir=/sbin 
mandir=/usr/share/man install
-- 
1.7.4.1

Reply via email to