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 / RFC] Rename POINTER_TYPE_P to INDIRECT_TYPE_P ?


On Fri, May 11, 2018 at 8:48 AM, Paolo Carlini <paolo.carlini@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?

And cp-tree.h already has TYPE_PTR_P.  But oddly not the corresponding
TYPE_REF_P.

Jason


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