Commit 08ea8bed authored by Andrii Grynenko's avatar Andrii Grynenko Committed by Facebook GitHub Bot

Successfully build some tests with GCC

Summary: Patch code to address build failures discovered with GCC.

Reviewed By: ericniebler

Differential Revision: D26682213

fbshipit-source-id: a45751e00ddbce01623e266bf3d6c9a72df40d26
parent 966d3350
...@@ -238,18 +238,18 @@ auto makeUnorderedAsyncGeneratorFromAwaitableRangeImpl( ...@@ -238,18 +238,18 @@ auto makeUnorderedAsyncGeneratorFromAwaitableRangeImpl(
scopeParam.add( scopeParam.add(
[](auto semiAwaitableParam, [](auto semiAwaitableParam,
auto& cancelSourceParam, auto& cancelSourceParam,
auto& pipe) -> Task<void> { auto& p) -> Task<void> {
auto result = co_await co_withCancellation( auto result = co_await co_withCancellation(
cancelSourceParam.getToken(), cancelSourceParam.getToken(),
co_awaitTry(std::move(semiAwaitableParam))); co_awaitTry(std::move(semiAwaitableParam)));
if (!result.hasValue() && !IsTry::value) { if (!result.hasValue() && !IsTry::value) {
cancelSourceParam.requestCancellation(); cancelSourceParam.requestCancellation();
} }
pipe.write(std::move(result)); p.write(std::move(result));
}(static_cast<decltype(semiAwaitable)&&>(semiAwaitable), }(static_cast<decltype(semiAwaitable)&&>(semiAwaitable),
cancelSource, cancelSource,
pipe) pipe)
.scheduleOn(ex)); .scheduleOn(ex));
++expected; ++expected;
RequestContext::setContext(context); RequestContext::setContext(context);
} }
......
...@@ -70,6 +70,7 @@ class co_reschedule_on_current_executor_ { ...@@ -70,6 +70,7 @@ class co_reschedule_on_current_executor_ {
folly::Executor::KeepAlive<> executor_; folly::Executor::KeepAlive<> executor_;
}; };
public:
class StackAwareAwaiter : public AwaiterBase { class StackAwareAwaiter : public AwaiterBase {
public: public:
using AwaiterBase::AwaiterBase; using AwaiterBase::AwaiterBase;
......
...@@ -298,8 +298,8 @@ class ViaIfAsyncAwaiter { ...@@ -298,8 +298,8 @@ class ViaIfAsyncAwaiter {
// case. // case.
template <typename Promise> template <typename Promise>
auto await_suspend(coroutine_handle<Promise> continuation) noexcept( auto await_suspend(coroutine_handle<Promise> continuation) noexcept(noexcept(
noexcept(awaiter_.await_suspend(std::declval<WrapperHandle>()))) std::declval<Awaiter&>().await_suspend(std::declval<WrapperHandle>())))
-> await_suspend_result_t { -> await_suspend_result_t {
viaCoroutine_.setContinuation(continuation); viaCoroutine_.setContinuation(continuation);
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <folly/fibers/Semaphore.h> #include <folly/fibers/Semaphore.h>
#include <folly/futures/Future.h> #include <folly/futures/Future.h>
#include <folly/io/async/ScopedEventBaseThread.h> #include <folly/io/async/ScopedEventBaseThread.h>
#include <folly/lang/Assume.h>
#include <folly/portability/GTest.h> #include <folly/portability/GTest.h>
#if FOLLY_HAS_COROUTINES #if FOLLY_HAS_COROUTINES
...@@ -362,9 +363,7 @@ template <int value> ...@@ -362,9 +363,7 @@ template <int value>
struct AwaitableInt { struct AwaitableInt {
bool await_ready() const { return true; } bool await_ready() const { return true; }
bool await_suspend(coro::coroutine_handle<>) { bool await_suspend(coro::coroutine_handle<>) { assume_unreachable(); }
LOG(FATAL) << "Should never be called.";
}
int await_resume() { return value; } int await_resume() { return value; }
}; };
...@@ -556,7 +555,7 @@ TEST_F(CoroTest, CancelOutstandingSemaphoreWait) { ...@@ -556,7 +555,7 @@ TEST_F(CoroTest, CancelOutstandingSemaphoreWait) {
// whcih should reqeust cancellation of sem.co_wait(). // whcih should reqeust cancellation of sem.co_wait().
co_yield folly::coro::co_error(ExpectedError{}); co_yield folly::coro::co_error(ExpectedError{});
}()); }());
} catch (ExpectedError) { } catch (const ExpectedError&) {
} }
}()); }());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment