On Saturday 24 July 2010 01:03, Cristian Ionescu-Idbohrn wrote:
> When using this compiler option:
> 
>       CFLAGS  += -Wbad-function-cast

Why?

I googled for the rationale why this warning is useful,
but came up empty.

> I see several warnings (as in Subject:) while compiling miscutils/dc.c.
> One of them in function 'mod'.  Applying this patch:
> 
> diff --git a/miscutils/dc.c b/miscutils/dc.c
> index cb4b1e9..f9b8ab2 100644
> --- a/miscutils/dc.c
> +++ b/miscutils/dc.c
> @@ -74,8 +74,9 @@ static void divide(void)
>  static void mod(void)
>  {
>       unsigned d = pop();
> +     unsigned c = pop();
> 
> -     push((unsigned) pop() % d);
> +     push(c % d);
>  }
> 
>  static void and(void)
> 
> makes that warning go away, but bloats the result by a few bytes.
> What do people think?  Shall we blame gcc again for stupidity?

With this gcc:

$ i686-gcc -v
Invoked as i686-gcc
Reference path: /.share/usr/app/fwl_uclibc_i686-0.9.11/bin/..
arg[ 0] = rawcc
arg[ 1] = -U__nptl__
arg[ 2] = -v
Using built-in specs.
Target: i686-unknown-linux
Configured with: /2bogus/build/temp-i686/gcc-core/configure 
--target=i686-unknown-linux --prefix=/2bogus/build/native-compiler-i686 
--disable-multilib --disable-nls --enable-c99 --enable-long-long 
--enable-__cxa_atexit --enable-languages=c,c++ --disable-libstdcxx-pch 
--program-prefix= --enable-threads=posix --enable-shared 
--build=x86_64-walrus-linux --host=i686-unknown-linux --enable-sjlj-exceptions
Thread model: posix
gcc version 4.2.1

I am getting no code difference.


-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to