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,14 +238,14 @@ auto makeUnorderedAsyncGeneratorFromAwaitableRangeImpl(
scopeParam.add(
[](auto semiAwaitableParam,
auto& cancelSourceParam,
auto& pipe) -> Task<void> {
auto& p) -> Task<void> {
auto result = co_await co_withCancellation(
cancelSourceParam.getToken(),
co_awaitTry(std::move(semiAwaitableParam)));
if (!result.hasValue() && !IsTry::value) {
cancelSourceParam.requestCancellation();
}
pipe.write(std::move(result));
p.write(std::move(result));
}(static_cast<decltype(semiAwaitable)&&>(semiAwaitable),
cancelSource,
pipe)
......
......@@ -70,6 +70,7 @@ class co_reschedule_on_current_executor_ {
folly::Executor::KeepAlive<> executor_;
};
public:
class StackAwareAwaiter : public AwaiterBase {
public:
using AwaiterBase::AwaiterBase;
......
......@@ -298,8 +298,8 @@ class ViaIfAsyncAwaiter {
// case.
template <typename Promise>
auto await_suspend(coroutine_handle<Promise> continuation) noexcept(
noexcept(awaiter_.await_suspend(std::declval<WrapperHandle>())))
auto await_suspend(coroutine_handle<Promise> continuation) noexcept(noexcept(
std::declval<Awaiter&>().await_suspend(std::declval<WrapperHandle>())))
-> await_suspend_result_t {
viaCoroutine_.setContinuation(continuation);
......
......@@ -33,6 +33,7 @@
#include <folly/fibers/Semaphore.h>
#include <folly/futures/Future.h>
#include <folly/io/async/ScopedEventBaseThread.h>
#include <folly/lang/Assume.h>
#include <folly/portability/GTest.h>
#if FOLLY_HAS_COROUTINES
......@@ -362,9 +363,7 @@ template <int value>
struct AwaitableInt {
bool await_ready() const { return true; }
bool await_suspend(coro::coroutine_handle<>) {
LOG(FATAL) << "Should never be called.";
}
bool await_suspend(coro::coroutine_handle<>) { assume_unreachable(); }
int await_resume() { return value; }
};
......@@ -556,7 +555,7 @@ TEST_F(CoroTest, CancelOutstandingSemaphoreWait) {
// whcih should reqeust cancellation of sem.co_wait().
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