Hi,

On 11/05/2018 17:06, Jakub Jelinek wrote:
On Fri, May 11, 2018 at 10:42:13AM -0400, Jason Merrill wrote:
On Fri, May 11, 2018 at 8:48 AM, Paolo Carlini <paolo.carl...@oracle.com> wrote:
we got this very old comment in tree.h:

/* Nonzero if TYPE represents a pointer or reference type.
    (It should be renamed to INDIRECT_TYPE_P.)  Keep these checks in
    ascending code order.  */

#define POINTER_TYPE_P(TYPE) \
   (TREE_CODE (TYPE) == POINTER_TYPE || TREE_CODE (TYPE) == REFERENCE_TYPE)

and, FWIW  my personal experience, over the years I got confused a couple of
times because of that name: for example I tried, incorrectly, to replace a
few TREE_CODE (type) == POINTER_TYPE checks with POINTER_TYPE_P (type) in
the C++ front-end.
I think my inclination would be to keep this change local to the C++
If any change needs to be done, yeah.  For the middle-end, having
POINTER_TYPE_P including reference type is highly desirable, otherwise
people will just forget to handle REFERENCE_TYPE; after all,
useless_type_conversion_p says that POINTER_TYPE <-> REFERENCE_TYPE
conversions are useless, so the distinction is lost during optimizations
really soon.
Ok. If I don't hear different opinions I'll send patches local to the c++ front-end. At minimum we want a TYPE_REF_P, as noticed by Jason, and, well, having POINTER_TYPE_P and TYPE_PTR_P there is really a recipe for confusions, IMHO.

Well, we should fix the comment, then ;)

Paolo.

Reply via email to