[cfe-dev] [libcxx] using has_extension instead of has_feature

Sean Hunt scshunt at csclub.uwaterloo.ca
Fri Aug 12 09:04:41 PDT 2011


On Fri, Aug 12, 2011 at 08:58, Howard Hinnant <hhinnant at apple.com> wrote:
> On Aug 12, 2011, at 5:25 AM, Jean-Daniel Dupas wrote:
>
>> Hello,
>>
>> I'd like to propose to use __has_extension instead of __has_feature to detect available features in libc++ headers.
>>
>> Using __has_feature prevent usage of functionalities provided by clang as extension when compiling in older standard mode.
>>
>> As __has_extension is a superset of __has_feature, it should not have any effect on people using the library in c++0x mode.
>>
>> And when using -pedantic, __has_extension have the same behavior than __has_feature, so it is always be possible to disable extensions if needed.
>>
>> Path to perform this change (if accepted) attached.
>
> Thanks for doing this work.  I was previously ignorant of the difference between __has_feature and __has_extension.
>
> I surveyed the differences and found only three where this change would actually impact libc++ (using tags/Apple/clang-211.9):
>
> In C++03 mode the following features are turned on by using __has_extension but not by using __has_feature:
>
> cxx_rvalue_references
> cxx_reference_qualified_functions
> cxx_deleted_functions
>
> Does clang actually make these features work in C++03?  Or is the syntax merely accepted?
>
> Howard

They work in C++03; they normally produce warnings but these are
suppressed due to the system header pragma.

Sean




More information about the cfe-dev mailing list