This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch / RFC] Rename POINTER_TYPE_P to INDIRECT_TYPE_P ?
- From: Jason Merrill <jason at redhat dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 11 May 2018 10:42:13 -0400
- Subject: Re: [Patch / RFC] Rename POINTER_TYPE_P to INDIRECT_TYPE_P ?
- References: <daac1322-a783-da24-e98e-a669abe65aca@oracle.com>
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