Both clang and GCC support using __has_builtin for detecting compiler-provided type_traits. Use it instead of __has_keyword or __has_feature to remove special-casing for GCC-provided builtins
Details
Details
- Reviewers
ldionne Mordante var-const - Group Reviewers
Restricted Project - Commits
- rG2040fde9097a: [libc++] Prefer __has_builtin for detecting compiler-provided type_traits
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
In general looks good, but I really like to see it pass all CIs. (I know the current failures aren't due to this patch.)
libcxx/include/__type_traits/is_convertible.h | ||
---|---|---|
32 | please update the comment to match the #if, same for the #endif. |
Comment Actions
LGTM, but I don't understand what's the special-casing for GCC that you mention in the commit message. Can you elaborate?
Comment Actions
We've had a few __has_keyword(whatever) || _LIBCPP_COMPILER_GCC before (for example in is_trivially_destructible.h). The || _LIBCPP_COMPILER_GCC is now unnecessary, since GCC correctly reports support for builtin type traits with __has_builtin.
libcxx/include/__type_traits/is_convertible.h | ||
---|---|---|
32 | I've addressed this comment myself. |
please update the comment to match the #if, same for the #endif.