[cfe-dev] __cpp_lib library feature test macros

Seth Cantrell seth.cantrell at gmail.com
Sun Sep 21 11:44:18 PDT 2014


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=. 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-implement-library-feature-test-macros-n4030.patch
Type: application/octet-stream
Size: 8573 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140921/13647bab/attachment.obj>


More information about the cfe-dev mailing list