[PATCH] v4: C/C++: add fix-it hints for missing '&' and '*' (PR c++/87850)

Jason Merrill jason@redhat.com
Sat Dec 1 18:38:00 GMT 2018


On 11/30/18 6:48 PM, David Malcolm wrote:
> On Tue, 2018-11-20 at 22:23 +0000, Joseph Myers wrote:
>> On Tue, 20 Nov 2018, David Malcolm wrote:
>>
>>> Should I do:
>>
>> You should do whatever is appropriate for the warning in question.  But if
>> what's appropriate for the warning in question includes types that are
>> compatible but not the same, the comments need to avoid saying it's about
>> the types being the same.

> Thanks.
> 
> Here's an updated version of the patch.  I added a new
>    compatible_types_for_indirection_note_p
> specifically for use by maybe_emit_indirection_note, and provided
> implementations for C and C++.

> +/* C implementation of compatible_types_for_indirection_note_p.  */
> +
> +bool
> +compatible_types_for_indirection_note_p (tree type1, tree type2)
> +{
> +  return comptypes (type1, type2) == 1;
> +}

Hmm, it looks like the C front-end comptypes will return 1 for e.g. enum 
and int.  It seems to me that what you want for this warning is actually 
to check for the same type.  Perhaps you want to use 
comptypes_check_different_types?  Joseph would know better what's 
correct for the C front-end.

Jason



More information about the Gcc-patches mailing list