mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Insert placeholder declarations into winrt/base.h.
PiperOrigin-RevId: 495104919
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
*** third_party/nearby/internal/platform/implementation/windows/generated/winrt/base.h 2022-12-07 15:29:09.000000000 -0500
|
||||
--- third_party/nearby/internal/platform/implementation/windows/generated/winrt/base-no-coroutines.h 2022-12-07 15:28:53.000000000 -0500
|
||||
***************
|
||||
*** 35,40 ****
|
||||
--- 35,66 ----
|
||||
#include <format>
|
||||
#endif
|
||||
|
||||
+ #if defined(_LIBCPP_VERSION) && __cplusplus < 202002
|
||||
+ // If the C++ standard is cxx17, coroutines are not available in libc++.
|
||||
+ // To compile WinRT without coroutines, define some placeholder types.
|
||||
+ // These placeholders should not be used. If they are used, they should fail.
|
||||
+ template <typename T = void>
|
||||
+ struct coroutine_handle {
|
||||
+ coroutine_handle() { throw std::logic_error("Not implemented."); }
|
||||
+ coroutine_handle(std::nullptr_t __h) {
|
||||
+ throw std::logic_error("Not implemented.");
|
||||
+ }
|
||||
+ static coroutine_handle from_address(void*) {
|
||||
+ throw std::logic_error("Not implemented.");
|
||||
+ }
|
||||
+ void operator()() const { throw std::logic_error("Not implemented."); }
|
||||
+ void* address() const { throw std::logic_error("Not implemented."); }
|
||||
+ };
|
||||
+
|
||||
+ class suspend_always {};
|
||||
+ class suspend_never {};
|
||||
+
|
||||
+ template <typename _Result, typename...>
|
||||
+ struct coroutine_traits;
|
||||
+
|
||||
+ } // namespace std::experimental
|
||||
+ #endif
|
||||
+
|
||||
#ifdef __cpp_lib_coroutine
|
||||
|
||||
#include <coroutine>
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
patch \
|
||||
--forward \
|
||||
-r - \
|
||||
third_party/nearby/internal/platform/implementation/windows/generated/winrt/base.h \
|
||||
third_party/nearby/internal/platform/implementation/windows/generated/base-no-coroutines.patch
|
||||
@@ -35,6 +35,32 @@
|
||||
#include <format>
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_VERSION) && __cplusplus < 202002
|
||||
// If the C++ standard is cxx17, coroutines are not available in libc++.
|
||||
// To compile WinRT without coroutines, define some placeholder types.
|
||||
// These placeholders should not be used. If they are used, they should fail.
|
||||
template <typename T = void>
|
||||
struct coroutine_handle {
|
||||
coroutine_handle() { throw std::logic_error("Not implemented."); }
|
||||
coroutine_handle(std::nullptr_t __h) {
|
||||
throw std::logic_error("Not implemented.");
|
||||
}
|
||||
static coroutine_handle from_address(void*) {
|
||||
throw std::logic_error("Not implemented.");
|
||||
}
|
||||
void operator()() const { throw std::logic_error("Not implemented."); }
|
||||
void* address() const { throw std::logic_error("Not implemented."); }
|
||||
};
|
||||
|
||||
class suspend_always {};
|
||||
class suspend_never {};
|
||||
|
||||
template <typename _Result, typename...>
|
||||
struct coroutine_traits;
|
||||
|
||||
} // namespace std::experimental
|
||||
#endif
|
||||
|
||||
#ifdef __cpp_lib_coroutine
|
||||
|
||||
#include <coroutine>
|
||||
|
||||
Reference in New Issue
Block a user