diff --git a/env/target-any.mk b/env/target-any.mk index a79cec19c..d735b2fd9 100644 --- a/env/target-any.mk +++ b/env/target-any.mk @@ -60,6 +60,7 @@ cflags += -Wall cflags += -Werror cflags += -Wno-unknown-warning-option +cflags += -Wno-deprecated-coroutine cflags += -Wno-deprecated-volatile cflags += -Wno-range-loop-analysis diff --git a/lib-protocol/source/spawn.cpp b/lib-protocol/source/spawn.cpp index 32feeabdf..3c2f08978 100644 --- a/lib-protocol/source/spawn.cpp +++ b/lib-protocol/source/spawn.cpp @@ -67,7 +67,7 @@ void Pool::Push(Work *work) noexcept { ready_.set(); } -void Pool::Scheduled::await_suspend(std::experimental::coroutine_handle<> code) noexcept { +void Pool::Scheduled::await_suspend(std::coroutine_handle<> code) noexcept { code_ = code; pool_->Push(this); } diff --git a/lib-protocol/source/spawn.hpp b/lib-protocol/source/spawn.hpp index e6614223c..a434218cc 100644 --- a/lib-protocol/source/spawn.hpp +++ b/lib-protocol/source/spawn.hpp @@ -36,7 +36,7 @@ class Pool; struct Work { Work *next_ = nullptr; - std::experimental::coroutine_handle<> code_; + std::coroutine_handle<> code_; }; class Pool { @@ -64,7 +64,7 @@ class Pool { public: Scheduled(Pool *pool) : pool_(pool) {} bool await_ready() noexcept { return false; } - void await_suspend(std::experimental::coroutine_handle<> code) noexcept; + void await_suspend(std::coroutine_handle<> code) noexcept; void await_resume() noexcept {} }; @@ -96,9 +96,9 @@ class Detached { } auto initial_suspend() noexcept { - return std::experimental::suspend_never(); } + return std::suspend_never(); } auto final_suspend() noexcept { - return std::experimental::suspend_never(); } + return std::suspend_never(); } [[noreturn]] void unhandled_exception() noexcept { std::terminate(); diff --git a/lib-shared/asio.mk b/lib-shared/asio.mk index de9f596d5..3e9e44826 100644 --- a/lib-shared/asio.mk +++ b/lib-shared/asio.mk @@ -95,8 +95,7 @@ cflags += -I$(pwd)/boost/libs/asio/include/boost cflags += -DBOOST_ASIO_DISABLE_CONNECTEX #cflags += -DBOOST_ASIO_NO_DEPRECATED -# XXX: this is because I am still using an old version of libc++ -cflags += -DBOOST_ASIO_DISABLE_STD_COROUTINE +# XXX: this was because I am still using an old version of libc++. maybe obsolete? cflags += -DBOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF cflags += -DBOOST_NO_CXX20_HDR_CONCEPTS diff --git a/lib-shared/extra/experimental/coroutine b/lib-shared/extra/experimental/coroutine new file mode 100644 index 000000000..b5bc52748 --- /dev/null +++ b/lib-shared/extra/experimental/coroutine @@ -0,0 +1,11 @@ +// cppcoro is unmaintained and is still using experimental coroutines TS +// XXX: either drop cppcoro or switch to the fork maintained by andreasbuhr +#include +#pragma clang diagnostic ignored "-Wdeprecated-experimental-coroutine" +namespace std { +namespace experimental { +using std::coroutine_handle; +using std::coroutine_traits; +using std::suspend_always; +using std::suspend_never; +} } diff --git a/lib-shared/source/task.hpp b/lib-shared/source/task.hpp index f920bdce3..d597d9d00 100644 --- a/lib-shared/source/task.hpp +++ b/lib-shared/source/task.hpp @@ -23,7 +23,7 @@ #ifndef ORCHID_TASK_HPP #define ORCHID_TASK_HPP -#include +#include #include "error.hpp" #include "maybe.hpp" @@ -67,7 +67,7 @@ class Ready { return true; } - bool await_suspend(std::experimental::coroutine_handle<>) noexcept { + bool await_suspend(std::coroutine_handle<>) noexcept { return false; } @@ -83,7 +83,7 @@ class Final { } template - auto await_suspend(std::experimental::coroutine_handle code) noexcept { + auto await_suspend(std::coroutine_handle code) noexcept { return std::move(std::move(code).promise().code_); } @@ -98,14 +98,14 @@ class Task { typedef Value_ Value; private: - std::experimental::coroutine_handle code_; + std::coroutine_handle code_; class Awaitable { protected: - std::experimental::coroutine_handle code_; + std::coroutine_handle code_; public: - Awaitable(std::experimental::coroutine_handle code) noexcept : + Awaitable(std::coroutine_handle code) noexcept : code_(std::move(code)) { } @@ -115,7 +115,7 @@ class Task { } template - auto await_suspend(std::experimental::coroutine_handle code) noexcept { + auto await_suspend(std::coroutine_handle code) noexcept { code_.promise().code_ = std::move(code); return code_; } @@ -125,7 +125,7 @@ class Task { Task(std::nullptr_t) noexcept { } - Task(std::experimental::coroutine_handle code) noexcept : + Task(std::coroutine_handle code) noexcept : code_(std::move(code)) { } @@ -175,7 +175,7 @@ class Promise { friend class Final; private: - std::experimental::coroutine_handle<> code_; + std::coroutine_handle<> code_; #ifdef ORC_FIBER Fiber *fiber_ = nullptr; @@ -183,7 +183,7 @@ class Promise { public: auto initial_suspend() noexcept { - return std::experimental::suspend_always(); } + return std::suspend_always(); } auto final_suspend() noexcept { return Final(); } @@ -223,7 +223,7 @@ class Task::promise_type : public: auto get_return_object() noexcept { - return Task(std::experimental::coroutine_handle::from_promise(*this)); + return Task(std::coroutine_handle::from_promise(*this)); } void unhandled_exception() noexcept { @@ -250,7 +250,7 @@ class Task::promise_type : public: auto get_return_object() noexcept { - return Task(std::experimental::coroutine_handle::from_promise(*this)); + return Task(std::coroutine_handle::from_promise(*this)); } void unhandled_exception() noexcept { diff --git a/lib-shared/target.mk b/lib-shared/target.mk index a2d1d0297..b2f89aabf 100644 --- a/lib-shared/target.mk +++ b/lib-shared/target.mk @@ -26,10 +26,6 @@ cflags += -I$(pwd)/extra $(call depend,$(pwd)/source/version.cpp.o,@/extra/revision.hpp) -cflags += -fcoroutines-ts -cflags += -Wno-deprecated-coroutine -cflags += -Wno-deprecated-experimental-coroutine - cflags += -I$(pwd)/cppcoro/include diff --git a/vpn-shared/source/client0.cpp b/vpn-shared/source/client0.cpp index 18e8c6786..04f856556 100644 --- a/vpn-shared/source/client0.cpp +++ b/vpn-shared/source/client0.cpp @@ -20,6 +20,8 @@ /* }}} */ +#include + #include "client0.hpp" #include "chain.hpp" #include "protocol.hpp"