Commit 1966558d authored by Chad Austin's avatar Chad Austin Committed by Facebook Github Bot

enable -Wunused-exception-parameter

Summary:
Build folly with -Werror and -Wunused-exception-parameter to prevent
them from sneaking back in.

Reviewed By: yfeldblum

Differential Revision: D18232483

fbshipit-source-id: 7154d3dfec6c672aa3aa46299456bd3c4d757709
parent 323cd710
......@@ -36,7 +36,7 @@ void loop(int iters) {
for (int i = 0; i < iters * 100; ++i) {
try {
recurse(100);
} catch (const std::exception& e) {
} catch (const std::exception&) {
folly::exception_tracer::getCurrentExceptions();
}
}
......
......@@ -37,11 +37,11 @@ void foo() {
try {
try {
bar();
} catch (const std::exception& e) {
} catch (const std::exception&) {
dumpExceptions("foo: simple catch");
bar();
}
} catch (const std::exception& e) {
} catch (const std::exception&) {
dumpExceptions("foo: catch, exception thrown from previous catch block");
}
}
......@@ -54,7 +54,7 @@ void foo() {
dumpExceptions("baz: simple catch");
throw;
}
} catch (const std::exception& e) {
} catch (const std::exception&) {
dumpExceptions("baz: catch rethrown exception");
throw "hello";
}
......
......@@ -2441,7 +2441,7 @@ TEST(FiberManager, swapWithException) {
fm.addTask([&] {
try {
throw std::logic_error("test");
} catch (const std::exception& e) {
} catch (const std::exception&) {
// Ok to call runInMainContext in exception unwinding
runInMainContext([&] { done = true; });
}
......@@ -2453,7 +2453,7 @@ TEST(FiberManager, swapWithException) {
fm.addTask([&] {
try {
throw std::logic_error("test");
} catch (const std::exception& e) {
} catch (const std::exception&) {
Baton b;
// Can't block during exception unwinding
ASSERT_DEATH(b.try_wait_for(std::chrono::milliseconds(1)), "");
......
......@@ -220,7 +220,7 @@ void throwAndCatchImpl() {
.then([](Try<Unit>&& t) {
try {
t.value();
} catch (const std::runtime_error& e) {
} catch (const std::runtime_error&) {
// ...
return;
}
......@@ -255,7 +255,7 @@ void throwWrappedAndCatchImpl() {
.then([](Try<Unit>&& t) {
try {
t.value();
} catch (const std::runtime_error& e) {
} catch (const std::runtime_error&) {
// ...
return;
}
......
......@@ -54,7 +54,7 @@ TEST(UncaughtExceptions, no_uncaught_exception) {
Validator validator(0, "no_uncaught_exception");
try {
throw std::runtime_error("exception");
} catch (const std::runtime_error& e) {
} catch (const std::runtime_error&) {
validator.validate();
}
}
......@@ -63,7 +63,7 @@ TEST(UncaughtExceptions, one_uncaught_exception) {
try {
Validator validator(1, "one_uncaught_exception");
throw std::runtime_error("exception");
} catch (const std::runtime_error& e) {
} catch (const std::runtime_error&) {
}
}
......@@ -73,12 +73,12 @@ TEST(UncaughtExceptions, catch_rethrow) {
try {
Validator validatorInner(1, "catch_rethrow_inner");
throw std::runtime_error("exception");
} catch (const std::runtime_error& e) {
} catch (const std::runtime_error&) {
EXPECT_EQ(0, folly::uncaught_exceptions());
Validator validatorRethrow(1, "catch_rethrow");
throw;
}
} catch (const std::runtime_error& e) {
} catch (const std::runtime_error&) {
EXPECT_EQ(0, folly::uncaught_exceptions());
}
}
......@@ -114,7 +114,7 @@ struct ThrowInDestructor {
N - I + 1, "validating in " + folly::to<std::string>(I));
LOG(INFO) << "throwing in ~ThrowInDestructor " << I;
throw std::logic_error("inner");
} catch (const std::logic_error& e) {
} catch (const std::logic_error&) {
LOG(INFO) << "catching in ~ThrowInDestructor " << I << " expecting "
<< N - I << ", it is " << folly::uncaught_exceptions();
EXPECT_EQ(N - I, folly::uncaught_exceptions());
......
......@@ -372,7 +372,7 @@ class ReadStats {
size_t messageIndex = 0;
try {
parseMessage(msg, &threadID, &messageIndex);
} catch (const std::exception& ex) {
} catch (const std::exception&) {
++numUnableToParse_;
XLOG(ERR, "unable to parse log message: ", msg);
return;
......
......@@ -327,7 +327,7 @@ TEST_F(LifoSemTest, shutdown_try_wait_for) {
try {
// this is normally 1 second in prod use case.
stopped.try_wait_for(std::chrono::milliseconds(1));
} catch (folly::ShutdownSemError& e) {
} catch (folly::ShutdownSemError&) {
LOG(INFO) << "try_wait_for shutdown";
}
}
......
......@@ -679,7 +679,7 @@ TEST(Conv, IntToDouble) {
try {
(void)to<float>(957837589847);
ADD_FAILURE();
} catch (std::range_error& e) {
} catch (std::range_error&) {
// LOG(INFO) << e.what();
}
}
......
......@@ -311,7 +311,7 @@ TEST(ScopeGuard, TEST_SCOPE_FAIL_EXCEPTION_PTR) {
ep = std::current_exception();
}
std::rethrow_exception(ep);
} catch (const std::exception& ex) {
} catch (const std::exception&) {
catchExecuted = true;
}
......
......@@ -232,7 +232,7 @@ BENCHMARK(throw_exception, iters) {
for (size_t n = 0; n < iters; ++n) {
try {
folly::throw_exception<Exception>("this is a test");
} catch (const std::exception& ex) {
} catch (const std::exception&) {
}
}
}
......@@ -241,7 +241,7 @@ BENCHMARK(catch_no_exception, iters) {
for (size_t n = 0; n < iters; ++n) {
try {
doNothing();
} catch (const std::exception& ex) {
} catch (const std::exception&) {
}
}
}
......
......@@ -2863,7 +2863,7 @@ STL_TEST("23.2.3 Table 100.12", at, is_destructible, a) {
try {
ca.at(ca.size());
FAIL() << "at(size) should have thrown an error";
} catch (const std::out_of_range& e) {
} catch (const std::out_of_range&) {
} catch (...) {
FAIL() << "at(size) threw error other than out_of_range";
}
......@@ -2931,7 +2931,7 @@ STL_TEST("23.3.6.3", lengthError, is_move_constructible) {
try {
u.reserve(big);
FAIL() << "reserve(big) should have thrown an error";
} catch (const std::length_error& e) {
} catch (const std::length_error&) {
} catch (...) {
FAIL() << "reserve(big) threw error other than length_error";
}
......
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