This is the mail archive of the
mailing list for the GCC project.
Re: PATCH RFA: -Wc++-compat warning about incompatible pointer targets
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 9 Jun 2009 18:53:15 +0000 (UTC)
- Subject: Re: PATCH RFA: -Wc++-compat warning about incompatible pointer targets
- References: <firstname.lastname@example.org>
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