Skip to content

Commit

Permalink
Switch off experimental/coroutine header to final.
Browse files Browse the repository at this point in the history
  • Loading branch information
saurik committed Jul 19, 2024
1 parent 249fe25 commit 5d622fc
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 23 deletions.
2 changes: 1 addition & 1 deletion lib-protocol/source/spawn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions lib-protocol/source/spawn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Pool;

struct Work {
Work *next_ = nullptr;
std::experimental::coroutine_handle<> code_;
std::coroutine_handle<> code_;
};

class Pool {
Expand Down Expand Up @@ -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 {}
};

Expand Down Expand Up @@ -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();
Expand Down
3 changes: 1 addition & 2 deletions lib-shared/asio.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions lib-shared/extra/experimental/coroutine
Original file line number Diff line number Diff line change
@@ -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 <coroutine>
#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;
} }
24 changes: 12 additions & 12 deletions lib-shared/source/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#ifndef ORCHID_TASK_HPP
#define ORCHID_TASK_HPP

#include <experimental/coroutine>
#include <coroutine>

#include "error.hpp"
#include "maybe.hpp"
Expand Down Expand Up @@ -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;
}

Expand All @@ -83,7 +83,7 @@ class Final {
}

template <typename Promise_>
auto await_suspend(std::experimental::coroutine_handle<Promise_> code) noexcept {
auto await_suspend(std::coroutine_handle<Promise_> code) noexcept {
return std::move(std::move(code).promise().code_);
}

Expand All @@ -98,14 +98,14 @@ class Task {
typedef Value_ Value;

private:
std::experimental::coroutine_handle<promise_type> code_;
std::coroutine_handle<promise_type> code_;

class Awaitable {
protected:
std::experimental::coroutine_handle<promise_type> code_;
std::coroutine_handle<promise_type> code_;

public:
Awaitable(std::experimental::coroutine_handle<promise_type> code) noexcept :
Awaitable(std::coroutine_handle<promise_type> code) noexcept :
code_(std::move(code))
{
}
Expand All @@ -115,7 +115,7 @@ class Task {
}

template <typename Promise_>
auto await_suspend(std::experimental::coroutine_handle<Promise_> code) noexcept {
auto await_suspend(std::coroutine_handle<Promise_> code) noexcept {
code_.promise().code_ = std::move(code);
return code_;
}
Expand All @@ -125,7 +125,7 @@ class Task {
Task(std::nullptr_t) noexcept {
}

Task(std::experimental::coroutine_handle<promise_type> code) noexcept :
Task(std::coroutine_handle<promise_type> code) noexcept :
code_(std::move(code))
{
}
Expand Down Expand Up @@ -175,15 +175,15 @@ class Promise {
friend class Final;

private:
std::experimental::coroutine_handle<> code_;
std::coroutine_handle<> code_;

#ifdef ORC_FIBER
Fiber *fiber_ = nullptr;
#endif

public:
auto initial_suspend() noexcept {
return std::experimental::suspend_always(); }
return std::suspend_always(); }
auto final_suspend() noexcept {
return Final(); }

Expand Down Expand Up @@ -223,7 +223,7 @@ class Task<Value_>::promise_type :

public:
auto get_return_object() noexcept {
return Task<Value_>(std::experimental::coroutine_handle<promise_type>::from_promise(*this));
return Task<Value_>(std::coroutine_handle<promise_type>::from_promise(*this));
}

void unhandled_exception() noexcept {
Expand All @@ -250,7 +250,7 @@ class Task<void>::promise_type :

public:
auto get_return_object() noexcept {
return Task<void>(std::experimental::coroutine_handle<promise_type>::from_promise(*this));
return Task<void>(std::coroutine_handle<promise_type>::from_promise(*this));
}

void unhandled_exception() noexcept {
Expand Down
4 changes: 0 additions & 4 deletions lib-shared/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5d622fc

Please sign in to comment.