PATCH RFA: -Wc++-compat warning about incompatible pointer targets
Joseph S. Myers
joseph@codesourcery.com
Tue Jun 9 18:53:00 GMT 2009
On Tue, 2 Jun 2009, Ian Lance Taylor wrote:
> In C, enum types are compatible with integer types with the appropriate
> size and sign. For example, this is valid C code:
>
> enum E v;
> unsigned int *p = &v;
>
> when enum E is represented as an unsigned int.
>
> This is not valid C++ code. The first patch in this message warns about
> this sort of case when using -Wc++-compat. I'm not particularly
> attached to the approach I used here and would certainly entertain
> suggestions for how to do it differently. Since I was looking at the
> code, I added some better location information; however, it is still not
> very good. I think the right approach is going to be maintaining a
> separate location for each function argument, so that conversion errors
> can point at the problem. This patch requires approval from the C
> frontend maintainers.
This is OK if you make the new location arguments the first arguments to
their respective functions, for consistency with the convention being
followed by Aldy's patch.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc-patches
mailing list