[cfe-dev] __cpp_lib library feature test macros

Eric Fiselier eric at efcs.ca
Sun Sep 21 19:06:54 PDT 2014


Hi All,
CC Marshall,

I've had some offline discussions with Marshall about adding feature
testing macros to libc++ and there was some hesitation about doing it.
Patches (with test cases) are welcome, but I don't know if we have decided
on a direction yet. There is a similar bug report that can be found here:
http://llvm.org/bugs/show_bug.cgi?id=18584.

/Eric


On Sun, Sep 21, 2014 at 7:34 PM, David Blaikie <dblaikie at gmail.com> wrote:

>
>
> On Sun, Sep 21, 2014 at 11:44 AM, Seth Cantrell <seth.cantrell at gmail.com>
> wrote:
>
>> clang implements feature testing macros for language features but I
>> notice that libc++ does not implement the library testing macros. Is this
>> deliberate or would patches to fix this be welcome?
>>
>> Attached is an initial attempt at implementing
>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4030.htm based
>> on http://libcxx.llvm.org/cxx1y_status.html. No tests are included yet.
>>
>> Also, about the language feature testing, I notice that they don't take
>> into account features being disabled via -Werror=.
>
>
> Which, if any, features can we disable via -Werror? I don't think we have
> a warning for constexpr, for example - we have a generic warning for all
> C++11 features (so you can build a codebase as C++11 without allowing the
> codebase to become C++98-incompatible), so arguably all the language
> features could be "not available" when built with that warning and -Werror,
> but that would change the behavior of your program, which would be
> problematic if you wanted to make sure that when you build as C++11 the
> project works (because then if you disabled the warning, you'd end up with
> different behavior - so your experimental results wouldn't be
> representative of the end state you were aiming for)
>
>
>> It seems like this might matter in cases such as a third party library's
>> headers doing feature testing, but where the local build environment has
>> disabled features for whatever reason. It seems reasonable that a header
>> testing #if __has_extension(__cxx_constexpr__) or #ifdef __cpp_constexpr
>> would use whatever fallback code it's got when the user disables constexpr.
>> Feature testing does take into account features disabled with -fno-
>> arguments.
>>
>> - Seth
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140921/8dce5397/attachment.html>


More information about the cfe-dev mailing list