Skip to content

Commit

Permalink
Life support for Android and Linux
Browse files Browse the repository at this point in the history
C++20-only features are disabled even in C++20 mode.
  • Loading branch information
landelare committed Oct 20, 2023
1 parent 8ee35de commit ffcdd74
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Plugins/UE5Coro/Source/UE5Coro/Private/Coroutine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ bool TCoroutine<>::operator==(const TCoroutine<>& Other) const noexcept
auto TCoroutine<>::operator<=>(const TCoroutine<>& Other) const noexcept
-> std::strong_ordering
{
#if UE5CORO_PRIVATE_LIBCPP_IS_BROKEN
return Extras.get() <=> Other.Extras.get();
#else
return Extras <=> Other.Extras;
#endif
}
#else
bool TCoroutine<>::operator!=(const TCoroutine<>& Other) const noexcept
Expand Down
2 changes: 1 addition & 1 deletion Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/Coroutine.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class TCoroutine : public TCoroutine<>
};

static_assert(sizeof(TCoroutine<int>) == sizeof(TCoroutine<>));
#if UE5CORO_CPP20
#if UE5CORO_CPP20 && !UE5CORO_PRIVATE_LIBCPP_IS_BROKEN
static_assert(std::totally_ordered<TCoroutine<>>);
static_assert(std::totally_ordered_with<TCoroutine<>, TCoroutine<int>>);
#endif
Expand Down
9 changes: 9 additions & 0 deletions Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/Definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,19 @@ namespace UE5Coro::Private
{
namespace stdcoro = ::std::experimental;
}
#ifdef __clang__
#pragma clang diagnostic ignored "-Wdeprecated-experimental-coroutine"
#endif
#else
#error UE5Coro requires C++20 or the Coroutines TS for C++17.
#endif

#ifndef UE5CORO_DEBUG
#define UE5CORO_DEBUG (UE_BUILD_DEBUG || UE_BUILD_DEVELOPMENT)
#endif

#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 16000
#define UE5CORO_PRIVATE_LIBCPP_IS_BROKEN 1
#else
#define UE5CORO_PRIVATE_LIBCPP_IS_BROKEN 0
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ UE5CORO_API Private::FLatentAwaiter UntilAudioTime(double);

#pragma region Chain

#if UE5CORO_CPP20
#if UE5CORO_CPP20 && !UE5CORO_PRIVATE_LIBCPP_IS_BROKEN
/** Resumes the coroutine once the chained static latent action has finished,
* with automatic parameter matching.<br>
* The result of the co_await expression is true if the chained latent action
Expand Down
4 changes: 2 additions & 2 deletions Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/LatentChain.inl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public:

static_assert(sizeof(FLatentAwaiter) == sizeof(FLatentChainAwaiter));

#if UE5CORO_CPP20
#if UE5CORO_CPP20 && !UE5CORO_PRIVATE_LIBCPP_IS_BROKEN
template<typename T>
concept TWorldContext = std::same_as<std::decay_t<T>, UObject*> ||
std::same_as<std::decay_t<T>, const UObject*> ||
Expand Down Expand Up @@ -134,7 +134,7 @@ struct FLatentChain<bWorld, bInfo, Type, Types...>

namespace UE5Coro::Latent
{
#if UE5CORO_CPP20
#if UE5CORO_CPP20 && !UE5CORO_PRIVATE_LIBCPP_IS_BROKEN

#if defined(_MSC_VER) && _MSC_VER < 1930
#define UE5CORO_PRIVATE_LATENT_CHAIN_IS_OK 0
Expand Down
2 changes: 1 addition & 1 deletion Plugins/UE5Coro/UE5Coro.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.9",
"VersionName": "1.10",
"FriendlyName": "UE5Coro",
"Description": "C++17/20 coroutine implementation for Unreal Engine",
"Category": "Programming",
Expand Down
2 changes: 1 addition & 1 deletion Plugins/UE5CoroGAS/UE5CoroGAS.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "0.9",
"VersionName": "0.10",
"FriendlyName": "UE5Coro – Gameplay Ability System",
"Description": "C++17/20 coroutines for GAS",
"Category": "Programming",
Expand Down

0 comments on commit ffcdd74

Please sign in to comment.