Hi,
Sorry, with holidays, I lack of time.
Attached, a patch that comment out all unused variables and associated
code.
This patch is mainly for stable because the to-be-packaged version
(3.2.2) dont appear to have this issue (just quick checked, I'm not
sure)
It build fine with the patch and gcc 4.6.1 :)
Cheers,
xakz
--
Maxime Chatelle, human from earth, 01000.cm94IGxvdmVyCg==.kpr
79E0 25F5 06C5 5C7F F57C BADD 13EE 911A 8A1A 9DE9
From 744ffaed974a1a6169735ea0bcaefea28f37058e Mon Sep 17 00:00:00 2001
From: Maxime Chatelle
Date: Wed, 13 Jul 2011 15:03:06 +0200
Subject: [PATCH] Commented out unused variables and associated codes. Was
FTBFS with -Wall -Wextra -Werror and gcc (>> 4.6.1) No
modification done in code logic.
Bug-Debian: http://bugs.debian.org/625392
---
Grow.c |4 ++--
Query.c |5 +++--
mdadm.c |4 +++-
mdmon.c |8
super1.c | 10 ++
sysfs.c |4 ++--
6 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/Grow.c b/Grow.c
index 0571f5b..aeb053a 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1981,7 +1981,7 @@ int Grow_continue(int mdfd, struct supertype *st, struct mdinfo *info,
unsigned long long *offsets;
int d;
struct mdinfo *sra, *sd;
- int rv;
+ /* int rv; // unused: disabled code L2070 */
unsigned long cache;
int done = 0;
@@ -2067,7 +2067,7 @@ int Grow_continue(int mdfd, struct supertype *st, struct mdinfo *info,
if (fds[sd->disk.raid_disk] < 0) {
fprintf(stderr, Name ": %s: cannot open component %s\n",
info->sys_name, dn?dn:"-unknown-");
-rv = 1;
+/* rv = 1; */
goto release;
}
free(dn);
diff --git a/Query.c b/Query.c
index 8847be7..d2b0685 100644
--- a/Query.c
+++ b/Query.c
@@ -35,7 +35,8 @@ int Query(char *dev)
int fd = open(dev, O_RDONLY);
int vers;
int ioctlerr;
- int superror, superrno;
+ int superror;
+ /* int superrno; // unused: disabled code L88 */
struct mdinfo info;
mdu_array_info_t array;
struct supertype *st = NULL;
@@ -84,7 +85,7 @@ int Query(char *dev)
st = guess_super(fd);
if (st) {
superror = st->ss->load_super(st, fd, dev);
- superrno = errno;
+ /* superrno = errno; // unused */
} else
superror = -1;
close(fd);
diff --git a/mdadm.c b/mdadm.c
index 08e8ea4..7d23fff 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -102,7 +102,7 @@ int main(int argc, char *argv[])
char *shortopt = short_options;
int dosyslog = 0;
int rebuild_map = 0;
- int auto_update_home = 0;
+ /* int auto_update_home = 0; // unused: disabled code L354 & L1231 */
char *subarray = NULL;
int print_help = 0;
@@ -1228,11 +1228,13 @@ int main(int argc, char *argv[])
cnt++;
acnt++;
}
+#if 0 /* auto_update_home unused, so disabling this code */
if (rv2 == 1)
/* found something so even though assembly failed we
* want to avoid auto-updates
*/
auto_update_home = 0;
+#endif
} while (rv2!=2);
/* Incase there are stacked devices, we need to go around again */
} while (acnt);
diff --git a/mdmon.c b/mdmon.c
index e416b2e..cc16cd4 100644
--- a/mdmon.c
+++ b/mdmon.c
@@ -351,7 +351,7 @@ static int mdmon(char *devname, int devnum, int must_fork, int takeover)
struct sigaction act;
int pfd[2];
int status;
- int ignore;
+ /* int ignore; //unused: disabled in L463 & L511 & L514 */
pid_t victim = -1;
int victim_sock = -1;
@@ -460,7 +460,7 @@ static int mdmon(char *devname, int devnum, int must_fork, int takeover)
if (victim >= 0)
victim_sock = connect_monitor(container->devname);
- ignore = chdir("/");
+ /*ignore = */ chdir("/");
if (!takeover && victim > 0 && victim_sock >= 0) {
if (fping_monitor(victim_sock) == 0) {
fprintf(stderr, "mdmon: %s already managed\n",
@@ -508,10 +508,10 @@ static int mdmon(char *devname, int devnum, int must_fork, int takeover)
close(0);
open("/dev/null", O_RDWR);
close(1);
- ignore = dup(0);
+ /*ignore =*/ dup(0);
#ifndef DEBUG
close(2);
- ignore = dup(0);
+ /*ignore =*/ dup(0);
#endif
do_manager(container);
diff --git a/super1.c b/super1.c
index 01473d1..ff9d0c4 100644
--- a/super1.c
+++ b/super1.c
@@ -111,7 +111,7 @@ static unsigned int calc_sb_1_csum(struct mdp_superblock_1 * sb)
unsigned long long newcsum;
int size = sizeof(*sb) + __le32_to_cpu(sb->max_dev)*2;
unsigned int *isuper = (unsigned int*)sb;
- int i;
+ /* int i; //unused */
/* make sure I can count... */
if (offsetof(struct mdp_superblock_1,data_offset) != 128 ||
@@ -123,7 +123,7 @@ static unsigned int calc_sb_1_csum(struct mdp_superblock_1 * sb)
disk_csum = sb->sb_csum;
sb->sb_csum = 0;
newcsum = 0;
- for (i=0; size>=4; size -= 4 ) {
+ for (; size>=4; size -= 4 ) {
newcsum += __le32_to_cpu(*isuper);
isuper++;
}
@@ -387,13 +387,15 @@ static void examine_super1(struct supertype *st, char *homehost)
printf(" Array State : ");
for (d=0; d<__le32_to_cpu(sb->raid_disks) + delta_extra; d++) {
int cnt = 0;
- int me = 0;
+ /* int me = 0; //unused *