Suppress some Clang warnings about unused return values.

Cast result to (void) where we are intentionally ignoring
the return value.
This commit is contained in:
Lewis Baker 2017-08-03 00:12:47 +09:30
parent 4c7569cb50
commit 83ab6399ec
5 changed files with 7 additions and 7 deletions

View file

@ -671,7 +671,7 @@ namespace cppcoro
while (it != itEnd)
{
co_yield std::invoke(func, *it);
co_await ++it;
(void)co_await ++it;
}
}
}

View file

@ -182,10 +182,10 @@ TEST_CASE("async producer with async consumer"
{
auto it = co_await producer.begin();
CHECK(*it == 1u);
co_await ++it;
(void)co_await ++it;
CHECK(*it == 2u);
co_await c1;
co_await ++it;
(void)co_await ++it;
CHECK(it == producer.end());
}();

View file

@ -113,7 +113,7 @@ TEST_CASE("lazy_task destructor destroys result")
[](cppcoro::lazy_task<counted>& t) -> cppcoro::task<>
{
co_await t;
co_await t.when_ready();
CHECK(t.is_ready());
CHECK(counted::active_count() == 1);
}(t);

View file

@ -73,7 +73,7 @@ TEST_CASE("result is destroyed when last reference is destroyed"
[](cppcoro::shared_lazy_task<counted> t) -> cppcoro::task<>
{
co_await t;
co_await t.when_ready();
}(t);
CHECK(counted::active_count() == 1);

View file

@ -38,7 +38,7 @@ TEST_CASE("when_all_ready() with no args")
{
auto run = []() -> cppcoro::task<>
{
co_await cppcoro::when_all_ready();
(void)co_await cppcoro::when_all_ready();
};
CHECK(run().is_ready());
}
@ -366,7 +366,7 @@ TEST_CASE("when_all_ready() doesn't rethrow exceptions")
{
auto[t0, t1] = co_await cppcoro::when_all_ready(makeTask(true), makeTask(false));
CHECK_THROWS_AS(co_await t0, const std::exception&);
CHECK_THROWS_AS((void)co_await t0, const std::exception&);
CHECK(co_await t1 == 123);
}
catch (...)