Commit aab80ef3 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Enable -Wunused-value

Summary: [Folly] Enable `-Wunused-value`.

Reviewed By: Orvid

Differential Revision: D7266246

fbshipit-source-id: dc9b85a5f8ce67802cc2fa94746a26529012ec22
parent 7fd46ef5
......@@ -89,22 +89,18 @@ TEST(ConcurrentHashMap, MoveTest) {
struct foo {
static int moved;
static int copied;
foo(foo&& o) noexcept {
(void*)&o;
foo(foo&&) noexcept {
moved++;
}
foo& operator=(foo&& o) {
(void*)&o;
foo& operator=(foo&&) {
moved++;
return *this;
}
foo& operator=(const foo& o) {
(void*)&o;
foo& operator=(const foo&) {
copied++;
return *this;
}
foo(const foo& o) {
(void*)&o;
foo(const foo&) {
copied++;
}
foo() {}
......
......@@ -272,10 +272,10 @@ TEST(ApplyTuple, MemberFunctionWithUniquePtr) {
MemberFunc mf;
mf.x = 234;
EXPECT_EQ(folly::applyTuple(&MemberFunc::getX,
std::make_tuple(std::unique_ptr<MemberFunc>(
new MemberFunc(mf)))),
234);
EXPECT_EQ(
folly::applyTuple(&MemberFunc::getX,
std::make_tuple(std::make_unique<MemberFunc>(mf))),
234);
}
TEST(ApplyTuple, Array) {
......
......@@ -48,8 +48,8 @@ bool OpenSSLUtils::getTLSMasterKey(
return true;
}
#else
(SSL_SESSION*)session;
(MutableByteRange) keyOut;
(void)session;
(void)keyOut;
#endif
return false;
}
......@@ -65,8 +65,8 @@ bool OpenSSLUtils::getTLSClientRandom(
return true;
}
#else
(SSL*)ssl;
(MutableByteRange) randomOut;
(void)ssl;
(void)randomOut;
#endif
return false;
}
......
......@@ -51,8 +51,10 @@ TEST(AtomicIntrusiveLinkedList, Basic) {
EXPECT_FALSE(list.empty());
size_t id = 0;
list.sweep(
[&](TestIntrusiveObject* obj) mutable { EXPECT_EQ(++id, obj->id()); });
list.sweep([&](TestIntrusiveObject* obj) mutable {
++id;
EXPECT_EQ(id, obj->id());
});
EXPECT_TRUE(list.empty());
}
......@@ -65,8 +67,10 @@ TEST(AtomicIntrusiveLinkedList, Basic) {
EXPECT_FALSE(list.empty());
size_t id = 1;
list.sweep(
[&](TestIntrusiveObject* obj) mutable { EXPECT_EQ(++id, obj->id()); });
list.sweep([&](TestIntrusiveObject* obj) mutable {
++id;
EXPECT_EQ(id, obj->id());
});
EXPECT_TRUE(list.empty());
}
......@@ -82,7 +86,8 @@ TEST(AtomicIntrusiveLinkedList, ReverseSweep) {
list.insertHead(&c);
size_t next_expected_id = 3;
list.reverseSweep([&](TestIntrusiveObject* obj) {
EXPECT_EQ(next_expected_id--, obj->id());
auto const expected = next_expected_id--;
EXPECT_EQ(expected, obj->id());
});
EXPECT_TRUE(list.empty());
// Test that we can still insert
......@@ -116,8 +121,10 @@ TEST(AtomicIntrusiveLinkedList, Move) {
EXPECT_FALSE(list3.empty());
size_t id = 0;
list3.sweep(
[&](TestIntrusiveObject* obj) mutable { EXPECT_EQ(++id, obj->id()); });
list3.sweep([&](TestIntrusiveObject* obj) mutable {
++id;
EXPECT_EQ(id, obj->id());
});
}
TEST(AtomicIntrusiveLinkedList, Stress) {
......
......@@ -42,7 +42,8 @@ struct alignas(alignment) SizedData {
void doModifications() {
size_t i = 0;
for (auto& datum : data) {
EXPECT_EQ(static_cast<unsigned char>(i++), datum);
EXPECT_EQ(static_cast<unsigned char>(i), datum);
++i;
++datum;
}
}
......@@ -50,7 +51,8 @@ struct alignas(alignment) SizedData {
~SizedData() {
size_t i = 1;
for (auto& datum : data) {
EXPECT_EQ(static_cast<unsigned char>(i++), datum);
EXPECT_EQ(static_cast<unsigned char>(i), datum);
++i;
}
}
......
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