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

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Fri May 16 03:59:46 PDT 2008


On Thu, 15 May 2008, Denys Vlasenko wrote:

> -		if (opt == EOF)
> +		if ((int)opt == EOF)
>
> First, getopt manpage says that it returns -1, not EOF
> (EOF is an stdio.h thing and seem to be unrelated). Second,
> it's better to change opt from unsigned to int.

Good point.

> -	int i;
> +	size_t i;
>  	for (i = 0; i < ARRAY_SIZE(out_spec); i++) {
>
> On some arches size_t is 64 bit. I will change ARRAY_SIZE macro to return
> unsigned instead.

Alright.

> -		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'.

> -	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?

,----
| typedef unsigned int size_t;
`----

,----
| o,u,x,X
|        The unsigned int argument is converted to  unsigned  octal  (o),
|        unsigned  decimal  (u),  or unsigned hexadecimal (x and X) nota-
`----


> -static int inline smtp_check(const char *fmt, int code)
> +static ALWAYS_INLINE int smtp_check(const char *fmt, int code)
>  {
>  	return smtp_checkp(fmt, NULL, code);
>  }
> @@ -224,7 +224,7 @@
>  	bb_error_msg_and_die("%s failed", msg);
>  }
>
> -static void inline pop3_check(const char *fmt, const char *param)
> +static ALWAYS_INLINE void pop3_check(const char *fmt, const char *param)
>
> This is unrelated change,

I might.  The warning was about 'void' being placed in front of
'inline'.  Minimal change would have been:

-static void inline pop3_check(const char *fmt, const char *param)
+static inline void pop3_check(const char *fmt, const char *param)

Still, it seemed to me the 'standard' way (i.e. using ALWAYS_INLINE).

> and it increases code size:
>
> sendgetmail_main                                    1674    1700     +26

Does that mean that all places where ALWAYS_INLINE (defined in
include/platform.h) will lead to increased code size for the
respective applets?

> Do not put unrelated changes into your patches.

I'm trying.  Don't always succeed.


Cheers,

-- 
Cristian


More information about the busybox mailing list