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

Jean-Daniel Dupas devlists at shadowlab.org
Fri Aug 12 09:18:27 PDT 2011


Le 12 août 2011 à 17:24, Sean Hunt a écrit :

> On Fri, Aug 12, 2011 at 02:25, Jean-Daniel Dupas <devlists at shadowlab.org> 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
>> 
>> -- Jean-Daniel
> 
> Have you tested this thoroughly? While I think this is a good idea, my
> experience with it has been that the code doesn't work with certain
> combinations of features in a number of places. Not to say that these
> aren't bugs (they are), but that we should make sure they are fixed
> before we go about making changes to the feature structure.
> 
> Sean


No, I didn't test it thoroughly, and now that you mention it, I think there is in fact some case where it will cause problems (rvalue support without noexcept support).

Maybe clang should clarify what it defines as language extensions, and what are the pro and cons of using such extension.

-- Jean-Daniel








More information about the cfe-dev mailing list