On Sun, 1 May 2011, Denys Vlasenko wrote:
> On Sunday 01 May 2011 10:38, Cristian Ionescu-Idbohrn wrote:
> > On Sat, 30 Apr 2011, Denys Vlasenko wrote:
> > > On Saturday 30 April 2011 18:34, Cristian Ionescu-Idbohrn wrote:
> > > > dist: debian unstable (aka sid)
> > > > gcc-4.6.real (Debian 4.6.0-6) 4.6.1 20110428 (prerelease)
> > > > BusyBox v1.19.0.git (2011-04-30 18:22:26 CEST) multi-call binary.
> > > >
> > > > I'd like to understand what's going on, why, and what I can do about it:
> > > >
> > > >   HOSTCC  scripts/kconfig/conf.o
> > > > scripts/kconfig/conf.c: In function 'conf_string':
> > > > scripts/kconfig/conf.c:176:20: warning: variable 'help' set but not used
> > > > [-Wunused-but-set-variable]
> > >
> > > Above, variable "help" is not used and can be deleted.
> > > You can send a patch which fixes it.
> >
> > Alright.  See attached patch proposals.
> > 3 + 2 + 1 warnings may now be gone, half a gazillion still lurking around ;)
>
> Applied, thanks

Along the same lines, see attached patch proposals.


Cheers,

-- 
Cristian
commit 4f93d4064a45831a3fcce813c4a5960d88ae16dc
Author: Cristian Ionescu-Idbohrn <[email protected]>
Date:   Sat May 7 12:12:26 2011 +0200

    The [-Wunused-but-set-variable] warnings.
    
    archival/libarchive/bz/compress.c:254:19: warning: variable 'nBytes' set but not used
    
    Signed-off-by: Cristian Ionescu-Idbohrn <[email protected]>

diff --git a/archival/libarchive/bz/compress.c b/archival/libarchive/bz/compress.c
index 6f1c70a..f936717 100644
--- a/archival/libarchive/bz/compress.c
+++ b/archival/libarchive/bz/compress.c
@@ -251,7 +251,7 @@ void sendMTFValues(EState* s)
 {
 	int32_t v, t, i, j, gs, ge, totc, bt, bc, iter;
 	int32_t nSelectors, alphaSize, minLen, maxLen, selCtr;
-	int32_t nGroups, nBytes;
+	int32_t nGroups;
 
 	/*
 	 * uint8_t len[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
@@ -512,7 +512,6 @@ void sendMTFValues(EState* s)
 			}
 		}
 
-		nBytes = s->numZ;
 		bsW(s, 16, inUse16);
 
 		inUse16 <<= (sizeof(int)*8 - 16); /* move 15th bit into sign bit */
@@ -528,7 +527,6 @@ void sendMTFValues(EState* s)
 	}
 
 	/*--- Now the selectors. ---*/
-	nBytes = s->numZ;
 	bsW(s, 3, nGroups);
 	bsW(s, 15, nSelectors);
 	for (i = 0; i < nSelectors; i++) {
@@ -538,8 +536,6 @@ void sendMTFValues(EState* s)
 	}
 
 	/*--- Now the coding tables. ---*/
-	nBytes = s->numZ;
-
 	for (t = 0; t < nGroups; t++) {
 		int32_t curr = s->len[t][0];
 		bsW(s, 5, curr);
@@ -551,7 +547,6 @@ void sendMTFValues(EState* s)
 	}
 
 	/*--- And finally, the block data proper ---*/
-	nBytes = s->numZ;
 	selCtr = 0;
 	gs = 0;
 	while (1) {

commit 77d496d2bd030096c19e20a0ebe465f998974b9a
Author: Cristian Ionescu-Idbohrn <[email protected]>
Date:   Sat May 7 12:06:15 2011 +0200

    The [-Wunused-but-set-variable] warnings.
    
    archival/dpkg.c:712:6: warning: variable 'status_len' set but not used
    archival/dpkg.c:711:6: warning: variable 'flag_len' set but not used
    archival/dpkg.c:710:6: warning: variable 'want_len' set but not used
    
    Signed-off-by: Cristian Ionescu-Idbohrn <[email protected]>

diff --git a/archival/dpkg.c b/archival/dpkg.c
index f8e349d..8899d17 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -702,28 +702,21 @@ static unsigned get_status(const unsigned status_node, const int num)
 
 static void set_status(const unsigned status_node_num, const char *new_value, const int position)
 {
-	const unsigned new_value_len = strlen(new_value);
 	const unsigned new_value_num = search_name_hashtable(new_value);
 	unsigned want = get_status(status_node_num, 1);
 	unsigned flag = get_status(status_node_num, 2);
 	unsigned status = get_status(status_node_num, 3);
-	int want_len = strlen(name_hashtable[want]);
-	int flag_len = strlen(name_hashtable[flag]);
-	int status_len = strlen(name_hashtable[status]);
 	char *new_status;
 
 	switch (position) {
 		case 1:
 			want = new_value_num;
-			want_len = new_value_len;
 			break;
 		case 2:
 			flag = new_value_num;
-			flag_len = new_value_len;
 			break;
 		case 3:
 			status = new_value_num;
-			status_len = new_value_len;
 			break;
 		default:
 			bb_error_msg_and_die("DEBUG ONLY: this shouldnt happen");

commit 5a309f079f24c5256aaa8e18a842fe7ce0fec58d
Author: Cristian Ionescu-Idbohrn <[email protected]>
Date:   Sat May 7 11:53:20 2011 +0200

    The [-Wunused-but-set-variable] warnings.
    
    editors/vi.c:539:6: warning: variable 'size' set but not used
    
    Signed-off-by: Cristian Ionescu-Idbohrn <[email protected]>

diff --git a/editors/vi.c b/editors/vi.c
index b4f263d..e1f3724 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -536,7 +536,6 @@ static void edit_file(char *fn)
 #define cur_line edit_file__cur_line
 #endif
 	int c;
-	int size;
 #if ENABLE_FEATURE_VI_USE_SIGNALS
 	int sig;
 #endif
@@ -545,7 +544,6 @@ static void edit_file(char *fn)
 	rawmode();
 	rows = 24;
 	columns = 80;
-	size = 0;
 	IF_FEATURE_VI_ASK_TERMINAL(G.get_rowcol_error =) query_screen_dimensions();
 #if ENABLE_FEATURE_VI_ASK_TERMINAL
 	if (G.get_rowcol_error /* TODO? && no input on stdin */) {

commit 10c114c13bbbc2b76104543ffa6bc1dc84f02132
Author: Cristian Ionescu-Idbohrn <[email protected]>
Date:   Sat May 7 11:48:45 2011 +0200

    The [-Wunused-but-set-variable] warnings.
    
    shell/hush.c:4388:13: warning: variable 'pos' set but not used
    
    Signed-off-by: Cristian Ionescu-Idbohrn <[email protected]>

diff --git a/shell/hush.c b/shell/hush.c
index d3e957c..0400379 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -4385,11 +4385,15 @@ static struct pipe *parse_stream(char **pstring,
 			break;
 #if ENABLE_HUSH_TICK
 		case '`': {
+# if !BB_MMU
 			unsigned pos;
+# endif
 
 			o_addchr(&dest, SPECIAL_VAR_SYMBOL);
 			o_addchr(&dest, '`');
+# if !BB_MMU
 			pos = dest.length;
+# endif
 			if (!add_till_backquote(&dest, input, /*in_dquote:*/ 0))
 				goto parse_error;
 # if !BB_MMU
@@ -4397,7 +4401,9 @@ static struct pipe *parse_stream(char **pstring,
 			o_addchr(&ctx.as_string, '`');
 # endif
 			o_addchr(&dest, SPECIAL_VAR_SYMBOL);
+# if !BB_MMU
 			//debug_printf_subst("SUBST RES3 '%s'\n", dest.data + pos);
+# endif
 			break;
 		}
 #endif

commit 86f51d5fe70be4cec8c6893b05aa19bd8a39dce7
Author: Cristian Ionescu-Idbohrn <[email protected]>
Date:   Sat May 7 11:43:13 2011 +0200

    The [-Wunused-but-set-variable] warnings.
    
    networking/ntpd.c:1748:19: warning: variable 'version' set but not used
    
    Signed-off-by: Cristian Ionescu-Idbohrn <[email protected]>

diff --git a/networking/ntpd.c b/networking/ntpd.c
index e27dbaa..1a2da5a 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -1745,7 +1745,6 @@ static NOINLINE void
 recv_and_process_client_pkt(void /*int fd*/)
 {
 	ssize_t          size;
-	uint8_t          version;
 	len_and_sockaddr *to;
 	struct sockaddr  *from;
 	msg_t            msg;
@@ -1793,7 +1792,6 @@ recv_and_process_client_pkt(void /*int fd*/)
 	msg.m_rootdelay = d_to_sfp(G.rootdelay);
 //simple code does not do this, fix simple code!
 	msg.m_rootdisp = d_to_sfp(G.rootdisp);
-	version = (query_status & VERSION_MASK); /* ... >> VERSION_SHIFT - done below instead */
 	msg.m_refid = G.refid; // (version > (3 << VERSION_SHIFT)) ? G.refid : G.refid3;
 
 	/* We reply from the local address packet was sent to,

commit d4ed2c1d45b004d7b02c95cb59d69e7110b3d18d
Author: Cristian Ionescu-Idbohrn <[email protected]>
Date:   Sat May 7 11:37:16 2011 +0200

    The [-Wunused-but-set-variable] warnings.
    
    editors/vi.c:1694:9: warning: variable 'sp' set but not used
    
    Signed-off-by: Cristian Ionescu-Idbohrn <[email protected]>

diff --git a/editors/vi.c b/editors/vi.c
index fd8bd0f..b4f263d 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -1690,12 +1690,16 @@ static char *char_insert(char *p, char c) // insert the char c at 'p'
 			p = text_hole_delete(p, p);	// shrink buffer 1 char
 		}
 	} else {
+#if ENABLE_FEATURE_VI_SETOPTS
 		// insert a char into text[]
 		char *sp;		// "save p"
+#endif
 
 		if (c == 13)
 			c = '\n';	// translate \r to \n
+#if ENABLE_FEATURE_VI_SETOPTS
 		sp = p;			// remember addr of insert
+#endif
 		p += 1 + stupid_insert(p, c);	// insert the char
 #if ENABLE_FEATURE_VI_SETOPTS
 		if (showmatch && strchr(")]}", *sp) != NULL) {
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to