From ee4512b93c18dcdcff7dc99cb90a53f47d7ef136 Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Thu, 23 May 2024 07:34:37 -0700 Subject: [PATCH] Remove unused exception parameter from velox/common/base/tests/AsyncSourceTest.cpp (#9910) Summary: `-Wunused-exception-parameter` has identified an unused exception parameter. This diff removes it. This: ``` try { ... } catch (exception& e) { // no use of e } ``` should instead be written as ``` } catch (exception&) { ``` If the code compiles, this is safe to land. Reviewed By: palmje, mbasmanova Differential Revision: D57636920 --- velox/common/base/tests/AsyncSourceTest.cpp | 2 +- velox/common/memory/SharedArbitrator.cpp | 2 +- velox/common/memory/tests/MemoryAllocatorTest.cpp | 2 +- velox/common/memory/tests/MemoryPoolTest.cpp | 2 +- velox/exec/fuzzer/RowNumberFuzzer.cpp | 2 +- velox/exec/tests/TaskTest.cpp | 6 +++--- velox/functions/sparksql/MakeTimestamp.cpp | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/velox/common/base/tests/AsyncSourceTest.cpp b/velox/common/base/tests/AsyncSourceTest.cpp index 2175affacbe4..eaa8b1648751 100644 --- a/velox/common/base/tests/AsyncSourceTest.cpp +++ b/velox/common/base/tests/AsyncSourceTest.cpp @@ -140,7 +140,7 @@ TEST(AsyncSourceTest, errorsWithThreads) { auto gizmo = gizmos[folly::Random::rand32(rng) % gizmos.size()]->move(); EXPECT_EQ(nullptr, gizmo); - } catch (std::exception& e) { + } catch (std::exception&) { ++numErrors; } } diff --git a/velox/common/memory/SharedArbitrator.cpp b/velox/common/memory/SharedArbitrator.cpp index e38c3df58fea..ea350455b6d9 100644 --- a/velox/common/memory/SharedArbitrator.cpp +++ b/velox/common/memory/SharedArbitrator.cpp @@ -248,7 +248,7 @@ uint64_t SharedArbitrator::growCapacity( decrementFreeCapacityLocked(maxBytesToReserve, minBytesToReserve); try { checkedGrow(pool, reservedBytes, 0); - } catch (const VeloxRuntimeError& error) { + } catch (const VeloxRuntimeError&) { reservedBytes = 0; } return reservedBytes; diff --git a/velox/common/memory/tests/MemoryAllocatorTest.cpp b/velox/common/memory/tests/MemoryAllocatorTest.cpp index 4bfff3f4ffad..5251a3e27c83 100644 --- a/velox/common/memory/tests/MemoryAllocatorTest.cpp +++ b/velox/common/memory/tests/MemoryAllocatorTest.cpp @@ -121,7 +121,7 @@ class MemoryAllocatorTest : public testing::TestWithParam { EXPECT_TRUE(result.empty()); return false; } - } catch (const VeloxException& e) { + } catch (const VeloxException&) { EXPECT_TRUE(result.empty()); return false; } diff --git a/velox/common/memory/tests/MemoryPoolTest.cpp b/velox/common/memory/tests/MemoryPoolTest.cpp index ae6f8c25e180..4c27c5eceacf 100644 --- a/velox/common/memory/tests/MemoryPoolTest.cpp +++ b/velox/common/memory/tests/MemoryPoolTest.cpp @@ -126,7 +126,7 @@ class MemoryPoolTest : public testing::TestWithParam { void abortPool(MemoryPool* pool) { try { VELOX_FAIL("Manual MemoryPool Abortion"); - } catch (const VeloxException& error) { + } catch (const VeloxException&) { pool->abort(std::current_exception()); } } diff --git a/velox/exec/fuzzer/RowNumberFuzzer.cpp b/velox/exec/fuzzer/RowNumberFuzzer.cpp index c7a482859c33..538524f89045 100644 --- a/velox/exec/fuzzer/RowNumberFuzzer.cpp +++ b/velox/exec/fuzzer/RowNumberFuzzer.cpp @@ -506,7 +506,7 @@ void RowNumberFuzzer::verify() { VELOX_CHECK( assertEqualResults({expected}, {actual}), "Logically equivalent plans produced different results"); - } catch (const VeloxException& e) { + } catch (const VeloxException&) { LOG(ERROR) << "Expected\n" << expected->toString(0, expected->size()) << "\nActual\n" << actual->toString(0, actual->size()); diff --git a/velox/exec/tests/TaskTest.cpp b/velox/exec/tests/TaskTest.cpp index 27e19a57f276..976359845bd0 100644 --- a/velox/exec/tests/TaskTest.cpp +++ b/velox/exec/tests/TaskTest.cpp @@ -1480,7 +1480,7 @@ DEBUG_ONLY_TEST_F(TaskTest, driverCounters) { try { while (cursor->moveNext()) { }; - } catch (VeloxRuntimeError& ex) { + } catch (VeloxRuntimeError&) { } }); @@ -1763,7 +1763,7 @@ DEBUG_ONLY_TEST_F( try { VELOX_FAIL(abortErrorMessage); - } catch (VeloxException& e) { + } catch (VeloxException&) { abortWait.await([&]() { return abortWaitFlag.load(); }); blockingTask->pool()->abort(std::current_exception()); } @@ -1818,7 +1818,7 @@ DEBUG_ONLY_TEST_F(TaskTest, longRunningOperatorInTaskReclaimerAbort) { const std::string abortErrorMessage("Synthetic Exception"); try { VELOX_FAIL(abortErrorMessage); - } catch (VeloxException& e) { + } catch (VeloxException&) { blockingTask->pool()->abort(std::current_exception()); } waitForTaskCompletion(blockingTask.get()); diff --git a/velox/functions/sparksql/MakeTimestamp.cpp b/velox/functions/sparksql/MakeTimestamp.cpp index febab1036f9e..779761d8908d 100644 --- a/velox/functions/sparksql/MakeTimestamp.cpp +++ b/velox/functions/sparksql/MakeTimestamp.cpp @@ -125,7 +125,7 @@ class MakeTimestampFunction : public exec::VectorFunction { int64_t constantTzID; try { constantTzID = util::getTimeZoneID(std::string_view(tz)); - } catch (const VeloxException& e) { + } catch (const VeloxException&) { context.setErrors(rows, std::current_exception()); return; }