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: [RFC][4.4] Conversion of tree.h STRIP_* macros into static inline functions


Tom Tromey wrote:
"Simon" == Simon Baldwin <simonb@google.com> writes:

Simon> The attached file, gzipped because it exceeds 100Kb, is a patch Simon> that converts tree.h STRIP_* macros into static inline Simon> functions.

I think it would be good to mark these functions with
__attribute__((warn_unused_result)). Otherwise, I think, it would be
easy to accidentally call one erroneously -- for instance by bringing
in an old-style use when doing a merge.

Thanks for the feedback and suggestion. I'd vaguely considered this as part of the patch, but didn't do it once I'd convinced myself I'd found all of the (current) call sites. As you note, though, this neglects merge problems.


Added, then.

Also, in this particular case, in my opinion, it would be better to
lowercase the function names. This would have the nice effect of
breaking bad code that resulted from a merge.

When the general issue of lowercasing converted and inlined macros came up a couple of months ago, the overall consensus was to leave them uppercased, because of disinclination to edit all call sites.


However, all call sites have to be edited for this particular patch anyway, so there's an argument for lowercasing them.

For the moment, however, I'm inclined to leave them alone. The first reason is that this may be one of a series of semi-mechanical changes, so establishing a pattern seems useful. The second, more prosaic, is that if STRIP_*() are documented anywhere, it'll be their uppercased versions that are documented; I'd prefer not to break any such documentation. Or more accurately, I'd prefer not to have to find and update the documentation!

We can always decide to lowercase these and any other converted and inlined macros at some later date.

Finally, I noticed a new declaration of
tree_ssa_useless_type_conversion in tree.h. Given that users of
STRIP_USELESS_TYPE_CONVERSION had to include tree-flow.h to see
the declaration, I think it would be preferable to move
STRIP_USELESS_TYPE_CONVERSION there.

Moving STRIP_USELESS_TYPE_CONVERSION from tree.h and into to tree-flow-inline.h, included by tree-flow.h, seems like the best course here, so that's what I've done. This eliminates the duplicated tree_ssa_useless_type_conversion declaration.


Retesting now... guess I'll be mailing a revised version of the patch on test completion.

Again, thanks for the comments.


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