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