Bug#226952: gcc-3.3: -Wconversion is annoying
Package: gcc-3.3
Version: 1:3.3.2-4
Severity: minor
Hi,
Given the code:
#include <stdio.h>
void foo8(unsigned char);
void foo8(unsigned char q)
{
printf("Quant8: 0x%X\n", q);
}
int main (void)
{
int i;
i = 0x12;
foo8( (unsigned char)i );
return 0;
}
Compiling it like so:
@ashland [~/tmp] $ gcc -o tst tst.c -Wconversion
tst.c: In function `main':
tst.c:16: warning: passing arg 1 of `foo8' with different width due
to prototype
Despite this being perfectly valid C code! I guess someone might want
that for some odd reason, however, -Wconversion also does something
useful:
Also, warn if a negative integer constant expression is
implicitly converted to an unsigned type. For example, warn
about the assignment `x = -1' if `x' is unsigned. But do not
warn about explicit casts like `(unsigned) -1'.
This is actually helpful. It would be nice if gcc could do the above
via a separate -W..... flag and leave:
`-Wconversion'
Warn if a prototype causes a type conversion that is different
from what would happen to the same argument in the absence of a
prototype. This includes conversions of fixed point to floating
and vice versa, and conversions changing the width or signedness
of a fixed point argument except when the same as the default
promotion.
to whoever needs such an odd warning.
Thanks for your time,
Dave
-- System Information:
Debian Release: testing/unstable
Architecture: powerpc
Kernel: Linux ashland 2.4.24 #2 Mon Jan 5 19:10:49 CET 2004 ppc
Locale: LANG=en_US, LC_CTYPE=en_US
Versions of packages gcc-3.3 depends on:
ii binutils 2.14.90.0.7-3 The GNU assembler, linker and bina
ii cpp-3.3 1:3.3.2-4 The GNU C preprocessor
ii gcc-3.3-base 1:3.3.2-4 The GNU Compiler Collection (base
ii libc6 2.3.2.ds1-10 GNU C Library: Shared libraries an
ii libgcc1 1:3.3.2-4 GCC support library
-- no debconf information
Reply to: