Fix clang-tidy performance-unnecessary-copy-initialization warnings
This commit is contained in:
@@ -301,8 +301,6 @@ main(int argc, char* argv[])
|
||||
Time startTime = Seconds(0);
|
||||
Time stopTime = flowStartupWindow + convergenceTime + measurementWindow;
|
||||
|
||||
Time clientStartTime = startTime;
|
||||
|
||||
rxS1R1Bytes.reserve(10);
|
||||
rxS2R2Bytes.reserve(20);
|
||||
rxS3R1Bytes.reserve(10);
|
||||
@@ -493,7 +491,7 @@ main(int argc, char* argv[])
|
||||
AddressValue remoteAddress(InetSocketAddress(ipR2T2[i].GetAddress(0), port));
|
||||
clientHelper1.SetAttribute("Remote", remoteAddress);
|
||||
clientApps1.Add(clientHelper1.Install(S2.Get(i)));
|
||||
clientApps1.Start(i * flowStartupWindow / 20 + clientStartTime + MilliSeconds(i * 5));
|
||||
clientApps1.Start(i * flowStartupWindow / 20 + startTime + MilliSeconds(i * 5));
|
||||
clientApps1.Stop(stopTime);
|
||||
}
|
||||
|
||||
@@ -534,13 +532,12 @@ main(int argc, char* argv[])
|
||||
if (i < 10)
|
||||
{
|
||||
clientApps1.Add(clientHelper1.Install(S1.Get(i)));
|
||||
clientApps1.Start(i * flowStartupWindow / 10 + clientStartTime + MilliSeconds(i * 5));
|
||||
clientApps1.Start(i * flowStartupWindow / 10 + startTime + MilliSeconds(i * 5));
|
||||
}
|
||||
else
|
||||
{
|
||||
clientApps1.Add(clientHelper1.Install(S3.Get(i - 10)));
|
||||
clientApps1.Start((i - 10) * flowStartupWindow / 10 + clientStartTime +
|
||||
MilliSeconds(i * 5));
|
||||
clientApps1.Start((i - 10) * flowStartupWindow / 10 + startTime + MilliSeconds(i * 5));
|
||||
}
|
||||
|
||||
clientApps1.Stop(stopTime);
|
||||
|
||||
@@ -175,8 +175,7 @@ Experiment::Run(const WifiHelper& wifi,
|
||||
YansWifiPhyHelper phy = wifiPhy;
|
||||
phy.SetChannel(wifiChannel.Create());
|
||||
|
||||
WifiMacHelper mac = wifiMac;
|
||||
NetDeviceContainer devices = wifi.Install(phy, mac, c);
|
||||
NetDeviceContainer devices = wifi.Install(phy, wifiMac, c);
|
||||
|
||||
MobilityHelper mobility;
|
||||
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
|
||||
|
||||
@@ -183,8 +183,7 @@ Experiment::Run(const WifiHelper& wifi,
|
||||
YansWifiPhyHelper phy = wifiPhy;
|
||||
phy.SetChannel(wifiChannel.Create());
|
||||
|
||||
WifiMacHelper mac = wifiMac;
|
||||
NetDeviceContainer devices = wifi.Install(phy, mac, c);
|
||||
NetDeviceContainer devices = wifi.Install(phy, wifiMac, c);
|
||||
|
||||
MobilityHelper mobility;
|
||||
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
|
||||
|
||||
@@ -505,8 +505,7 @@ Experiment::Run(const WifiHelper& wifi,
|
||||
YansWifiPhyHelper phy = wifiPhy;
|
||||
phy.SetChannel(wifiChannel.Create());
|
||||
|
||||
WifiMacHelper mac = wifiMac;
|
||||
NetDeviceContainer devices = wifi.Install(phy, mac, c);
|
||||
NetDeviceContainer devices = wifi.Install(phy, wifiMac, c);
|
||||
|
||||
OlsrHelper olsr;
|
||||
Ipv4StaticRoutingHelper staticRouting;
|
||||
|
||||
@@ -376,8 +376,7 @@ AttributeContainerSerializationTestCase::DoRun()
|
||||
NS_TEST_ASSERT_MSG_EQ(attr.GetN(), 6, "Incorrect container size");
|
||||
|
||||
std::string reserialized = attr.SerializeToString(checker);
|
||||
std::string canonical = strings;
|
||||
NS_TEST_ASSERT_MSG_EQ(reserialized, canonical, "Reserialization failed");
|
||||
NS_TEST_ASSERT_MSG_EQ(reserialized, strings, "Reserialization failed");
|
||||
}
|
||||
|
||||
{
|
||||
@@ -394,8 +393,7 @@ AttributeContainerSerializationTestCase::DoRun()
|
||||
NS_TEST_ASSERT_MSG_EQ(attr.GetN(), 3, "Incorrect container size");
|
||||
|
||||
std::string reserialized = attr.SerializeToString(checker);
|
||||
std::string canonical = pairs;
|
||||
NS_TEST_ASSERT_MSG_EQ(reserialized, canonical, "Reserealization failed");
|
||||
NS_TEST_ASSERT_MSG_EQ(reserialized, pairs, "Reserealization failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,11 @@ SimulatorEventsTestCase::DoRun()
|
||||
NS_TEST_EXPECT_MSG_EQ(m_d, true, "Event D did not run ?");
|
||||
|
||||
EventId anId = Simulator::ScheduleNow(&SimulatorEventsTestCase::Eventfoo0, this);
|
||||
|
||||
// Test copy assignment operator
|
||||
// NOLINTNEXTLINE(performance-unnecessary-copy-initialization)
|
||||
EventId anotherId = anId;
|
||||
|
||||
NS_TEST_EXPECT_MSG_EQ(!(anId.IsExpired() || anotherId.IsExpired()),
|
||||
true,
|
||||
"Event should not have expired yet.");
|
||||
|
||||
@@ -605,9 +605,8 @@ Ipv6AddressGeneratorImpl::IsNetworkAllocated(const Ipv6Address address, const Ip
|
||||
{
|
||||
NS_LOG_FUNCTION(this << address << prefix);
|
||||
|
||||
Ipv6Address addr = address;
|
||||
NS_ABORT_MSG_UNLESS(
|
||||
address == addr.CombinePrefix(prefix),
|
||||
address == address.CombinePrefix(prefix),
|
||||
"Ipv6AddressGeneratorImpl::IsNetworkAllocated(): network address and mask don't match "
|
||||
<< address << " " << prefix);
|
||||
|
||||
|
||||
@@ -1596,13 +1596,9 @@ void
|
||||
TcpSocketBase::ReadOptions(const TcpHeader& tcpHeader, uint32_t* bytesSacked)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << tcpHeader);
|
||||
TcpHeader::TcpOptionList::const_iterator it;
|
||||
const TcpHeader::TcpOptionList options = tcpHeader.GetOptionList();
|
||||
|
||||
for (it = options.begin(); it != options.end(); ++it)
|
||||
for (const auto& option : tcpHeader.GetOptionList())
|
||||
{
|
||||
const Ptr<const TcpOption> option = (*it);
|
||||
|
||||
// Check only for ACK options here
|
||||
switch (option->GetKind())
|
||||
{
|
||||
|
||||
@@ -565,13 +565,12 @@ LteX2HandoverMeasuresTestCase::DoRun()
|
||||
ueDevices.Get(checkPointEventIt->ueDeviceIndex),
|
||||
enbDevices.Get(checkPointEventIt->enbDeviceIndex));
|
||||
|
||||
Time saveStatsTime = checkPointTime;
|
||||
Simulator::Schedule(saveStatsTime,
|
||||
Simulator::Schedule(checkPointTime,
|
||||
&LteX2HandoverMeasuresTestCase::SaveStats,
|
||||
this,
|
||||
checkPointEventIt->ueDeviceIndex);
|
||||
|
||||
Time checkStats = saveStatsTime + m_statsDuration;
|
||||
Time checkStats = checkPointTime + m_statsDuration;
|
||||
Simulator::Schedule(checkStats,
|
||||
&LteX2HandoverMeasuresTestCase::CheckStats,
|
||||
this,
|
||||
|
||||
@@ -622,8 +622,7 @@ IsVal(const std::string& str, T& ret)
|
||||
}
|
||||
else if (IsNumber(str))
|
||||
{
|
||||
std::string s2 = str;
|
||||
std::istringstream s(s2);
|
||||
std::istringstream s(str);
|
||||
s >> ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1119,11 +1119,15 @@ PacketTagListTest::DoRun()
|
||||
{ // Copy ctor, assignment
|
||||
std::cout << GetName() << "check copy and assignment" << std::endl;
|
||||
{
|
||||
// Test copy constructor
|
||||
// NOLINTNEXTLINE(performance-unnecessary-copy-initialization)
|
||||
PacketTagList ptl(ref);
|
||||
CheckRefList(ref, "copy ctor orig");
|
||||
CheckRefList(ptl, "copy ctor copy");
|
||||
}
|
||||
{
|
||||
// Test copy constructor
|
||||
// NOLINTNEXTLINE(performance-unnecessary-copy-initialization)
|
||||
PacketTagList ptl = ref;
|
||||
CheckRefList(ref, "assignment orig");
|
||||
CheckRefList(ptl, "assignment copy");
|
||||
|
||||
@@ -202,10 +202,9 @@ void
|
||||
HePpdu::SetHeMuUserInfos(WifiTxVector& txVector, const HeSigHeader& heSig) const
|
||||
{
|
||||
WifiTxVector::HeMuUserInfoMap userInfos{};
|
||||
const auto contentChannels = heSig.GetHeSigBContentChannels();
|
||||
const auto ruAllocation = heSig.GetRuAllocation();
|
||||
const auto& ruAllocation = heSig.GetRuAllocation();
|
||||
auto contentChannelIndex = 0;
|
||||
for (const auto& contentChannel : contentChannels)
|
||||
for (const auto& contentChannel : heSig.GetHeSigBContentChannels())
|
||||
{
|
||||
auto numRusLeft = 0;
|
||||
auto ruAllocIndex = contentChannelIndex;
|
||||
|
||||
@@ -1440,9 +1440,9 @@ LargestIdlePrimaryChannelTest::RunOne(uint16_t chWidth, WifiChannelListType busy
|
||||
|
||||
// At RX end, we check the status of the channel during the interval following
|
||||
// the CCA_BUSY period and preceding RX start. The entire operating channel is idle.
|
||||
Time checkTime4 = checkTime3;
|
||||
const Time& checkTime4 = checkTime3;
|
||||
Simulator::Schedule(checkTime4 - start, [=]() {
|
||||
Time interval4 = ccaBusyRxInterval;
|
||||
const Time& interval4 = ccaBusyRxInterval;
|
||||
Time end4 = checkTime4 - rxDuration;
|
||||
NS_TEST_EXPECT_MSG_EQ(m_cam->GetLargestIdlePrimaryChannel(interval4, end4),
|
||||
chWidth,
|
||||
@@ -1465,7 +1465,7 @@ LargestIdlePrimaryChannelTest::RunOne(uint16_t chWidth, WifiChannelListType busy
|
||||
});
|
||||
|
||||
// After RX end, no channel is idle if the interval overlaps the RX period
|
||||
Time checkTime6 = checkTime5;
|
||||
const Time& checkTime6 = checkTime5;
|
||||
Simulator::Schedule(checkTime6 - start, [=]() {
|
||||
Time interval6 = interval5 + rxDuration / 2;
|
||||
NS_TEST_EXPECT_MSG_EQ(m_cam->GetLargestIdlePrimaryChannel(interval6, checkTime6),
|
||||
|
||||
@@ -1172,7 +1172,7 @@ UplinkSchedulerMBQoS::ProcessBandwidthRequest(const BandwidthRequestHeader& bwRe
|
||||
|
||||
Time deadline = DetermineDeadline(serviceFlow);
|
||||
Time currentTime = Simulator::Now();
|
||||
Time period = deadline; // So that deadline is properly updated..
|
||||
const Time& period = deadline; // So that deadline is properly updated..
|
||||
|
||||
NS_LOG_DEBUG("At " << Simulator::Now().As(Time::S)
|
||||
<< " at BS uplink scheduler, processing bandwidth request from."
|
||||
|
||||
@@ -407,11 +407,8 @@ Dcd::GetSerializedSize() const
|
||||
{
|
||||
uint32_t dlBurstProfilesSize = 0;
|
||||
|
||||
for (std::vector<OfdmDlBurstProfile>::const_iterator iter = m_dlBurstProfiles.begin();
|
||||
iter != m_dlBurstProfiles.end();
|
||||
++iter)
|
||||
for (const auto& burstProfile : m_dlBurstProfiles)
|
||||
{
|
||||
OfdmDlBurstProfile burstProfile = *iter;
|
||||
dlBurstProfilesSize += burstProfile.GetSize();
|
||||
}
|
||||
|
||||
@@ -426,11 +423,8 @@ Dcd::Serialize(Buffer::Iterator start) const
|
||||
i.WriteU8(m_configurationChangeCount);
|
||||
i = m_channelEncodings.Write(i);
|
||||
|
||||
for (std::vector<OfdmDlBurstProfile>::const_iterator iter = m_dlBurstProfiles.begin();
|
||||
iter != m_dlBurstProfiles.end();
|
||||
++iter)
|
||||
for (const auto& burstProfile : m_dlBurstProfiles)
|
||||
{
|
||||
OfdmDlBurstProfile burstProfile = *iter;
|
||||
i = burstProfile.Write(i);
|
||||
}
|
||||
}
|
||||
@@ -625,11 +619,8 @@ DlMap::GetSerializedSize() const
|
||||
{
|
||||
uint32_t dlMapElementsSize = 0;
|
||||
|
||||
for (std::list<OfdmDlMapIe>::const_iterator iter = m_dlMapElements.begin();
|
||||
iter != m_dlMapElements.end();
|
||||
++iter)
|
||||
for (const auto& dlMapIe : m_dlMapElements)
|
||||
{
|
||||
OfdmDlMapIe dlMapIe = *iter;
|
||||
dlMapElementsSize += dlMapIe.GetSize();
|
||||
}
|
||||
|
||||
@@ -643,11 +634,8 @@ DlMap::Serialize(Buffer::Iterator start) const
|
||||
i.WriteU8(m_dcdCount);
|
||||
WriteTo(i, m_baseStationId);
|
||||
|
||||
for (std::list<OfdmDlMapIe>::const_iterator iter = m_dlMapElements.begin();
|
||||
iter != m_dlMapElements.end();
|
||||
++iter)
|
||||
for (const auto& dlMapIe : m_dlMapElements)
|
||||
{
|
||||
OfdmDlMapIe dlMapIe = *iter;
|
||||
i = dlMapIe.Write(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,11 +232,8 @@ OfdmDownlinkFramePrefix::GetSerializedSize() const
|
||||
{
|
||||
int dlFramePrefixElementsSize = 0;
|
||||
|
||||
for (std::vector<DlFramePrefixIe>::const_iterator iter = m_dlFramePrefixElements.begin();
|
||||
iter != m_dlFramePrefixElements.end();
|
||||
iter++)
|
||||
for (const auto& dlFramePrefixElement : m_dlFramePrefixElements)
|
||||
{
|
||||
DlFramePrefixIe dlFramePrefixElement = *iter;
|
||||
dlFramePrefixElementsSize += dlFramePrefixElement.GetSize();
|
||||
}
|
||||
|
||||
@@ -251,11 +248,8 @@ OfdmDownlinkFramePrefix::Serialize(Buffer::Iterator start) const
|
||||
i.WriteU32(m_frameNumber);
|
||||
i.WriteU8(m_configurationChangeCount);
|
||||
|
||||
for (std::vector<DlFramePrefixIe>::const_iterator iter = m_dlFramePrefixElements.begin();
|
||||
iter != m_dlFramePrefixElements.end();
|
||||
iter++)
|
||||
for (const auto& dlFramePrefixElement : m_dlFramePrefixElements)
|
||||
{
|
||||
DlFramePrefixIe dlFramePrefixElement = *iter;
|
||||
i = dlFramePrefixElement.Write(i);
|
||||
}
|
||||
|
||||
|
||||
@@ -400,11 +400,8 @@ Ucd::GetSerializedSize() const
|
||||
{
|
||||
uint32_t ulBurstProfilesSize = 0;
|
||||
|
||||
for (std::vector<OfdmUlBurstProfile>::const_iterator iter = m_ulBurstProfiles.begin();
|
||||
iter != m_ulBurstProfiles.end();
|
||||
++iter)
|
||||
for (const auto& burstProfile : m_ulBurstProfiles)
|
||||
{
|
||||
OfdmUlBurstProfile burstProfile = *iter;
|
||||
ulBurstProfilesSize += burstProfile.GetSize();
|
||||
}
|
||||
|
||||
@@ -422,11 +419,8 @@ Ucd::Serialize(Buffer::Iterator start) const
|
||||
i.WriteU8(m_requestBackoffEnd);
|
||||
i = m_channelEncodings.Write(i);
|
||||
|
||||
for (std::vector<OfdmUlBurstProfile>::const_iterator iter = m_ulBurstProfiles.begin();
|
||||
iter != m_ulBurstProfiles.end();
|
||||
++iter)
|
||||
for (const auto& burstProfile : m_ulBurstProfiles)
|
||||
{
|
||||
OfdmUlBurstProfile burstProfile = *iter;
|
||||
i = burstProfile.Write(i);
|
||||
}
|
||||
}
|
||||
@@ -655,11 +649,9 @@ uint32_t
|
||||
UlMap::GetSerializedSize() const
|
||||
{
|
||||
uint32_t ulMapElementsSize = 0;
|
||||
for (std::list<OfdmUlMapIe>::const_iterator iter = m_ulMapElements.begin();
|
||||
iter != m_ulMapElements.end();
|
||||
++iter)
|
||||
|
||||
for (const auto& ulMapIe : m_ulMapElements)
|
||||
{
|
||||
OfdmUlMapIe ulMapIe = *iter;
|
||||
ulMapElementsSize += ulMapIe.GetSize();
|
||||
}
|
||||
|
||||
@@ -674,11 +666,8 @@ UlMap::Serialize(Buffer::Iterator start) const
|
||||
i.WriteU8(m_ucdCount);
|
||||
i.WriteU32(m_allocationStartTime);
|
||||
|
||||
for (std::list<OfdmUlMapIe>::const_iterator iter = m_ulMapElements.begin();
|
||||
iter != m_ulMapElements.end();
|
||||
++iter)
|
||||
for (const auto& ulMapIe : m_ulMapElements)
|
||||
{
|
||||
OfdmUlMapIe ulMapIe = *iter;
|
||||
i = ulMapIe.Write(i);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user