[patch] 1.11.0.svn: compiler warnings when building for i386 arch

Denys Vlasenko vda.linux at googlemail.com
Fri May 16 05:45:41 PDT 2008


On Friday 16 May 2008 12:59, Cristian Ionescu-Idbohrn wrote:
> > -		while (1) {
> > +		while (sz >= 0) {
> >
> > Why?
> 
> Yes, I know, unrelated, but it seemed less obfuscated to _not_ use an
> endless loop there.  'sz' before the loop is >=0 and thing changing
> (decreasing) in that loop is 'sz'.

This adds unnecessary operation. I didn't check whether gcc is smart enough
to not generate extra code.

> > -	int i, lineno;
> > +	size_t i, lineno;
> >
> >  	for (i = 0; i < KWS_WITH_DEFAULTS; i++)
> >  		keywords[i].handler(keywords[i].def, keywords[i].var);
> > @@ -344,7 +344,7 @@
> >  		for (i = 0; i < ARRAY_SIZE(keywords); i++) {
> >  			if (!strcasecmp(token, keywords[i].keyword)) {
> >  				if (!keywords[i].handler(line, keywords[i].var)) {
> > -					bb_error_msg("can't parse line %d in %s at '%s'",
> > +					bb_error_msg("can't parse line %u in %s at '%s'",
> >  							lineno, file, line);
> >
> > size_t can't be printed with %u
> 
> Hmm...  Are you sure?

Of course. If sizeof(int) != sizeof(size_t), it will fail.
--
vda


More information about the busybox mailing list