Skip to content

Commit

Permalink
Also check for presence of a <coroutine> header when detecting corout…
Browse files Browse the repository at this point in the history
…ine support.
  • Loading branch information
ned14 committed Apr 26, 2023
1 parent 5e3a800 commit db71c15
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions include/outcome/detail/coroutine_support.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ Distributed under the Boost Software License, Version 1.0.
#include <cassert>
#include <exception>

#if __cpp_impl_coroutine || (defined(_MSC_VER) && __cpp_coroutines) || (defined(__clang__) && __cpp_coroutines)
#ifndef OUTCOME_COROUTINE_HEADER_TYPE
#if __has_include(<coroutine>)
#define OUTCOME_COROUTINE_HEADER_TYPE 1
#elif __has_include(<experimental/coroutine>)
#define OUTCOME_COROUTINE_HEADER_TYPE 2
#else
#define OUTCOME_COROUTINE_HEADER_TYPE 0
#endif
#endif

#if OUTCOME_COROUTINE_HEADER_TYPE && (__cpp_impl_coroutine || (defined(_MSC_VER) && __cpp_coroutines) || (defined(__clang__) && __cpp_coroutines))
#ifndef OUTCOME_HAVE_NOOP_COROUTINE
#if defined(__has_builtin)
#if __has_builtin(__builtin_coro_noop) || (!defined(__clang__) && __GNUC__ >= 10)
Expand All @@ -48,7 +58,7 @@ Distributed under the Boost Software License, Version 1.0.
#define OUTCOME_HAVE_NOOP_COROUTINE 0
#endif
#endif
#if __has_include(<coroutine>)
#if OUTCOME_COROUTINE_HEADER_TYPE == 1
#include <coroutine>
OUTCOME_V2_NAMESPACE_BEGIN
namespace awaitables
Expand All @@ -63,7 +73,7 @@ namespace awaitables
} // namespace awaitables
OUTCOME_V2_NAMESPACE_END
#define OUTCOME_FOUND_COROUTINE_HEADER 1
#elif __has_include(<experimental/coroutine>)
#elif OUTCOME_COROUTINE_HEADER_TYPE == 2
#include <experimental/coroutine>
OUTCOME_V2_NAMESPACE_BEGIN
namespace awaitables
Expand Down

0 comments on commit db71c15

Please sign in to comment.