This is the mail archive of the gcc-patches@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: PATCH RFA: -Wc++-compat warning about incompatible pointer targets


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]