From ffcdd74a96aa505c95ca70a6798ca74501149257 Mon Sep 17 00:00:00 2001 From: Laura Andelare Date: Fri, 20 Oct 2023 19:58:07 +0000 Subject: [PATCH] Life support for Android and Linux C++20-only features are disabled even in C++20 mode. --- Plugins/UE5Coro/Source/UE5Coro/Private/Coroutine.cpp | 4 ++++ .../UE5Coro/Source/UE5Coro/Public/UE5Coro/Coroutine.h | 2 +- .../UE5Coro/Source/UE5Coro/Public/UE5Coro/Definitions.h | 9 +++++++++ .../Source/UE5Coro/Public/UE5Coro/LatentAwaiters.h | 2 +- .../Source/UE5Coro/Public/UE5Coro/LatentChain.inl | 4 ++-- Plugins/UE5Coro/UE5Coro.uplugin | 2 +- Plugins/UE5CoroGAS/UE5CoroGAS.uplugin | 2 +- 7 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Plugins/UE5Coro/Source/UE5Coro/Private/Coroutine.cpp b/Plugins/UE5Coro/Source/UE5Coro/Private/Coroutine.cpp index fcfa26ca..e8958f7e 100644 --- a/Plugins/UE5Coro/Source/UE5Coro/Private/Coroutine.cpp +++ b/Plugins/UE5Coro/Source/UE5Coro/Private/Coroutine.cpp @@ -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 diff --git a/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/Coroutine.h b/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/Coroutine.h index f7d2357d..f0185fe5 100644 --- a/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/Coroutine.h +++ b/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/Coroutine.h @@ -187,7 +187,7 @@ class TCoroutine : public TCoroutine<> }; static_assert(sizeof(TCoroutine) == sizeof(TCoroutine<>)); -#if UE5CORO_CPP20 +#if UE5CORO_CPP20 && !UE5CORO_PRIVATE_LIBCPP_IS_BROKEN static_assert(std::totally_ordered>); static_assert(std::totally_ordered_with, TCoroutine>); #endif diff --git a/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/Definitions.h b/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/Definitions.h index 44a6aee8..f29fcf8e 100644 --- a/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/Definitions.h +++ b/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/Definitions.h @@ -47,6 +47,9 @@ 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 @@ -54,3 +57,9 @@ namespace UE5Coro::Private #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 diff --git a/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/LatentAwaiters.h b/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/LatentAwaiters.h index ddfa4c66..8e046d93 100644 --- a/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/LatentAwaiters.h +++ b/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/LatentAwaiters.h @@ -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.
* The result of the co_await expression is true if the chained latent action diff --git a/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/LatentChain.inl b/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/LatentChain.inl index 6d59500b..e3d21ab4 100644 --- a/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/LatentChain.inl +++ b/Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/LatentChain.inl @@ -55,7 +55,7 @@ public: static_assert(sizeof(FLatentAwaiter) == sizeof(FLatentChainAwaiter)); -#if UE5CORO_CPP20 +#if UE5CORO_CPP20 && !UE5CORO_PRIVATE_LIBCPP_IS_BROKEN template concept TWorldContext = std::same_as, UObject*> || std::same_as, const UObject*> || @@ -134,7 +134,7 @@ struct FLatentChain 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 diff --git a/Plugins/UE5Coro/UE5Coro.uplugin b/Plugins/UE5Coro/UE5Coro.uplugin index f501c1b1..f4b8a113 100644 --- a/Plugins/UE5Coro/UE5Coro.uplugin +++ b/Plugins/UE5Coro/UE5Coro.uplugin @@ -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", diff --git a/Plugins/UE5CoroGAS/UE5CoroGAS.uplugin b/Plugins/UE5CoroGAS/UE5CoroGAS.uplugin index 09c11738..6dcf6c76 100644 --- a/Plugins/UE5CoroGAS/UE5CoroGAS.uplugin +++ b/Plugins/UE5CoroGAS/UE5CoroGAS.uplugin @@ -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",