Hi,

On 11/05/2018 16:42, 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++
front end, i.e. define INDIRECT_TYPE_P and poison POINTER_TYPE_P in
cp-tree.h.  Do any other front ends use REFERENCE_TYPE?
I was also curious, and interestingly my greps found something in /ada, /fortran, /c, /objc at least.
And cp-tree.h already has TYPE_PTR_P.  But oddly not the corresponding
TYPE_REF_P.
I see. We could add the latter, then.

Paolo.

Reply via email to