From b048f709122c8a666f393893a0de0d196696ae5a Mon Sep 17 00:00:00 2001 From: Eduardo Almeida Date: Thu, 20 Oct 2022 14:41:18 +0000 Subject: [PATCH] Fix the [[maybe_unused]] specifier placement to always come after the variable name --- examples/routing/manet-routing-compare.cc | 2 +- examples/tcp/tcp-linux-reno.cc | 2 +- examples/tcp/tcp-variants-comparison.cc | 6 +- .../model/three-gpp-http-client.cc | 2 +- .../model/three-gpp-http-server.cc | 6 +- .../buildings-channel-condition-model.cc | 2 +- src/core/model/attribute-accessor-helper.h | 4 +- src/core/model/log.h | 2 +- src/core/model/nstime.h | 2 +- src/core/model/simple-ref-count.h | 2 +- src/core/test/attribute-test-suite.cc | 12 ++-- src/core/test/callback-test-suite.cc | 8 +-- src/core/test/config-test-suite.cc | 4 +- src/core/test/simulator-test-suite.cc | 4 +- src/core/test/traced-callback-test-suite.cc | 2 +- src/dsr/model/dsr-options.cc | 2 +- src/internet/model/tcp-congestion-ops.cc | 4 +- src/internet/model/tcp-congestion-ops.h | 2 +- src/internet/model/tcp-prr-recovery.cc | 2 +- src/internet/model/tcp-recovery-ops.cc | 6 +- src/internet/model/tcp-socket-base.cc | 6 +- src/internet/model/tcp-tx-buffer.cc | 2 +- src/internet/model/tcp-westwood.cc | 2 +- src/internet/test/neighbor-cache-test.cc | 3 +- src/internet/test/tcp-general-test.cc | 2 +- src/internet/test/tcp-general-test.h | 72 +++++++++---------- src/internet/test/tcp-hybla-test.cc | 2 +- src/internet/test/tcp-rate-ops-test.cc | 2 +- src/lr-wpan/model/lr-wpan-csmaca.cc | 4 +- src/lte/model/lte-enb-mac.h | 2 +- .../model/no-op-component-carrier-manager.cc | 2 +- src/lte/test/lte-test-phy-error-model.cc | 4 +- src/mobility/helper/ns2-mobility-helper.cc | 2 +- src/netanim/model/animation-interface.cc | 2 +- src/network/test/packet-test-suite.cc | 2 +- src/network/utils/queue-size.cc | 2 +- src/nix-vector-routing/test/nix-test.cc | 2 +- .../model/channel-condition-model.cc | 16 ++--- .../model/three-gpp-propagation-loss-model.cc | 24 +++---- src/sixlowpan/model/sixlowpan-net-device.cc | 8 +-- src/stats/model/sqlite-output.cc | 8 +-- .../ns3tc/fq-cobalt-queue-disc-test-suite.cc | 4 +- src/traffic-control/model/queue-disc.cc | 2 +- .../test/cobalt-queue-disc-test-suite.cc | 4 +- .../test/codel-queue-disc-test-suite.cc | 8 +-- src/uan/helper/uan-helper.cc | 8 +-- src/uan/model/uan-mac-aloha.cc | 2 +- src/uan/model/uan-mac-cw.cc | 4 +- src/uan/model/uan-mac-rc-gw.cc | 10 +-- src/uan/model/uan-mac-rc.cc | 4 +- src/uan/model/uan-net-device.cc | 8 +-- src/uan/model/uan-phy-dual.cc | 4 +- src/uan/model/uan-phy-dual.h | 2 +- src/uan/model/uan-phy-gen.cc | 4 +- src/uan/test/uan-energy-model-test.cc | 4 +- src/uan/test/uan-test.cc | 4 +- src/wave/helper/wave-helper.cc | 2 +- src/wave/helper/wifi-80211p-helper.cc | 4 +- src/wifi/model/he/rr-multi-user-scheduler.cc | 2 +- 59 files changed, 162 insertions(+), 163 deletions(-) diff --git a/examples/routing/manet-routing-compare.cc b/examples/routing/manet-routing-compare.cc index 14366b41b..8e30de5ce 100644 --- a/examples/routing/manet-routing-compare.cc +++ b/examples/routing/manet-routing-compare.cc @@ -296,7 +296,7 @@ RoutingExperiment::Run(int nSinks, double txp, std::string CSVfileName) NetDeviceContainer adhocDevices = wifi.Install(wifiPhy, wifiMac, adhocNodes); MobilityHelper mobilityAdhoc; - [[maybe_unused]] int64_t streamIndex = 0; // used to get consistent mobility across scenarios + int64_t streamIndex [[maybe_unused]] = 0; // used to get consistent mobility across scenarios ObjectFactory pos; pos.SetTypeId("ns3::RandomRectanglePositionAllocator"); diff --git a/examples/tcp/tcp-linux-reno.cc b/examples/tcp/tcp-linux-reno.cc index 8b6f9cbc2..163d361bc 100644 --- a/examples/tcp/tcp-linux-reno.cc +++ b/examples/tcp/tcp-linux-reno.cc @@ -231,7 +231,7 @@ main(int argc, char* argv[]) // Create directories to store dat files struct stat buffer; - [[maybe_unused]] int retVal; + int retVal [[maybe_unused]]; if ((stat(dir.c_str(), &buffer)) == 0) { std::string dirToRemove = "rm -rf " + dir; diff --git a/examples/tcp/tcp-variants-comparison.cc b/examples/tcp/tcp-variants-comparison.cc index 62927a903..2ed1f78fa 100644 --- a/examples/tcp/tcp-variants-comparison.cc +++ b/examples/tcp/tcp-variants-comparison.cc @@ -189,7 +189,7 @@ RtoTracer(std::string context, Time oldval, Time newval) * \param nextTx Next sequence number. */ static void -NextTxTracer(std::string context, [[maybe_unused]] SequenceNumber32 old, SequenceNumber32 nextTx) +NextTxTracer(std::string context, SequenceNumber32 old [[maybe_unused]], SequenceNumber32 nextTx) { uint32_t nodeId = GetNodeIdFromContext(context); @@ -205,7 +205,7 @@ NextTxTracer(std::string context, [[maybe_unused]] SequenceNumber32 old, Sequenc * \param inFlight In flight value. */ static void -InFlightTracer(std::string context, [[maybe_unused]] uint32_t old, uint32_t inFlight) +InFlightTracer(std::string context, uint32_t old [[maybe_unused]], uint32_t inFlight) { uint32_t nodeId = GetNodeIdFromContext(context); @@ -221,7 +221,7 @@ InFlightTracer(std::string context, [[maybe_unused]] uint32_t old, uint32_t inFl * \param nextRx Next sequence number. */ static void -NextRxTracer(std::string context, [[maybe_unused]] SequenceNumber32 old, SequenceNumber32 nextRx) +NextRxTracer(std::string context, SequenceNumber32 old [[maybe_unused]], SequenceNumber32 nextRx) { uint32_t nodeId = GetNodeIdFromContext(context); diff --git a/src/applications/model/three-gpp-http-client.cc b/src/applications/model/three-gpp-http-client.cc index f9b31ecb9..0098272d5 100644 --- a/src/applications/model/three-gpp-http-client.cc +++ b/src/applications/model/three-gpp-http-client.cc @@ -363,7 +363,7 @@ ThreeGppHttpClient::OpenConnection() { m_socket = Socket::CreateSocket(GetNode(), TcpSocketFactory::GetTypeId()); - [[maybe_unused]] int ret; + int ret [[maybe_unused]]; if (Ipv4Address::IsMatchingType(m_remoteServerAddress)) { diff --git a/src/applications/model/three-gpp-http-server.cc b/src/applications/model/three-gpp-http-server.cc index 8329383af..00b35bddb 100644 --- a/src/applications/model/three-gpp-http-server.cc +++ b/src/applications/model/three-gpp-http-server.cc @@ -208,7 +208,7 @@ ThreeGppHttpServer::StartApplication() m_initialSocket = Socket::CreateSocket(GetNode(), TcpSocketFactory::GetTypeId()); m_initialSocket->SetAttribute("SegmentSize", UintegerValue(m_mtuSize)); - [[maybe_unused]] int ret; + int ret [[maybe_unused]]; if (Ipv4Address::IsMatchingType(m_localAddress)) { @@ -453,8 +453,8 @@ ThreeGppHttpServer::SendCallback(Ptr socket, uint32_t availableBufferSiz if (!m_txBuffer->IsBufferEmpty(socket)) { - [[maybe_unused]] const uint32_t txBufferSize = m_txBuffer->GetBufferSize(socket); - [[maybe_unused]] const uint32_t actualSent = ServeFromTxBuffer(socket); + const uint32_t txBufferSize [[maybe_unused]] = m_txBuffer->GetBufferSize(socket); + const uint32_t actualSent [[maybe_unused]] = ServeFromTxBuffer(socket); #ifdef NS3_LOG_ENABLE // Some log messages. diff --git a/src/buildings/model/buildings-channel-condition-model.cc b/src/buildings/model/buildings-channel-condition-model.cc index d7d174de6..0615ae22f 100644 --- a/src/buildings/model/buildings-channel-condition-model.cc +++ b/src/buildings/model/buildings-channel-condition-model.cc @@ -132,7 +132,7 @@ BuildingsChannelConditionModel::IsLineOfSightBlocked(const ns3::Vector& l1, } int64_t -BuildingsChannelConditionModel::AssignStreams([[maybe_unused]] int64_t stream) +BuildingsChannelConditionModel::AssignStreams(int64_t stream [[maybe_unused]]) { return 0; } diff --git a/src/core/model/attribute-accessor-helper.h b/src/core/model/attribute-accessor-helper.h index 55256761a..575f95a36 100644 --- a/src/core/model/attribute-accessor-helper.h +++ b/src/core/model/attribute-accessor-helper.h @@ -327,7 +327,7 @@ DoMakeAccessorHelperOne(U (T::*getter)() const) } private: - bool DoSet([[maybe_unused]] T* object, [[maybe_unused]] const V* v) const override + bool DoSet(T* object [[maybe_unused]], const V* v [[maybe_unused]]) const override { return false; } @@ -398,7 +398,7 @@ DoMakeAccessorHelperOne(void (T::*setter)(U)) return true; } - bool DoGet([[maybe_unused]] const T* object, [[maybe_unused]] V* v) const override + bool DoGet(const T* object [[maybe_unused]], V* v [[maybe_unused]]) const override { return false; } diff --git a/src/core/model/log.h b/src/core/model/log.h index 646ef9102..135c9efad 100644 --- a/src/core/model/log.h +++ b/src/core/model/log.h @@ -244,7 +244,7 @@ void LogComponentDisableAll(enum LogLevel level); * \param [in] name The log component name. */ #define NS_LOG_STATIC_TEMPLATE_DEFINE(name) \ - [[maybe_unused]] static LogComponent& g_log = GetLogComponent(name) + static LogComponent& g_log [[maybe_unused]] = GetLogComponent(name) /** * Use \ref NS_LOG to output a message of level LOG_ERROR. diff --git a/src/core/model/nstime.h b/src/core/model/nstime.h index 59da336db..a762a6add 100644 --- a/src/core/model/nstime.h +++ b/src/core/model/nstime.h @@ -856,7 +856,7 @@ typedef void (*Time)(Time oldValue, Time newValue); * This is internal to the Time implementation. * \relates Time */ -[[maybe_unused]] static bool g_TimeStaticInit = Time::StaticInit(); +static bool g_TimeStaticInit [[maybe_unused]] = Time::StaticInit(); /** * Equality operator for Time. diff --git a/src/core/model/simple-ref-count.h b/src/core/model/simple-ref-count.h index 78dbaed3d..75f075e50 100644 --- a/src/core/model/simple-ref-count.h +++ b/src/core/model/simple-ref-count.h @@ -100,7 +100,7 @@ class SimpleRefCount : public PARENT * \param [in] o The object to copy * \returns The copy of \pname{o} */ - SimpleRefCount& operator=([[maybe_unused]] const SimpleRefCount& o) + SimpleRefCount& operator=(const SimpleRefCount& o [[maybe_unused]]) { return *this; } diff --git a/src/core/test/attribute-test-suite.cc b/src/core/test/attribute-test-suite.cc index 6f92a5160..4e6a706e1 100644 --- a/src/core/test/attribute-test-suite.cc +++ b/src/core/test/attribute-test-suite.cc @@ -80,7 +80,7 @@ class ValueClassTest * \return always true. */ bool -operator!=([[maybe_unused]] const ValueClassTest& a, [[maybe_unused]] const ValueClassTest& b) +operator!=(const ValueClassTest& a [[maybe_unused]], const ValueClassTest& b [[maybe_unused]]) { return true; } @@ -93,7 +93,7 @@ operator!=([[maybe_unused]] const ValueClassTest& a, [[maybe_unused]] const Valu * \returns The reference to the output stream. */ std::ostream& -operator<<(std::ostream& os, [[maybe_unused]] ValueClassTest v) +operator<<(std::ostream& os, ValueClassTest v [[maybe_unused]]) { return os; } @@ -106,7 +106,7 @@ operator<<(std::ostream& os, [[maybe_unused]] ValueClassTest v) * \returns The reference to the input stream. */ std::istream& -operator>>(std::istream& is, [[maybe_unused]] ValueClassTest& v) +operator>>(std::istream& is, ValueClassTest& v [[maybe_unused]]) { return is; } @@ -1471,7 +1471,7 @@ class IntegerTraceSourceTestCase : public TestCase * \param old First value. * \param n Second value. */ - void NotifySource1([[maybe_unused]] int8_t old, int8_t n) + void NotifySource1(int8_t old [[maybe_unused]], int8_t n) { m_got1 = n; } @@ -1574,7 +1574,7 @@ class TracedCallbackTestCase : public TestCase * \param b Second value. * \param c Third value. */ - void NotifySource2(double a, [[maybe_unused]] int b, [[maybe_unused]] float c) + void NotifySource2(double a, int b [[maybe_unused]], float c [[maybe_unused]]) { m_got2 = a; } @@ -1675,7 +1675,7 @@ class PointerAttributeTestCase : public TestCase * \param b Second value. * \param c Third value. */ - void NotifySource2(double a, [[maybe_unused]] int b, [[maybe_unused]] float c) + void NotifySource2(double a, int b [[maybe_unused]], float c [[maybe_unused]]) { m_got2 = a; } diff --git a/src/core/test/callback-test-suite.cc b/src/core/test/callback-test-suite.cc index 7627a29ea..ef76e4469 100644 --- a/src/core/test/callback-test-suite.cc +++ b/src/core/test/callback-test-suite.cc @@ -69,7 +69,7 @@ class BasicCallbackTestCase : public TestCase * Callback 3 target function. * \param a A parameter (unused). */ - void Target3([[maybe_unused]] double a) + void Target3(double a [[maybe_unused]]) { m_test3 = true; } @@ -80,7 +80,7 @@ class BasicCallbackTestCase : public TestCase * \param b Another parameter (unused). * \return four. */ - int Target4([[maybe_unused]] double a, [[maybe_unused]] int b) + int Target4(double a [[maybe_unused]], int b [[maybe_unused]]) { m_test4 = true; return 4; @@ -266,7 +266,7 @@ class MakeCallbackTestCase : public TestCase * Callback 3 target function. * \param a A parameter (unused). */ - void Target3([[maybe_unused]] double a) + void Target3(double a [[maybe_unused]]) { m_test3 = true; } @@ -277,7 +277,7 @@ class MakeCallbackTestCase : public TestCase * \param b Another parameter (unused). * \return four. */ - int Target4([[maybe_unused]] double a, [[maybe_unused]] int b) + int Target4(double a [[maybe_unused]], int b [[maybe_unused]]) { m_test4 = true; return 4; diff --git a/src/core/test/config-test-suite.cc b/src/core/test/config-test-suite.cc index fb4f27e2a..74589e17b 100644 --- a/src/core/test/config-test-suite.cc +++ b/src/core/test/config-test-suite.cc @@ -649,7 +649,7 @@ class ObjectVectorTraceConfigTestCase : public TestCase * \param oldValue The old value. * \param newValue The new value. */ - void Trace([[maybe_unused]] int16_t oldValue, int16_t newValue) + void Trace(int16_t oldValue [[maybe_unused]], int16_t newValue) { m_newValue = newValue; } @@ -660,7 +660,7 @@ class ObjectVectorTraceConfigTestCase : public TestCase * \param old The old value. * \param newValue The new value. */ - void TraceWithPath(std::string path, [[maybe_unused]] int16_t old, int16_t newValue) + void TraceWithPath(std::string path, int16_t old [[maybe_unused]], int16_t newValue) { m_newValue = newValue; m_path = path; diff --git a/src/core/test/simulator-test-suite.cc b/src/core/test/simulator-test-suite.cc index 8ddc799fb..ff285b45c 100644 --- a/src/core/test/simulator-test-suite.cc +++ b/src/core/test/simulator-test-suite.cc @@ -107,7 +107,7 @@ SimulatorEventsTestCase::NowUs() } void -SimulatorEventsTestCase::EventA([[maybe_unused]] int a) +SimulatorEventsTestCase::EventA(int a [[maybe_unused]]) { m_a = false; } @@ -128,7 +128,7 @@ SimulatorEventsTestCase::EventB(int b) } void -SimulatorEventsTestCase::EventC([[maybe_unused]] int c) +SimulatorEventsTestCase::EventC(int c [[maybe_unused]]) { m_c = false; } diff --git a/src/core/test/traced-callback-test-suite.cc b/src/core/test/traced-callback-test-suite.cc index a08f978a2..e4388620d 100644 --- a/src/core/test/traced-callback-test-suite.cc +++ b/src/core/test/traced-callback-test-suite.cc @@ -66,7 +66,7 @@ BasicTracedCallbackTestCase::BasicTracedCallbackTestCase() } void -BasicTracedCallbackTestCase::CbOne([[maybe_unused]] uint8_t a, [[maybe_unused]] double b) +BasicTracedCallbackTestCase::CbOne(uint8_t a [[maybe_unused]], double b [[maybe_unused]]) { m_one = true; } diff --git a/src/dsr/model/dsr-options.cc b/src/dsr/model/dsr-options.cc index 27bff07e4..9504676ce 100644 --- a/src/dsr/model/dsr-options.cc +++ b/src/dsr/model/dsr-options.cc @@ -1597,7 +1597,7 @@ DsrOptionRerr::Process(Ptr packet, /* * The error serialized size */ - [[maybe_unused]] uint32_t rerrSize; + uint32_t rerrSize [[maybe_unused]]; NS_LOG_DEBUG("The error type value here " << (uint32_t)errorType); if (errorType == 1) // unreachable ip address { diff --git a/src/internet/model/tcp-congestion-ops.cc b/src/internet/model/tcp-congestion-ops.cc index 00be006bb..148c23e5d 100644 --- a/src/internet/model/tcp-congestion-ops.cc +++ b/src/internet/model/tcp-congestion-ops.cc @@ -81,8 +81,8 @@ TcpCongestionOps::HasCongControl() const void TcpCongestionOps::CongControl(Ptr tcb, - [[maybe_unused]] const TcpRateOps::TcpRateConnection& rc, - [[maybe_unused]] const TcpRateOps::TcpRateSample& rs) + const TcpRateOps::TcpRateConnection& rc [[maybe_unused]], + const TcpRateOps::TcpRateSample& rs [[maybe_unused]]) { NS_LOG_FUNCTION(this << tcb); } diff --git a/src/internet/model/tcp-congestion-ops.h b/src/internet/model/tcp-congestion-ops.h index 0600fde67..8f2ef7a83 100644 --- a/src/internet/model/tcp-congestion-ops.h +++ b/src/internet/model/tcp-congestion-ops.h @@ -79,7 +79,7 @@ class TcpCongestionOps : public Object * * \param tcb internal congestion state */ - virtual void Init([[maybe_unused]] Ptr tcb) + virtual void Init(Ptr tcb [[maybe_unused]]) { } diff --git a/src/internet/model/tcp-prr-recovery.cc b/src/internet/model/tcp-prr-recovery.cc index 8590fa209..8c6dd230e 100644 --- a/src/internet/model/tcp-prr-recovery.cc +++ b/src/internet/model/tcp-prr-recovery.cc @@ -70,7 +70,7 @@ TcpPrrRecovery::~TcpPrrRecovery() void TcpPrrRecovery::EnterRecovery(Ptr tcb, - [[maybe_unused]] uint32_t dupAckCount, + uint32_t dupAckCount [[maybe_unused]], uint32_t unAckDataCount, uint32_t deliveredBytes) { diff --git a/src/internet/model/tcp-recovery-ops.cc b/src/internet/model/tcp-recovery-ops.cc index bd7b2aba9..3ede14bcc 100644 --- a/src/internet/model/tcp-recovery-ops.cc +++ b/src/internet/model/tcp-recovery-ops.cc @@ -96,8 +96,8 @@ TcpClassicRecovery::~TcpClassicRecovery() void TcpClassicRecovery::EnterRecovery(Ptr tcb, uint32_t dupAckCount, - [[maybe_unused]] uint32_t unAckDataCount, - [[maybe_unused]] uint32_t deliveredBytes) + uint32_t unAckDataCount [[maybe_unused]], + uint32_t deliveredBytes [[maybe_unused]]) { NS_LOG_FUNCTION(this << tcb << dupAckCount << unAckDataCount); tcb->m_cWnd = tcb->m_ssThresh; @@ -105,7 +105,7 @@ TcpClassicRecovery::EnterRecovery(Ptr tcb, } void -TcpClassicRecovery::DoRecovery(Ptr tcb, [[maybe_unused]] uint32_t deliveredBytes) +TcpClassicRecovery::DoRecovery(Ptr tcb, uint32_t deliveredBytes [[maybe_unused]]) { NS_LOG_FUNCTION(this << tcb << deliveredBytes); tcb->m_cWndInfl += tcb->m_segmentSize; diff --git a/src/internet/model/tcp-socket-base.cc b/src/internet/model/tcp-socket-base.cc index 591bde86b..f8ef04188 100644 --- a/src/internet/model/tcp-socket-base.cc +++ b/src/internet/model/tcp-socket-base.cc @@ -892,7 +892,7 @@ TcpSocketBase::Send(Ptr p, uint32_t flags) /* Inherit from Socket class: In TcpSocketBase, it is same as Send() call */ int -TcpSocketBase::SendTo(Ptr p, uint32_t flags, [[maybe_unused]] const Address& address) +TcpSocketBase::SendTo(Ptr p, uint32_t flags, const Address& address [[maybe_unused]]) { return Send(p, flags); // SendTo() and Send() are the same } @@ -2369,7 +2369,7 @@ void TcpSocketBase::ProcessSynRcvd(Ptr packet, const TcpHeader& tcpHeader, const Address& fromAddress, - [[maybe_unused]] const Address& toAddress) + const Address& toAddress [[maybe_unused]]) { NS_LOG_FUNCTION(this << tcpHeader); @@ -2964,7 +2964,7 @@ TcpSocketBase::SetupEndpoint6() TcpSocketBase cloned, allocate a new end point to handle the incoming connection and send a SYN+ACK to complete the handshake. */ void -TcpSocketBase::CompleteFork([[maybe_unused]] Ptr p, +TcpSocketBase::CompleteFork(Ptr p [[maybe_unused]], const TcpHeader& h, const Address& fromAddress, const Address& toAddress) diff --git a/src/internet/model/tcp-tx-buffer.cc b/src/internet/model/tcp-tx-buffer.cc index befdd08d7..dcfa46e27 100644 --- a/src/internet/model/tcp-tx-buffer.cc +++ b/src/internet/model/tcp-tx-buffer.cc @@ -687,7 +687,7 @@ TcpTxBuffer::DiscardUpTo(const SequenceNumber32& seq, const Callback p = + Ptr p [[maybe_unused]] = CopyFromSequence(offset, m_firstByteSeq)->GetPacketCopy(); NS_ASSERT(p); i = m_sentList.begin(); diff --git a/src/internet/model/tcp-westwood.cc b/src/internet/model/tcp-westwood.cc index 0c31ff4ef..47d19711c 100644 --- a/src/internet/model/tcp-westwood.cc +++ b/src/internet/model/tcp-westwood.cc @@ -175,7 +175,7 @@ TcpWestwood::EstimateBW(const Time& rtt, Ptr tcb) } uint32_t -TcpWestwood::GetSsThresh(Ptr tcb, [[maybe_unused]] uint32_t bytesInFlight) +TcpWestwood::GetSsThresh(Ptr tcb, uint32_t bytesInFlight [[maybe_unused]]) { uint32_t ssThresh = static_cast((m_currentBW * tcb->m_minRtt) / 8.0); diff --git a/src/internet/test/neighbor-cache-test.cc b/src/internet/test/neighbor-cache-test.cc index 91087f2f3..12598a780 100644 --- a/src/internet/test/neighbor-cache-test.cc +++ b/src/internet/test/neighbor-cache-test.cc @@ -129,8 +129,7 @@ DynamicNeighborCacheTest::DynamicNeighborCacheTest() void DynamicNeighborCacheTest::ReceivePkt(Ptr socket) { - [[maybe_unused]] uint32_t availableData; - availableData = socket->GetRxAvailable(); + uint32_t availableData [[maybe_unused]] = socket->GetRxAvailable(); m_receivedPacket = socket->Recv(std::numeric_limits::max(), 0); NS_TEST_ASSERT_MSG_EQ(availableData, m_receivedPacket->GetSize(), diff --git a/src/internet/test/tcp-general-test.cc b/src/internet/test/tcp-general-test.cc index 03ae48d42..dc21d2f89 100644 --- a/src/internet/test/tcp-general-test.cc +++ b/src/internet/test/tcp-general-test.cc @@ -364,7 +364,7 @@ TcpGeneralTest::QueueDropCb(std::string context, Ptr p) } void -TcpGeneralTest::PhyDropCb(std::string context, [[maybe_unused]] Ptr p) +TcpGeneralTest::PhyDropCb(std::string context, Ptr p [[maybe_unused]]) { if (context == "SENDER") { diff --git a/src/internet/test/tcp-general-test.h b/src/internet/test/tcp-general-test.h index 2dd0b284a..b76ea5888 100644 --- a/src/internet/test/tcp-general-test.h +++ b/src/internet/test/tcp-general-test.h @@ -723,8 +723,8 @@ class TcpGeneralTest : public TestCase * \param oldValue old value * \param newValue new value */ - virtual void CongStateTrace([[maybe_unused]] const TcpSocketState::TcpCongState_t oldValue, - [[maybe_unused]] const TcpSocketState::TcpCongState_t newValue) + virtual void CongStateTrace(const TcpSocketState::TcpCongState_t oldValue [[maybe_unused]], + const TcpSocketState::TcpCongState_t newValue [[maybe_unused]]) { } @@ -734,7 +734,7 @@ class TcpGeneralTest : public TestCase * \param oldValue old value * \param newValue new value */ - virtual void CWndTrace([[maybe_unused]] uint32_t oldValue, [[maybe_unused]] uint32_t newValue) + virtual void CWndTrace(uint32_t oldValue [[maybe_unused]], uint32_t newValue [[maybe_unused]]) { } @@ -744,8 +744,8 @@ class TcpGeneralTest : public TestCase * \param oldValue old value * \param newValue new value */ - virtual void CWndInflTrace([[maybe_unused]] uint32_t oldValue, - [[maybe_unused]] uint32_t newValue) + virtual void CWndInflTrace(uint32_t oldValue [[maybe_unused]], + uint32_t newValue [[maybe_unused]]) { } @@ -757,7 +757,7 @@ class TcpGeneralTest : public TestCase * \param oldTime old value * \param newTime new value */ - virtual void RttTrace([[maybe_unused]] Time oldTime, [[maybe_unused]] Time newTime) + virtual void RttTrace(Time oldTime [[maybe_unused]], Time newTime [[maybe_unused]]) { } @@ -769,8 +769,8 @@ class TcpGeneralTest : public TestCase * \param oldValue old value * \param newValue new value */ - virtual void SsThreshTrace([[maybe_unused]] uint32_t oldValue, - [[maybe_unused]] uint32_t newValue) + virtual void SsThreshTrace(uint32_t oldValue [[maybe_unused]], + uint32_t newValue [[maybe_unused]]) { } @@ -782,8 +782,8 @@ class TcpGeneralTest : public TestCase * \param oldValue old value * \param newValue new value */ - virtual void BytesInFlightTrace([[maybe_unused]] uint32_t oldValue, - [[maybe_unused]] uint32_t newValue) + virtual void BytesInFlightTrace(uint32_t oldValue [[maybe_unused]], + uint32_t newValue [[maybe_unused]]) { } @@ -795,7 +795,7 @@ class TcpGeneralTest : public TestCase * \param oldValue old value * \param newValue new value */ - virtual void RtoTrace([[maybe_unused]] Time oldValue, [[maybe_unused]] Time newValue) + virtual void RtoTrace(Time oldValue [[maybe_unused]], Time newValue [[maybe_unused]]) { } @@ -807,8 +807,8 @@ class TcpGeneralTest : public TestCase * \param oldValue old value * \param newValue new value */ - virtual void NextTxSeqTrace([[maybe_unused]] SequenceNumber32 oldValue, - [[maybe_unused]] SequenceNumber32 newValue) + virtual void NextTxSeqTrace(SequenceNumber32 oldValue [[maybe_unused]], + SequenceNumber32 newValue [[maybe_unused]]) { } @@ -820,8 +820,8 @@ class TcpGeneralTest : public TestCase * \param oldValue old value * \param newValue new value */ - virtual void HighestTxSeqTrace([[maybe_unused]] SequenceNumber32 oldValue, - [[maybe_unused]] SequenceNumber32 newValue) + virtual void HighestTxSeqTrace(SequenceNumber32 oldValue [[maybe_unused]], + SequenceNumber32 newValue [[maybe_unused]]) { } @@ -829,7 +829,7 @@ class TcpGeneralTest : public TestCase * \brief Track the rate value of TcpRateLinux. * \param rate updated value of TcpRate. */ - virtual void RateUpdatedTrace([[maybe_unused]] const TcpRateLinux::TcpRateConnection& rate) + virtual void RateUpdatedTrace(const TcpRateLinux::TcpRateConnection& rate [[maybe_unused]]) { } @@ -837,7 +837,7 @@ class TcpGeneralTest : public TestCase * \brief Track the rate sample value of TcpRateLinux. * \param sample updated value of TcpRateSample. */ - virtual void RateSampleUpdatedTrace([[maybe_unused]] const TcpRateLinux::TcpRateSample& sample) + virtual void RateSampleUpdatedTrace(const TcpRateLinux::TcpRateSample& sample [[maybe_unused]]) { } @@ -845,7 +845,7 @@ class TcpGeneralTest : public TestCase * \brief Socket closed normally * \param who the socket closed (SENDER or RECEIVER) */ - virtual void NormalClose([[maybe_unused]] SocketWho who) + virtual void NormalClose(SocketWho who [[maybe_unused]]) { } @@ -854,7 +854,7 @@ class TcpGeneralTest : public TestCase * * \param who the socket closed (SENDER or RECEIVER) */ - virtual void ErrorClose([[maybe_unused]] SocketWho who) + virtual void ErrorClose(SocketWho who [[maybe_unused]]) { /** \todo indicate the error */ } @@ -863,7 +863,7 @@ class TcpGeneralTest : public TestCase * \brief Drop on the queue * \param who where the drop occurred (SENDER or RECEIVER) */ - virtual void QueueDrop([[maybe_unused]] SocketWho who) + virtual void QueueDrop(SocketWho who [[maybe_unused]]) { } @@ -871,7 +871,7 @@ class TcpGeneralTest : public TestCase * \brief Link drop * \param who where the drop occurred (SENDER or RECEIVER) */ - virtual void PhyDrop([[maybe_unused]] SocketWho who) + virtual void PhyDrop(SocketWho who [[maybe_unused]]) { } @@ -884,9 +884,9 @@ class TcpGeneralTest : public TestCase * \param h the header of segment * \param who the socket which has received the ACK (SENDER or RECEIVER) */ - virtual void RcvAck([[maybe_unused]] const Ptr tcb, - [[maybe_unused]] const TcpHeader& h, - [[maybe_unused]] SocketWho who) + virtual void RcvAck(const Ptr tcb [[maybe_unused]], + const TcpHeader& h [[maybe_unused]], + SocketWho who [[maybe_unused]]) { } @@ -899,9 +899,9 @@ class TcpGeneralTest : public TestCase * \param h the header of segment * \param who the socket which has processed the ACK (SENDER or RECEIVER) */ - virtual void ProcessedAck([[maybe_unused]] const Ptr tcb, - [[maybe_unused]] const TcpHeader& h, - [[maybe_unused]] SocketWho who) + virtual void ProcessedAck(const Ptr tcb [[maybe_unused]], + const TcpHeader& h [[maybe_unused]], + SocketWho who [[maybe_unused]]) { } @@ -929,8 +929,8 @@ class TcpGeneralTest : public TestCase * \param tcb Transmission control block * \param who where the RTO has expired (SENDER or RECEIVER) */ - virtual void AfterRTOExpired([[maybe_unused]] const Ptr tcb, - [[maybe_unused]] SocketWho who) + virtual void AfterRTOExpired(const Ptr tcb [[maybe_unused]], + SocketWho who [[maybe_unused]]) { } @@ -940,8 +940,8 @@ class TcpGeneralTest : public TestCase * \param tcb Transmission control block * \param who where the RTO has expired (SENDER or RECEIVER) */ - virtual void BeforeRTOExpired([[maybe_unused]] const Ptr tcb, - [[maybe_unused]] SocketWho who) + virtual void BeforeRTOExpired(const Ptr tcb [[maybe_unused]], + SocketWho who [[maybe_unused]]) { } @@ -952,10 +952,10 @@ class TcpGeneralTest : public TestCase * \param isRetransmission self-explanatory * \param who where the rtt history was updated */ - virtual void UpdatedRttHistory([[maybe_unused]] const SequenceNumber32& seq, - [[maybe_unused]] uint32_t sz, - [[maybe_unused]] bool isRetransmission, - [[maybe_unused]] SocketWho who) + virtual void UpdatedRttHistory(const SequenceNumber32& seq [[maybe_unused]], + uint32_t sz [[maybe_unused]], + bool isRetransmission [[maybe_unused]], + SocketWho who [[maybe_unused]]) { } @@ -965,7 +965,7 @@ class TcpGeneralTest : public TestCase * \param size the amount of bytes transmitted * \param who where the RTO has expired (SENDER or RECEIVER) */ - virtual void DataSent([[maybe_unused]] uint32_t size, [[maybe_unused]] SocketWho who) + virtual void DataSent(uint32_t size [[maybe_unused]], SocketWho who [[maybe_unused]]) { } diff --git a/src/internet/test/tcp-hybla-test.cc b/src/internet/test/tcp-hybla-test.cc index 4d5a1ffd9..5ced133dc 100644 --- a/src/internet/test/tcp-hybla-test.cc +++ b/src/internet/test/tcp-hybla-test.cc @@ -82,7 +82,7 @@ TcpHyblaIncrementTest::TcpHyblaIncrementTest(uint32_t cWnd, } void -TcpHyblaIncrementTest::RhoUpdated([[maybe_unused]] double oldVal, double newVal) +TcpHyblaIncrementTest::RhoUpdated(double oldVal [[maybe_unused]], double newVal) { m_rho = newVal; } diff --git a/src/internet/test/tcp-rate-ops-test.cc b/src/internet/test/tcp-rate-ops-test.cc index d6897396f..f243ce8d3 100644 --- a/src/internet/test/tcp-rate-ops-test.cc +++ b/src/internet/test/tcp-rate-ops-test.cc @@ -381,7 +381,7 @@ TcpRateLinuxWithSocketsTest::Rx(const Ptr p, const TcpHeader& h, S } void -TcpRateLinuxWithSocketsTest::BytesInFlightTrace([[maybe_unused]] uint32_t oldValue, +TcpRateLinuxWithSocketsTest::BytesInFlightTrace(uint32_t oldValue [[maybe_unused]], uint32_t newValue) { m_bytesInFlight = newValue; diff --git a/src/lr-wpan/model/lr-wpan-csmaca.cc b/src/lr-wpan/model/lr-wpan-csmaca.cc index 662d79e20..d4ac26469 100644 --- a/src/lr-wpan/model/lr-wpan-csmaca.cc +++ b/src/lr-wpan/model/lr-wpan-csmaca.cc @@ -199,8 +199,8 @@ LrWpanCsmaCa::GetTimeToNextSlot() const uint64_t elapsedSuperframeSymbols; uint64_t symbolRate; Time timeAtBoundary; - [[maybe_unused]] Time elapsedCap; - [[maybe_unused]] Time beaconTime; + Time elapsedCap [[maybe_unused]]; + Time beaconTime [[maybe_unused]]; currentTime = Simulator::Now(); symbolRate = (uint64_t)m_mac->GetPhy()->GetDataOrSymbolRate(false); // symbols per second diff --git a/src/lte/model/lte-enb-mac.h b/src/lte/model/lte-enb-mac.h index f66947226..690b8a7e3 100644 --- a/src/lte/model/lte-enb-mac.h +++ b/src/lte/model/lte-enb-mac.h @@ -349,7 +349,7 @@ class LteEnbMac : public Object * * Since SR is not implemented in LTE, this method does nothing. */ - void DoReportSrToScheduler([[maybe_unused]] uint16_t rnti) + void DoReportSrToScheduler(uint16_t rnti [[maybe_unused]]) { } diff --git a/src/lte/model/no-op-component-carrier-manager.cc b/src/lte/model/no-op-component-carrier-manager.cc index c8215dc16..40564737c 100644 --- a/src/lte/model/no-op-component-carrier-manager.cc +++ b/src/lte/model/no-op-component-carrier-manager.cc @@ -475,7 +475,7 @@ RrComponentCarrierManager::DoUlReceiveMacCe(MacCeListElement_s bsr, uint8_t comp } void -RrComponentCarrierManager::DoUlReceiveSr(uint16_t rnti, [[maybe_unused]] uint8_t componentCarrierId) +RrComponentCarrierManager::DoUlReceiveSr(uint16_t rnti, uint8_t componentCarrierId [[maybe_unused]]) { NS_LOG_FUNCTION(this); // split traffic in uplink equally among carriers diff --git a/src/lte/test/lte-test-phy-error-model.cc b/src/lte/test/lte-test-phy-error-model.cc index e9b0c487a..cede73375 100644 --- a/src/lte/test/lte-test-phy-error-model.cc +++ b/src/lte/test/lte-test-phy-error-model.cc @@ -245,7 +245,7 @@ LenaDataPhyErrorModelTestCase::DoRun() double dlRxPackets = rlcStats->GetDlRxPackets(imsi, lcId); double dlTxPackets = rlcStats->GetDlTxPackets(imsi, lcId); - [[maybe_unused]] double dlBler = 1.0 - (dlRxPackets / dlTxPackets); + double dlBler [[maybe_unused]] = 1.0 - (dlRxPackets / dlTxPackets); double expectedDlRxPackets = dlTxPackets - dlTxPackets * m_blerRef; NS_LOG_INFO("\tUser " << i << " imsi " << imsi << " DOWNLINK" << " pkts rx " << dlRxPackets << " tx " << dlTxPackets << " BLER " @@ -407,7 +407,7 @@ LenaDlCtrlPhyErrorModelTestCase::DoRun() uint8_t lcId = 3; double dlRxPackets = rlcStats->GetDlRxPackets(imsi, lcId); double dlTxPackets = rlcStats->GetDlTxPackets(imsi, lcId); - [[maybe_unused]] double dlBler = 1.0 - (dlRxPackets / dlTxPackets); + double dlBler [[maybe_unused]] = 1.0 - (dlRxPackets / dlTxPackets); double expectedDlRxPackets = dlTxPackets - dlTxPackets * m_blerRef; NS_LOG_INFO("\tUser " << i << " imsi " << imsi << " DOWNLINK" << " pkts rx " << dlRxPackets << " tx " << dlTxPackets << " BLER " diff --git a/src/mobility/helper/ns2-mobility-helper.cc b/src/mobility/helper/ns2-mobility-helper.cc index 4e2d1cee9..49fe0de4b 100644 --- a/src/mobility/helper/ns2-mobility-helper.cc +++ b/src/mobility/helper/ns2-mobility-helper.cc @@ -608,7 +608,7 @@ bool IsNumber(const std::string& s) { char* endp; - [[maybe_unused]] double v = strtod(s.c_str(), &endp); + double v [[maybe_unused]] = strtod(s.c_str(), &endp); return endp == s.c_str() + s.size(); } diff --git a/src/netanim/model/animation-interface.cc b/src/netanim/model/animation-interface.cc index d3f4e1610..5361f3386 100644 --- a/src/netanim/model/animation-interface.cc +++ b/src/netanim/model/animation-interface.cc @@ -925,7 +925,7 @@ AnimationInterface::UanPhyGenRxTrace(std::string context, Ptr p) void AnimationInterface::WifiPhyTxBeginTrace(std::string context, WifiConstPsduMap psduMap, - [[maybe_unused]] WifiTxVector txVector, + WifiTxVector txVector [[maybe_unused]], double txPowerW) { NS_LOG_FUNCTION(this); diff --git a/src/network/test/packet-test-suite.cc b/src/network/test/packet-test-suite.cc index 775eb2e37..a0cd46d01 100644 --- a/src/network/test/packet-test-suite.cc +++ b/src/network/test/packet-test-suite.cc @@ -1037,7 +1037,7 @@ PacketTagListTest::CheckRef(const PacketTagList& ref, ATestTagBase& t, const cha ATestTag<5> t5(1); \ ATestTag<6> t6(1); \ ATestTag<7> t7(1); \ - [[maybe_unused]] const int tagLast = 7; /* length of ref PacketTagList */ + const int tagLast [[maybe_unused]] = 7; /* length of ref PacketTagList */ void PacketTagListTest::CheckRefList(const PacketTagList& ptl, const char* msg, int miss /* = 0 */) diff --git a/src/network/utils/queue-size.cc b/src/network/utils/queue-size.cc index b958cfeac..c69333c0c 100644 --- a/src/network/utils/queue-size.cc +++ b/src/network/utils/queue-size.cc @@ -189,7 +189,7 @@ QueueSize::GetValue() const QueueSize::QueueSize(std::string size) { NS_LOG_FUNCTION(this << size); - [[maybe_unused]] bool ok = DoParse(size, &m_unit, &m_value); + bool ok [[maybe_unused]] = DoParse(size, &m_unit, &m_value); NS_ABORT_MSG_IF(!ok, "Could not parse queue size: " << size); } diff --git a/src/nix-vector-routing/test/nix-test.cc b/src/nix-vector-routing/test/nix-test.cc index 936c2d520..9e0e9d5d5 100644 --- a/src/nix-vector-routing/test/nix-test.cc +++ b/src/nix-vector-routing/test/nix-test.cc @@ -117,7 +117,7 @@ NixVectorRoutingTest::NixVectorRoutingTest() void NixVectorRoutingTest::ReceivePkt(Ptr socket) { - [[maybe_unused]] uint32_t availableData = socket->GetRxAvailable(); + uint32_t availableData [[maybe_unused]] = socket->GetRxAvailable(); m_receivedPacket = socket->Recv(std::numeric_limits::max(), 0); NS_TEST_ASSERT_MSG_EQ(availableData, m_receivedPacket->GetSize(), diff --git a/src/propagation/model/channel-condition-model.cc b/src/propagation/model/channel-condition-model.cc index c14d6f444..20fc3cb11 100644 --- a/src/propagation/model/channel-condition-model.cc +++ b/src/propagation/model/channel-condition-model.cc @@ -203,9 +203,9 @@ AlwaysLosChannelConditionModel::~AlwaysLosChannelConditionModel() } Ptr -AlwaysLosChannelConditionModel::GetChannelCondition( - [[maybe_unused]] Ptr a, - [[maybe_unused]] Ptr b) const +AlwaysLosChannelConditionModel::GetChannelCondition(Ptr a [[maybe_unused]], + Ptr b + [[maybe_unused]]) const { Ptr c = CreateObject(ChannelCondition::LOS); @@ -241,9 +241,9 @@ NeverLosChannelConditionModel::~NeverLosChannelConditionModel() } Ptr -NeverLosChannelConditionModel::GetChannelCondition( - [[maybe_unused]] Ptr a, - [[maybe_unused]] Ptr b) const +NeverLosChannelConditionModel::GetChannelCondition(Ptr a [[maybe_unused]], + Ptr b + [[maybe_unused]]) const { Ptr c = CreateObject(ChannelCondition::NLOS); @@ -408,8 +408,8 @@ ThreeGppChannelConditionModel::GetChannelCondition(Ptr a, } ChannelCondition::O2iConditionValue -ThreeGppChannelConditionModel::ComputeO2i([[maybe_unused]] Ptr a, - [[maybe_unused]] Ptr b) const +ThreeGppChannelConditionModel::ComputeO2i(Ptr a [[maybe_unused]], + Ptr b [[maybe_unused]]) const { double o2iProb = m_uniformVarO2i->GetValue(0, 1); diff --git a/src/propagation/model/three-gpp-propagation-loss-model.cc b/src/propagation/model/three-gpp-propagation-loss-model.cc index 5420d118f..b7dbbc371 100644 --- a/src/propagation/model/three-gpp-propagation-loss-model.cc +++ b/src/propagation/model/three-gpp-propagation-loss-model.cc @@ -729,7 +729,7 @@ double ThreeGppRmaPropagationLossModel::Pl1(double frequency, double distance3D, double h, - [[maybe_unused]] double w) + double w [[maybe_unused]]) { double loss = 20.0 * log10(40.0 * M_PI * distance3D * frequency / 1e9 / 3.0) + std::min(0.03 * pow(h, 1.72), 10.0) * log10(distance3D) - @@ -925,8 +925,8 @@ ThreeGppUmaPropagationLossModel::GetLossNlos(double distance2D, } double -ThreeGppUmaPropagationLossModel::GetShadowingStd([[maybe_unused]] Ptr a, - [[maybe_unused]] Ptr b, +ThreeGppUmaPropagationLossModel::GetShadowingStd(Ptr a [[maybe_unused]], + Ptr b [[maybe_unused]], ChannelCondition::LosConditionValue cond) const { NS_LOG_FUNCTION(this); @@ -1013,7 +1013,7 @@ ThreeGppUmiStreetCanyonPropagationLossModel::~ThreeGppUmiStreetCanyonPropagation double ThreeGppUmiStreetCanyonPropagationLossModel::GetBpDistance(double hUt, double hBs, - [[maybe_unused]] double distance2D) const + double distance2D [[maybe_unused]]) const { NS_LOG_FUNCTION(this); @@ -1174,8 +1174,8 @@ ThreeGppUmiStreetCanyonPropagationLossModel::GetUtAndBsHeights(double za, double double ThreeGppUmiStreetCanyonPropagationLossModel::GetShadowingStd( - [[maybe_unused]] Ptr a, - [[maybe_unused]] Ptr b, + Ptr a [[maybe_unused]], + Ptr b [[maybe_unused]], ChannelCondition::LosConditionValue cond) const { NS_LOG_FUNCTION(this); @@ -1256,10 +1256,10 @@ ThreeGppIndoorOfficePropagationLossModel::GetO2iDistance2dIn() const } double -ThreeGppIndoorOfficePropagationLossModel::GetLossLos([[maybe_unused]] double distance2D, - [[maybe_unused]] double distance3D, - [[maybe_unused]] double hUt, - [[maybe_unused]] double hBs) const +ThreeGppIndoorOfficePropagationLossModel::GetLossLos(double distance2D [[maybe_unused]], + double distance3D [[maybe_unused]], + double hUt [[maybe_unused]], + double hBs [[maybe_unused]]) const { NS_LOG_FUNCTION(this); @@ -1306,8 +1306,8 @@ ThreeGppIndoorOfficePropagationLossModel::GetLossNlos(double distance2D, double ThreeGppIndoorOfficePropagationLossModel::GetShadowingStd( - [[maybe_unused]] Ptr a, - [[maybe_unused]] Ptr b, + Ptr a [[maybe_unused]], + Ptr b [[maybe_unused]], ChannelCondition::LosConditionValue cond) const { NS_LOG_FUNCTION(this); diff --git a/src/sixlowpan/model/sixlowpan-net-device.cc b/src/sixlowpan/model/sixlowpan-net-device.cc index 94feea2ad..709e4da52 100644 --- a/src/sixlowpan/model/sixlowpan-net-device.cc +++ b/src/sixlowpan/model/sixlowpan-net-device.cc @@ -876,7 +876,7 @@ SixLowPanNetDevice::DecompressLowPanHc1(Ptr packet, const Address& src, Ipv6Header ipHeader; SixLowPanHc1 encoding; - [[maybe_unused]] uint32_t ret = packet->RemoveHeader(encoding); + uint32_t ret [[maybe_unused]] = packet->RemoveHeader(encoding); NS_LOG_DEBUG("removed " << ret << " bytes - pkt is " << *packet); ipHeader.SetHopLimit(encoding.GetHopLimit()); @@ -1397,7 +1397,7 @@ SixLowPanNetDevice::DecompressLowPanIphc(Ptr packet, const Address& src, Ipv6Header ipHeader; SixLowPanIphc encoding; - [[maybe_unused]] uint32_t ret = packet->RemoveHeader(encoding); + uint32_t ret [[maybe_unused]] = packet->RemoveHeader(encoding); NS_LOG_DEBUG("removed " << ret << " bytes - pkt is " << *packet); // Hop Limit @@ -1998,7 +1998,7 @@ SixLowPanNetDevice::DecompressLowPanNhc(Ptr packet, SixLowPanNhcExtension encoding; - [[maybe_unused]] uint32_t ret = packet->RemoveHeader(encoding); + uint32_t ret [[maybe_unused]] = packet->RemoveHeader(encoding); NS_LOG_DEBUG("removed " << ret << " bytes - pkt is " << *packet); Ipv6ExtensionHopByHopHeader hopHeader; @@ -2273,7 +2273,7 @@ SixLowPanNetDevice::DecompressLowPanUdpNhc(Ptr packet, Ipv6Address saddr UdpHeader udpHeader; SixLowPanUdpNhcExtension encoding; - [[maybe_unused]] uint32_t ret = packet->RemoveHeader(encoding); + uint32_t ret [[maybe_unused]] = packet->RemoveHeader(encoding); NS_LOG_DEBUG("removed " << ret << " bytes - pkt is " << *packet); // Set the value of the ports diff --git a/src/stats/model/sqlite-output.cc b/src/stats/model/sqlite-output.cc index c2f2adc38..94123e3e4 100644 --- a/src/stats/model/sqlite-output.cc +++ b/src/stats/model/sqlite-output.cc @@ -90,7 +90,7 @@ SQLiteOutput::SpinPrepare(sqlite3_stmt** stmt, const std::string& cmd) const template T -SQLiteOutput::RetrieveColumn([[maybe_unused]] sqlite3_stmt* stmt, [[maybe_unused]] int pos) const +SQLiteOutput::RetrieveColumn(sqlite3_stmt* stmt [[maybe_unused]], int pos [[maybe_unused]]) const { NS_FATAL_ERROR("Can't call generic fn"); } @@ -121,9 +121,9 @@ SQLiteOutput::RetrieveColumn(sqlite3_stmt* stmt, int pos) const template bool -SQLiteOutput::Bind([[maybe_unused]] sqlite3_stmt* stmt, - [[maybe_unused]] int pos, - [[maybe_unused]] const T& value) const +SQLiteOutput::Bind(sqlite3_stmt* stmt [[maybe_unused]], + int pos [[maybe_unused]], + const T& value [[maybe_unused]]) const { NS_FATAL_ERROR("Can't call generic fn"); return false; diff --git a/src/test/ns3tc/fq-cobalt-queue-disc-test-suite.cc b/src/test/ns3tc/fq-cobalt-queue-disc-test-suite.cc index ed753f232..1aa2fff34 100644 --- a/src/test/ns3tc/fq-cobalt-queue-disc-test-suite.cc +++ b/src/test/ns3tc/fq-cobalt-queue-disc-test-suite.cc @@ -865,8 +865,8 @@ FqCobaltQueueDiscEcnMarking::DequeueWithDelay(Ptr queue, } void -FqCobaltQueueDiscEcnMarking::DropNextTracer([[maybe_unused]] int64_t oldVal, - [[maybe_unused]] int64_t newVal) +FqCobaltQueueDiscEcnMarking::DropNextTracer(int64_t oldVal [[maybe_unused]], + int64_t newVal [[maybe_unused]]) { m_dropNextCount++; } diff --git a/src/traffic-control/model/queue-disc.cc b/src/traffic-control/model/queue-disc.cc index 2f5f80e24..a84e11293 100644 --- a/src/traffic-control/model/queue-disc.cc +++ b/src/traffic-control/model/queue-disc.cc @@ -398,7 +398,7 @@ QueueDisc::DoInitialize() NS_LOG_FUNCTION(this); // Check the configuration and initialize the parameters of this queue disc - [[maybe_unused]] bool ok = CheckConfig(); + bool ok [[maybe_unused]] = CheckConfig(); NS_ASSERT_MSG(ok, "The queue disc configuration is not correct"); InitializeParams(); diff --git a/src/traffic-control/test/cobalt-queue-disc-test-suite.cc b/src/traffic-control/test/cobalt-queue-disc-test-suite.cc index 78f7d1a3f..d5be8f154 100644 --- a/src/traffic-control/test/cobalt-queue-disc-test-suite.cc +++ b/src/traffic-control/test/cobalt-queue-disc-test-suite.cc @@ -437,8 +437,8 @@ CobaltQueueDiscMarkTest::CobaltQueueDiscMarkTest(QueueSizeUnit mode) } void -CobaltQueueDiscMarkTest::DropNextTracer([[maybe_unused]] int64_t oldVal, - [[maybe_unused]] int64_t newVal) +CobaltQueueDiscMarkTest::DropNextTracer(int64_t oldVal [[maybe_unused]], + int64_t newVal [[maybe_unused]]) { m_dropNextCount++; } diff --git a/src/traffic-control/test/codel-queue-disc-test-suite.cc b/src/traffic-control/test/codel-queue-disc-test-suite.cc index 6c0ed4089..559085b18 100644 --- a/src/traffic-control/test/codel-queue-disc-test-suite.cc +++ b/src/traffic-control/test/codel-queue-disc-test-suite.cc @@ -513,8 +513,8 @@ CoDelQueueDiscBasicDrop::CoDelQueueDiscBasicDrop(QueueSizeUnit mode) } void -CoDelQueueDiscBasicDrop::DropNextTracer([[maybe_unused]] uint32_t oldVal, - [[maybe_unused]] uint32_t newVal) +CoDelQueueDiscBasicDrop::DropNextTracer(uint32_t oldVal [[maybe_unused]], + uint32_t newVal [[maybe_unused]]) { m_dropNextCount++; } @@ -731,8 +731,8 @@ CoDelQueueDiscBasicMark::CoDelQueueDiscBasicMark(QueueSizeUnit mode) } void -CoDelQueueDiscBasicMark::DropNextTracer([[maybe_unused]] uint32_t oldVal, - [[maybe_unused]] uint32_t newVal) +CoDelQueueDiscBasicMark::DropNextTracer(uint32_t oldVal [[maybe_unused]], + uint32_t newVal [[maybe_unused]]) { m_dropNextCount++; } diff --git a/src/uan/helper/uan-helper.cc b/src/uan/helper/uan-helper.cc index c4d00d6e2..1c6992a87 100644 --- a/src/uan/helper/uan-helper.cc +++ b/src/uan/helper/uan-helper.cc @@ -59,8 +59,8 @@ static void AsciiPhyTxEvent(std::ostream* os, std::string context, Ptr packet, - [[maybe_unused]] double txPowerDb, - UanTxMode mode) + double txPowerDb [[maybe_unused]], + UanTxMode mode [[maybe_unused]]) { *os << "+ " << Simulator::Now().GetSeconds() << " " << context << " " << *packet << std::endl; } @@ -78,8 +78,8 @@ static void AsciiPhyRxOkEvent(std::ostream* os, std::string context, Ptr packet, - [[maybe_unused]] double snr, - UanTxMode mode) + double snr [[maybe_unused]], + UanTxMode mode [[maybe_unused]]) { *os << "r " << Simulator::Now().GetSeconds() << " " << context << " " << *packet << std::endl; } diff --git a/src/uan/model/uan-mac-aloha.cc b/src/uan/model/uan-mac-aloha.cc index 89367a27f..d4c7ed1c7 100644 --- a/src/uan/model/uan-mac-aloha.cc +++ b/src/uan/model/uan-mac-aloha.cc @@ -118,7 +118,7 @@ UanMacAloha::AttachPhy(Ptr phy) } void -UanMacAloha::RxPacketGood(Ptr pkt, [[maybe_unused]] double sinr, UanTxMode txMode) +UanMacAloha::RxPacketGood(Ptr pkt, double sinr [[maybe_unused]], UanTxMode txMode) { UanHeaderCommon header; pkt->RemoveHeader(header); diff --git a/src/uan/model/uan-mac-cw.cc b/src/uan/model/uan-mac-cw.cc index 117b69ce3..ea5fd2dfb 100644 --- a/src/uan/model/uan-mac-cw.cc +++ b/src/uan/model/uan-mac-cw.cc @@ -333,7 +333,7 @@ UanMacCw::GetSlotTime() } void -UanMacCw::PhyRxPacketGood(Ptr packet, [[maybe_unused]] double sinr, UanTxMode mode) +UanMacCw::PhyRxPacketGood(Ptr packet, double sinr [[maybe_unused]], UanTxMode mode) { UanHeaderCommon header; packet->RemoveHeader(header); @@ -346,7 +346,7 @@ UanMacCw::PhyRxPacketGood(Ptr packet, [[maybe_unused]] double sinr, UanT } void -UanMacCw::PhyRxPacketError(Ptr packet, [[maybe_unused]] double sinr) +UanMacCw::PhyRxPacketError(Ptr packet, double sinr [[maybe_unused]]) { } diff --git a/src/uan/model/uan-mac-rc-gw.cc b/src/uan/model/uan-mac-rc-gw.cc index 2d9d68bd6..34976c37a 100644 --- a/src/uan/model/uan-mac-rc-gw.cc +++ b/src/uan/model/uan-mac-rc-gw.cc @@ -177,8 +177,8 @@ UanMacRcGw::GetTypeId() bool UanMacRcGw::Enqueue(Ptr packet, - [[maybe_unused]] uint16_t protocolNumber, - [[maybe_unused]] const Address& dest) + uint16_t protocolNumber [[maybe_unused]], + const Address& dest [[maybe_unused]]) { NS_LOG_WARN("RCMAC Gateway transmission to acoustic nodes is not yet implemented"); return false; @@ -199,12 +199,12 @@ UanMacRcGw::AttachPhy(Ptr phy) } void -UanMacRcGw::ReceiveError(Ptr pkt, [[maybe_unused]] double sinr) +UanMacRcGw::ReceiveError(Ptr pkt, double sinr [[maybe_unused]]) { } void -UanMacRcGw::ReceivePacket(Ptr pkt, [[maybe_unused]] double sinr, UanTxMode mode) +UanMacRcGw::ReceivePacket(Ptr pkt, double sinr [[maybe_unused]], UanTxMode mode) { UanHeaderCommon ch; pkt->PeekHeader(ch); @@ -559,7 +559,7 @@ UanMacRcGw::SendPacket(Ptr pkt, uint32_t rate) double UanMacRcGw::ComputeAlpha(uint32_t totalFrames, uint32_t totalBytes, - [[maybe_unused]] uint32_t n, + uint32_t n [[maybe_unused]], uint32_t a, double deltaK) { diff --git a/src/uan/model/uan-mac-rc.cc b/src/uan/model/uan-mac-rc.cc index 204da2f3c..3ef029ec5 100644 --- a/src/uan/model/uan-mac-rc.cc +++ b/src/uan/model/uan-mac-rc.cc @@ -143,7 +143,7 @@ Reservation::IncrementRetry() } void -Reservation::SetTransmitted([[maybe_unused]] bool t) +Reservation::SetTransmitted(bool t [[maybe_unused]]) { m_transmitted = true; } @@ -324,7 +324,7 @@ UanMacRc::AttachPhy(Ptr phy) } void -UanMacRc::ReceiveOkFromPhy(Ptr pkt, [[maybe_unused]] double sinr, UanTxMode mode) +UanMacRc::ReceiveOkFromPhy(Ptr pkt, double sinr [[maybe_unused]], UanTxMode mode) { UanHeaderCommon ch; pkt->RemoveHeader(ch); diff --git a/src/uan/model/uan-net-device.cc b/src/uan/model/uan-net-device.cc index d6d8605bc..d1b4fd891 100644 --- a/src/uan/model/uan-net-device.cc +++ b/src/uan/model/uan-net-device.cc @@ -281,7 +281,7 @@ UanNetDevice::IsMulticast() const } Address -UanNetDevice::GetMulticast([[maybe_unused]] Ipv4Address multicastGroup) const +UanNetDevice::GetMulticast(Ipv4Address multicastGroup [[maybe_unused]]) const { return m_mac->GetBroadcast(); } @@ -316,9 +316,9 @@ UanNetDevice::Send(Ptr packet, const Address& dest, uint16_t protocolNum bool UanNetDevice::SendFrom(Ptr packet, - [[maybe_unused]] const Address& source, - [[maybe_unused]] const Address& dest, - [[maybe_unused]] uint16_t protocolNumber) + const Address& source [[maybe_unused]], + const Address& dest [[maybe_unused]], + uint16_t protocolNumber [[maybe_unused]]) { // Not yet implemented NS_ASSERT_MSG(0, "Not yet implemented"); diff --git a/src/uan/model/uan-phy-dual.cc b/src/uan/model/uan-phy-dual.cc index a9e7c6b07..5dd4345f8 100644 --- a/src/uan/model/uan-phy-dual.cc +++ b/src/uan/model/uan-phy-dual.cc @@ -295,7 +295,7 @@ UanPhyDual::RegisterListener(UanPhyListener* listener) void UanPhyDual::StartRxPacket(Ptr pkt, - [[maybe_unused]] double rxPowerDb, + double rxPowerDb [[maybe_unused]], UanTxMode txMode, UanPdp pdp) { @@ -524,7 +524,7 @@ UanPhyDual::SetMac(Ptr mac) void UanPhyDual::NotifyTransStartTx(Ptr packet, - [[maybe_unused]] double txPowerDb, + double txPowerDb [[maybe_unused]], UanTxMode txMode) { } diff --git a/src/uan/model/uan-phy-dual.h b/src/uan/model/uan-phy-dual.h index de03138ea..4aa7dd68f 100644 --- a/src/uan/model/uan-phy-dual.h +++ b/src/uan/model/uan-phy-dual.h @@ -133,7 +133,7 @@ class UanPhyDual : public UanPhy UanTxMode GetMode(uint32_t n) override; void Clear() override; - void SetSleepMode([[maybe_unused]] bool sleep) override + void SetSleepMode(bool sleep [[maybe_unused]]) override { /// \todo This method has to be implemented } diff --git a/src/uan/model/uan-phy-gen.cc b/src/uan/model/uan-phy-gen.cc index 05d94dc04..81304927d 100644 --- a/src/uan/model/uan-phy-gen.cc +++ b/src/uan/model/uan-phy-gen.cc @@ -833,7 +833,7 @@ UanPhyGen::StartRxPacket(Ptr pkt, double rxPowerDb, UanTxMode txMode, Ua } void -UanPhyGen::RxEndEvent(Ptr pkt, [[maybe_unused]] double rxPowerDb, UanTxMode txMode) +UanPhyGen::RxEndEvent(Ptr pkt, double rxPowerDb [[maybe_unused]], UanTxMode txMode) { if (pkt != m_pktRx) { @@ -1049,7 +1049,7 @@ UanPhyGen::AssignStreams(int64_t stream) void UanPhyGen::NotifyTransStartTx(Ptr packet, - [[maybe_unused]] double txPowerDb, + double txPowerDb [[maybe_unused]], UanTxMode txMode) { if (m_pktRx) diff --git a/src/uan/test/uan-energy-model-test.cc b/src/uan/test/uan-energy-model-test.cc index 25b227d55..9199a8a3d 100644 --- a/src/uan/test/uan-energy-model-test.cc +++ b/src/uan/test/uan-energy-model-test.cc @@ -113,8 +113,8 @@ AcousticModemEnergyTestCase::SendOnePacket(Ptr node) bool AcousticModemEnergyTestCase::RxPacket(Ptr dev, Ptr pkt, - [[maybe_unused]] uint16_t mode, - [[maybe_unused]] const Address& sender) + uint16_t mode [[maybe_unused]], + const Address& sender [[maybe_unused]]) { // increase the total bytes received m_bytesRx += pkt->GetSize(); diff --git a/src/uan/test/uan-test.cc b/src/uan/test/uan-test.cc index 40f466aee..2b33d9bcb 100644 --- a/src/uan/test/uan-test.cc +++ b/src/uan/test/uan-test.cc @@ -104,8 +104,8 @@ UanTest::UanTest() bool UanTest::RxPacket(Ptr dev, Ptr pkt, - [[maybe_unused]] uint16_t mode, - [[maybe_unused]] const Address& sender) + uint16_t mode [[maybe_unused]], + const Address& sender [[maybe_unused]]) { m_bytesRx += pkt->GetSize(); return true; diff --git a/src/wave/helper/wave-helper.cc b/src/wave/helper/wave-helper.cc index f789ae3ce..a0b97c50c 100644 --- a/src/wave/helper/wave-helper.cc +++ b/src/wave/helper/wave-helper.cc @@ -339,7 +339,7 @@ WaveHelper::Install(const WifiPhyHelper& phyHelper, { try { - [[maybe_unused]] const QosWaveMacHelper& qosMac = + const QosWaveMacHelper& qosMac [[maybe_unused]] = dynamic_cast(macHelper); } catch (const std::bad_cast&) diff --git a/src/wave/helper/wifi-80211p-helper.cc b/src/wave/helper/wifi-80211p-helper.cc index e3e7b8908..d35740d8e 100644 --- a/src/wave/helper/wifi-80211p-helper.cc +++ b/src/wave/helper/wifi-80211p-helper.cc @@ -82,11 +82,11 @@ Wifi80211pHelper::Install(const WifiPhyHelper& phyHelper, const WifiMacHelper& macHelper, NodeContainer c) const { - [[maybe_unused]] const QosWaveMacHelper* qosMac = + const QosWaveMacHelper* qosMac [[maybe_unused]] = dynamic_cast(&macHelper); if (qosMac == nullptr) { - [[maybe_unused]] const NqosWaveMacHelper* nqosMac = + const NqosWaveMacHelper* nqosMac [[maybe_unused]] = dynamic_cast(&macHelper); if (nqosMac == nullptr) { diff --git a/src/wifi/model/he/rr-multi-user-scheduler.cc b/src/wifi/model/he/rr-multi-user-scheduler.cc index 30ab52920..6a09df89c 100644 --- a/src/wifi/model/he/rr-multi-user-scheduler.cc +++ b/src/wifi/model/he/rr-multi-user-scheduler.cc @@ -810,7 +810,7 @@ RrMultiUserScheduler::ComputeDlMuInfo() mpdu = candidate.second; NS_ASSERT(mpdu); - [[maybe_unused]] bool ret = + bool ret [[maybe_unused]] = m_heFem->TryAddMpdu(mpdu, dlMuInfo.txParams, actualAvailableTime); NS_ASSERT_MSG(ret, "Weird that an MPDU does not meet constraints when "