Skip to content

Commit

Permalink
Remove unused-variable in fboss/agent/hw/sai/hw_test/HwTestFlowletSwi…
Browse files Browse the repository at this point in the history
…tchingUtils.cpp +3

Summary:
LLVM-15 has a warning `-Wunused-variable` which we treat as an error because it's so often diagnostic of a code issue. Unused variables can compromise readability or, worse, performance.

This diff either (a) removes an unused variable and, possibly, it's associated code or (b) qualifies the variable with `[[maybe_unused]]`.

 - If you approve of this diff, please use the "Accept & Ship" button :-)

Reviewed By: msomasundaran

Differential Revision: D66978908

fbshipit-source-id: 73b8d4d462e6db19a7cc586d52affd8803472dea
  • Loading branch information
r-barnes authored and facebook-github-bot committed Dec 10, 2024
1 parent dc8aee2 commit 7dd6d3f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
16 changes: 7 additions & 9 deletions fboss/agent/hw/sai/hw_test/HwTestFlowletSwitchingUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ void verifyPortArsAttributes(
PortSaiId portSaiId,
const cfg::PortFlowletConfig& cfg,
bool enable) {
auto& portApi = SaiApiTable::getInstance()->portApi();

#if SAI_API_VERSION >= SAI_VERSION(1, 14, 0)
auto& portApi = SaiApiTable::getInstance()->portApi();
auto arsEnable =
portApi.getAttribute(portSaiId, SaiPortTraits::Attributes::ArsEnable());
EXPECT_EQ(enable, arsEnable);
Expand All @@ -124,11 +123,10 @@ void verifyPortArsAttributes(
bool validateFlowletSwitchingEnabled(
const HwSwitch* hw,
const cfg::FlowletSwitchingConfig& flowletCfg) {
#if SAI_API_VERSION >= SAI_VERSION(1, 14, 0)
const auto saiSwitch = static_cast<const SaiSwitch*>(hw);
SwitchSaiId switchId =
saiSwitch->managerTable()->switchManager().getSwitchSaiId();

#if SAI_API_VERSION >= SAI_VERSION(1, 14, 0)
auto arsProfileId = SaiApiTable::getInstance()->switchApi().getAttribute(
switchId, SaiSwitchTraits::Attributes::ArsProfile());

Expand Down Expand Up @@ -157,11 +155,11 @@ bool verifyEcmpForFlowletSwitching(
const cfg::FlowletSwitchingConfig& flowletCfg,
const cfg::PortFlowletConfig& cfg,
const bool flowletEnable) {
const auto saiSwitch = static_cast<const SaiSwitch*>(hw);
auto nextHopGroupSaiId = getNextHopGroupSaiId(saiSwitch, ip);
bool isVerified = true;

#if SAI_API_VERSION >= SAI_VERSION(1, 14, 0)
const auto saiSwitch = static_cast<const SaiSwitch*>(hw);
auto nextHopGroupSaiId = getNextHopGroupSaiId(saiSwitch, ip);
auto arsId = SaiApiTable::getInstance()->nextHopGroupApi().getAttribute(
nextHopGroupSaiId, SaiNextHopGroupTraits::Attributes::ArsObjectId());

Expand All @@ -182,11 +180,11 @@ bool verifyEcmpForNonFlowlet(
const HwSwitch* hw,
const folly::CIDRNetwork& ip,
const bool flowletEnable) {
const auto saiSwitch = static_cast<const SaiSwitch*>(hw);
auto nextHopGroupSaiId = getNextHopGroupSaiId(saiSwitch, ip);
bool isVerified = true;

#if SAI_API_VERSION >= SAI_VERSION(1, 14, 0)
const auto saiSwitch = static_cast<const SaiSwitch*>(hw);
auto nextHopGroupSaiId = getNextHopGroupSaiId(saiSwitch, ip);
auto arsId = SaiApiTable::getInstance()->nextHopGroupApi().getAttribute(
nextHopGroupSaiId, SaiNextHopGroupTraits::Attributes::ArsObjectId());

Expand Down Expand Up @@ -214,11 +212,11 @@ bool validatePortFlowletQuality(
}

bool validateFlowletSwitchingDisabled(const HwSwitch* hw) {
#if SAI_API_VERSION >= SAI_VERSION(1, 14, 0)
const auto saiSwitch = static_cast<const SaiSwitch*>(hw);
SwitchSaiId switchId =
saiSwitch->managerTable()->switchManager().getSwitchSaiId();

#if SAI_API_VERSION >= SAI_VERSION(1, 14, 0)
auto arsProfileId = SaiApiTable::getInstance()->switchApi().getAttribute(
switchId, SaiSwitchTraits::Attributes::ArsProfile());

Expand Down
2 changes: 1 addition & 1 deletion fboss/agent/hw/sai/hw_test/SaiSwitchEnsemble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ void SaiSwitchEnsemble::init(
hwAsicTableEntry->setDefaultStreamType(
getPlatform()->getAsic()->getDefaultStreamType());
getPlatform()->initLEDs();
auto hw = static_cast<SaiSwitch*>(getHwSwitch());
#if !defined(CHENAB_SDK)
auto hw = static_cast<SaiSwitch*>(getHwSwitch());
// TODO(pshaikh): hacking to skip this for Chenab for now
diagShell_ = std::make_unique<DiagShell>(hw);
diagCmdServer_ = std::make_unique<DiagCmdServer>(hw, diagShell_.get());
Expand Down
5 changes: 0 additions & 5 deletions fboss/agent/state/tests/SwitchStatePruningTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ void verifyAddNeighborEntry(
auto host2ip = IPAddressV6("face:b00c:0:21::2");
auto host2mac = MacAddress("fa:ce:b0:0c:21:02");
auto host2port = PortDescriptor(PortID(1));
auto host2intf = InterfaceID(21);

addNeighborEntry<VlanOrIntfT, NdpTable>(
&state2, &host2ip, &host2mac, &host2VlanOrIntf, &host2port);
Expand Down Expand Up @@ -677,10 +676,6 @@ void verifyModifyArpTableMultipleTimes(
// ... add host1 to vlan21
// state2

auto host1ip = IPAddressV4("10.0.21.1");
auto host1mac = MacAddress("fa:ce:b0:0c:21:01");
auto host1port = PortDescriptor(PortID(1));

auto arp1 = getVlansOrIntfs<VlanOrIntfT>(state1)
->getNode(host1VlanOrIntf)
->getArpTable();
Expand Down

0 comments on commit 7dd6d3f

Please sign in to comment.