Commit cbdf3df7 authored by Phil Willoughby's avatar Phil Willoughby Committed by Facebook GitHub Bot

clang coro handling

Summary:
On windows `<experimental/coroutine>` comes from the Microsoft SDK and uses the MSVC intrinsics. If you are compiling with clang this header exists but nothing from it will work because clang does not implement the MSVC intrinsics.

Further, the clang and MSVC intrinsics are ABI incompatible with each other to the extent that there is no way I can find to implement the MSVC intrinsics behavior as inline functions in a clang TU.

MS have indicated publicly that they will work with the LLVM project to make sure that clang and MSVC will be compatible for `<coroutine>`, but until then we have to say that folly does not have coroutines when clang is used on Windows.

(Note: this ignores all push blocking failures!)

Reviewed By: yfeldblum

Differential Revision: D22301662

fbshipit-source-id: 96b1c3909a3916fe300073af34429eeb5c08d1fd
parent 2fa292de
...@@ -511,7 +511,15 @@ constexpr auto kCpplibVer = 0; ...@@ -511,7 +511,15 @@ constexpr auto kCpplibVer = 0;
#if __cplusplus >= 201703L #if __cplusplus >= 201703L
// folly::coro requires C++17 support // folly::coro requires C++17 support
#if __cpp_coroutines >= 201703L && __has_include(<experimental/coroutine>) #if defined(_WIN32) && defined(__clang__)
// LLVM and MSVC coroutines are ABI incompatible and <experimental/coroutine>
// is the MSVC implementation on windows, so we *don't* have coroutines.
//
// Worse, if we define FOLLY_HAS_COROUTINES 1 we will include
// <experimental/coroutine> which will conflict with anyone who wants to load
// the LLVM implementation of coroutines on Windows.
#define FOLLY_HAS_COROUTINES 0
#elif __cpp_coroutines >= 201703L && __has_include(<experimental/coroutine>)
#define FOLLY_HAS_COROUTINES 1 #define FOLLY_HAS_COROUTINES 1
// This is mainly to workaround bugs triggered by LTO, when stack allocated // This is mainly to workaround bugs triggered by LTO, when stack allocated
// variables in await_suspend end up on a coroutine frame. // variables in await_suspend end up on a coroutine frame.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment