aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLily <47812810+LilyWangL@users.noreply.github.com>2020-08-02 05:04:25 +0800
committerGitHub <noreply@github.com>2020-08-01 14:04:25 -0700
commit8797e9b0f962c87d88ce2b9aec2a18302f4efdb9 (patch)
tree1ff1094a9bd4611b018323393494d7be50f1b32b
parent4ab218039c4ae33c6f7b89cc8cdfa6434477a9e8 (diff)
downloadvcpkg-8797e9b0f962c87d88ce2b9aec2a18302f4efdb9.tar.gz
vcpkg-8797e9b0f962c87d88ce2b9aec2a18302f4efdb9.zip
[coroutine] Fix error C7651 (#12456)
* [coroutine] Fix error C7651 * Update portfile.cmake
-rw-r--r--ports/coroutine/CONTROL6
-rw-r--r--ports/coroutine/fix-errorC7651.patch68
-rw-r--r--ports/coroutine/portfile.cmake1
-rw-r--r--ports/coroutine/vcpkg.json11
4 files changed, 80 insertions, 6 deletions
diff --git a/ports/coroutine/CONTROL b/ports/coroutine/CONTROL
deleted file mode 100644
index 13fa58ab2..000000000
--- a/ports/coroutine/CONTROL
+++ /dev/null
@@ -1,6 +0,0 @@
-Source: coroutine
-Homepage: https://github.com/luncliff/coroutine
-Version: 1.5.0
-Build-Depends: ms-gsl
-Description: C++ 20 Coroutines helper/example library
-Supports: !uwp
diff --git a/ports/coroutine/fix-errorC7651.patch b/ports/coroutine/fix-errorC7651.patch
new file mode 100644
index 000000000..42c4291a5
--- /dev/null
+++ b/ports/coroutine/fix-errorC7651.patch
@@ -0,0 +1,68 @@
+diff --git a/modules/portable/frame.cpp b/modules/portable/frame.cpp
+index 2cedf81..f413f28 100644
+--- a/modules/portable/frame.cpp
++++ b/modules/portable/frame.cpp
+@@ -77,13 +77,31 @@ size_t _coro_done(void*);
+ //
+ // intrinsic: Clang/GCC
+ //
+-extern "C" {
+-bool __builtin_coro_done(void*);
+-void __builtin_coro_resume(void*);
+-void __builtin_coro_destroy(void*);
+-// void* __builtin_coro_promise(void* ptr, int align, bool p);
++//extern "C" {
++template <bool B>
++void resume_wrapper(void *p)
++{
++ if constexpr (B)
++ __builtin_coro_resume(p);
++}
++
++template <bool B>
++void destroy_wrapper(void *p)
++{
++ if constexpr(B)
++ __builtin_coro_destroy(p);
+ }
+
++template <bool B>
++bool done_wrapper(void *p)
++{
++ if constexpr(B)
++ return __builtin_coro_done(p);
++ return false;
++}
++// void* __builtin_coro_promise(void* ptr, int align, bool p);
++//}
++
+ bool _coro_finished(portable_coro_prefix* _Handle);
+
+ #if defined(__clang__)
+@@ -124,7 +142,7 @@ bool portable_coro_done(portable_coro_prefix* _Handle) {
+ if constexpr (is_msvc) {
+ return _coro_finished(_Handle);
+ } else if constexpr (is_clang) {
+- return __builtin_coro_done(_Handle);
++ return done_wrapper<true>(_Handle);
+ }
+ return false; // follow `noop_coroutine`
+ }
+@@ -133,7 +151,7 @@ void portable_coro_resume(portable_coro_prefix* _Handle) {
+ if constexpr (is_msvc) {
+ _coro_resume(_Handle);
+ } else if constexpr (is_clang) {
+- __builtin_coro_resume(_Handle);
++ resume_wrapper<true>(_Handle);
+ }
+ }
+
+@@ -141,7 +159,7 @@ void portable_coro_destroy(portable_coro_prefix* _Handle) {
+ if constexpr (is_msvc) {
+ _coro_destroy(_Handle);
+ } else if constexpr (is_clang) {
+- __builtin_coro_destroy(_Handle);
++ destroy_wrapper<true>(_Handle);
+ }
+ }
+
diff --git a/ports/coroutine/portfile.cmake b/ports/coroutine/portfile.cmake
index 26abb7bf7..3c5f27b72 100644
--- a/ports/coroutine/portfile.cmake
+++ b/ports/coroutine/portfile.cmake
@@ -10,6 +10,7 @@ vcpkg_from_github(
REF 1.5.0
SHA512 61b91fdc641b6905b884e99c5bf193ec2cf6962144ab3baafdb9432115757d96f3797f116b30356f0d21417b23082bc908f75042721caeab3329c4910b654594
HEAD_REF master
+ PATCHES fix-errorC7651.patch
)
vcpkg_configure_cmake(
diff --git a/ports/coroutine/vcpkg.json b/ports/coroutine/vcpkg.json
new file mode 100644
index 000000000..a391c0931
--- /dev/null
+++ b/ports/coroutine/vcpkg.json
@@ -0,0 +1,11 @@
+{
+ "name": "coroutine",
+ "version-string": "1.5.0",
+ "port-version": "1",
+ "description": "C++ 20 Coroutines helper/example library",
+ "homepage": "https://github.com/luncliff/coroutine",
+ "dependencies": [
+ "ms-gsl"
+ ],
+ "supports": "!uwp"
+}