-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathsupport_intrinsic_builtin.cpp
39 lines (34 loc) · 1.29 KB
/
support_intrinsic_builtin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* @brief Check the compiler supports coroutine intrinsics
* @author github.com/luncliff (luncliff@gmail.com)
*
* @see LLVM libc++ <experimental/coroutine>
* @see https://llvm.org/docs/Coroutines.html
* @see Microsoft STL <coroutine>
* @see https://github.com/iains/gcc-cxx-coroutines
*/
#if defined(__has_builtin)
// known functions
static_assert(__has_builtin(__builtin_coro_done));
static_assert(__has_builtin(__builtin_coro_resume));
static_assert(__has_builtin(__builtin_coro_destroy));
static_assert(__has_builtin(__builtin_coro_promise));
#if defined(__clang__)
static_assert(__has_builtin(__builtin_coro_size));
static_assert(__has_builtin(__builtin_coro_frame));
static_assert(__has_builtin(__builtin_coro_free));
static_assert(__has_builtin(__builtin_coro_id));
static_assert(__has_builtin(__builtin_coro_begin));
static_assert(__has_builtin(__builtin_coro_end));
static_assert(__has_builtin(__builtin_coro_suspend));
static_assert(__has_builtin(__builtin_coro_param));
#endif
#else
/**
* @brief Try direct use of MSVC/Clang/GCC `__builtin_coro_*` intrinsics
* (without declaration)
* @note For MSVC, if the test failes, we have to use `_coro_*` intrinsics
* @see <experimental/resumable>
*/
bool has_builtin = __builtin_coro_done(nullptr);
#endif