diff --git a/fboss/lib/test/PciDeviceTest.cpp b/fboss/lib/test/PciDeviceTest.cpp index df2f070cd9599..8fa249ffdfa78 100644 --- a/fboss/lib/test/PciDeviceTest.cpp +++ b/fboss/lib/test/PciDeviceTest.cpp @@ -39,9 +39,9 @@ TEST(PciDevice, StaleDevice) { CHECK_EQ(pciDevice.isGood(), true); pciDevice.close(); EXPECT_THROW( - { auto bar0 = pciDevice.getMemoryRegionAddress(); }, std::exception); + { std::ignore = pciDevice.getMemoryRegionAddress(); }, std::exception); EXPECT_THROW( - { auto barSize0 = pciDevice.getMemoryRegionSize(); }, std::exception); + { std::ignore = pciDevice.getMemoryRegionSize(); }, std::exception); } TEST(PciDevice, TwoDevices) { @@ -57,7 +57,7 @@ TEST(PciDevice, TwoDevices) { // Close first device and access second pciDevice1.close(); - EXPECT_NO_THROW({ auto barSize0 = pciDevice2.getMemoryRegionSize(); }); + EXPECT_NO_THROW({ std::ignore = pciDevice2.getMemoryRegionSize(); }); // Close second device EXPECT_NO_THROW(pciDevice2.close()); diff --git a/fboss/qsfp_service/module/tests/QsfpModuleTest.cpp b/fboss/qsfp_service/module/tests/QsfpModuleTest.cpp index 7bc281f374d14..c0b05e2a546c0 100644 --- a/fboss/qsfp_service/module/tests/QsfpModuleTest.cpp +++ b/fboss/qsfp_service/module/tests/QsfpModuleTest.cpp @@ -491,7 +491,6 @@ TEST_F(QsfpModuleTest, verifyLaneToPortMapping) { TEST_F(QsfpModuleTest, getFirmwareUpgradeData) { qsfp_->overrideVendorPN(getFakePartNumber()); - const QsfpConfig* qsfp_config = transceiverManager_->getQsfpConfig(); // Test empty fw status transceiverManager_->refreshStateMachines(); qsfp_->useActualGetTransceiverInfo(); diff --git a/fboss/thrift_cow/nodes/tests/ThriftListNodeTests.cpp b/fboss/thrift_cow/nodes/tests/ThriftListNodeTests.cpp index 213c5706ff77e..0f3cff00d8476 100644 --- a/fboss/thrift_cow/nodes/tests/ThriftListNodeTests.cpp +++ b/fboss/thrift_cow/nodes/tests/ThriftListNodeTests.cpp @@ -528,7 +528,7 @@ TEST(ThriftListNodeTests, ThriftListConstness) { node.publish(); const auto& list = node.cref(); auto fn = [list]() { - for (const auto& item : *list) { + for ([[maybe_unused]] const auto& item : *list) { // Check failed: !isPublished() from begin } }; @@ -543,7 +543,7 @@ TEST(ThriftListNodeTests, Cref) { ASSERT_TRUE( std::is_const_v>); // ASSERT_NO_DEATH - for (auto& item : *constWrappedRef) { + for ([[maybe_unused]] auto& item : *constWrappedRef) { } ThriftStructNode anotherNode; @@ -553,7 +553,8 @@ TEST(ThriftListNodeTests, Cref) { ASSERT_DEATH(gn(), ""); auto fn = [&node]() { - for (auto& item : *(node.safe_ref())) { + for ([[maybe_unused]] auto& item : + *(node.safe_ref())) { // Check failed: !isPublished() from begin } };