Skip to contentSkip to conversation

btrfs progs 0.18 compilation fixes for gcc 4.0.2

PATCH Andi Kleen 1 participant 1 message Apr 25, 2009 Btrfs file system

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

gcc 4.0.2 complained about various uninitialized variables in btrfs progs 0.18, which bombed out with -Werror.
I think the file-item.c was actually valid and could indeed return an uninitialized return value from very brief code reading (could be wrong on that)
Here's the patch I used to make it compile.

extent-tree.c renamed from extent-tree.c-o +1 -1
diff -u btrfs-progs-0.18/extent-tree.c-o btrfs-progs-0.18/extent-tree.c
@@ -2564,7 +2564,7 @@
 	u64 total_metadata = 0;
 	u64 chunk_objectid;
 	int ret;
-	int bit;
+	int bit = 0;
 	struct btrfs_root *extent_root;
 	struct btrfs_block_group_cache *cache;
 	struct extent_io_tree *block_group_cache;
file-item.c renamed from file-item.c-o +1 -1
diff -u btrfs-progs-0.18/file-item.c-o btrfs-progs-0.18/file-item.c
@@ -193,7 +193,7 @@
 			  struct btrfs_root *root, u64 alloc_end,
 			  u64 bytenr, char *data, size_t len)
 {
-	int ret;
+	int ret = 0;
 	struct btrfs_key file_key;
 	struct btrfs_key found_key;
 	u64 next_offset = (u64)-1;
btrfs-image.c renamed from btrfs-image.c-o +1 -1
diff -u btrfs-progs-0.18/btrfs-image.c-o btrfs-progs-0.18/btrfs-image.c
@@ -249,7 +249,7 @@
 static int metadump_init(struct metadump_struct *md, struct btrfs_root *root,
 			 FILE *out, int num_threads, int compress_level)
 {
-	int i, ret;
+	int i, ret = 0;
 
 	memset(md, 0, sizeof(*md));
 	pthread_cond_init(&md->cond, NULL);
Signature · 1 line
[email protected] -- Speaking for myself only.