Hi,

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. Also, I guess it would be nice to have straightforward POINTER_TYPE_P and REFERENCE_TYPE_P among our macros. In other terms, the comment above definitely makes sense to me, thus today I went through and prepared the below and bootstrapped it all languages (and I'm also testing it). What do you think? If we agree it's the right time to do this, we may want to improve/update some comments, and also we should probably audit some of the current POINTER_TYPE_P uses, possibly come to the conclusion that TREE_CODE (TYPE) == POINTER_TYPE would do and would be simpler and more precise. Of course I would need help about the latter idea, better, I would rather leave that for a second pass, involve the various maintainers...

Let me know if I should prepare complete ChangeLog entries and fully test the rename.

Cheers, Paolo.

/////////////////////////////

Attachment: patch_ptp.bz2
Description: application/bzip

Reply via email to