This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -Wconversion producing incorrect warning


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]