Re: -Wconversion producing incorrect warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



using GCC 3.3.5, 3.4.3 and 4.0.1 with '-Wconversion' in effect, I get this warning:

luigi.c: In function `main':
luigi.c:15: warning: passing arg 1 of `f' with different width due to prototype

I don't understand why this is true... the prototype and the argument are of the same type.

Yes, so the parameter will be passed as whatever your ABI
specifies for parameters of unsigned 16-bit type.

The problem here is, that -Wconversion does _not_ warn
about type conversions in your code!  It is a warning for
people trying to port old K&R C code to ANSI C.  What the
warning means is, "if there would not have been a prototype
for f() in scope, the parameter would have been passed as
a 32-bit type".

GCC does not currently have a warning with the behaviour
you might have expected, and the name of "-Wconversion"
confuses a lot of people.  Perhaps we should change its
name...


Segher


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux