This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] v4: C/C++: add fix-it hints for missing '&' and '*' (PR c++/87850)
- From: Jason Merrill <jason at redhat dot com>
- To: David Malcolm <dmalcolm at redhat dot com>, Joseph Myers <joseph at codesourcery dot com>, law at redhat dot com
- Cc: Martin Sebor <msebor at gmail dot com>, Eric Gallager <egall at gwmail dot gwu dot edu>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 1 Dec 2018 13:38:45 -0500
- Subject: Re: [PATCH] v4: C/C++: add fix-it hints for missing '&' and '*' (PR c++/87850)
- References: <alpine.DEB.email@example.com> <firstname.lastname@example.org>
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.
Here's an updated version of the patch. I added a new
specifically for use by maybe_emit_indirection_note, and provided
implementations for C and C++.
+/* C implementation of compatible_types_for_indirection_note_p. */
+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.