Page MenuHomePhabricator

Add a __has_attribute_enhancement macro to clang
AbandonedPublic

Authored by george.burgess.iv on Jun 5 2017, 11:31 AM.

Details

Reviewers
None
Summary

Attributes may gain features or added flexibility over time. This patch aims to add a simple and uniform way to directly add/query for arbitrary changes in attributes, instead of having to rely on other information (e.g. version numbers, the existence of other attributes added at around the same time as the feature you're interested in, ...).

The only user of this at the moment will be https://reviews.llvm.org/D32332, so I won't tag people for review here until that lands.

Better words than "enhancement" are welcome; I tried things like __has_attribute_extension and __has_attribute_feature, but we also have both __has_extension and __has_feature, so... :)

Diff Detail

Event Timeline

ahatanak added inline comments.
docs/LanguageExtensions.rst
176

Do you need "gained" here?

I prefer __has_attribute_feature to enhancement. I don't see why we need a new macro for this, however. Why not just use __has_feature(overloadable_unmarked) or similar?

Why not just use __has_feature(overloadable_unmarked) or similar?

My impression was that __has_feature was was for larger features than tweaks to attributes. If this would be an appropriate use of __has_feature, though, I'm happy to keep things simple.

I'll update the other review with __has_feature. If it goes in with that, I'll abandon this.

Thanks!

docs/LanguageExtensions.rst
176

Good catch :)

Why not just use __has_feature(overloadable_unmarked) or similar?

My impression was that __has_feature was was for larger features than tweaks to attributes. If this would be an appropriate use of __has_feature, though, I'm happy to keep things simple.

I'll update the other review with __has_feature. If it goes in with that, I'll abandon this.

I agree, this need seems more in line with __has_feature than adding a new feature testing macro.

Thanks!

r306467 used __has_extension(overloadable_unmarked) instead.

Thanks again for the comments!