Guard <experimental/coroutine> against older Clang versions.

Clang started providing -fcoroutines and defining __cpp_coroutines
way before it implemented the __builtin_coro_foo functions. This
means that simply checking if __cpp_coroutines is not a sufficient
way of detecting the actual feature.

This patch implements _LIBCPP_HAS_NO_COROUTINES which implements
a slightly more complex feature check. Specifically it requires
__cpp_coroutines >= 201703L, which only holds for Clang 5.0 built
after 2017/05/24.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303956 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2017-05-26 01:52:59 +00:00
parent efcf07d44a
commit c80ef6ed28
2 changed files with 9 additions and 5 deletions

View File

@@ -1126,6 +1126,10 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
# define _LIBCPP_HAS_NO_IS_AGGREGATE
#endif
#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L
# define _LIBCPP_HAS_NO_COROUTINES
#endif
#endif // __cplusplus
// Decide whether to use availability macros.