Bug 1162 - opt build examples module unused variables

This commit is contained in:
John Abraham
2011-05-18 12:59:20 -04:00
parent f9017d9423
commit 0379ad69c1
8 changed files with 33 additions and 5 deletions

View File

@@ -53,6 +53,9 @@ ReceivePacket (Ptr<Socket> socket)
NS_LOG_UNCOND ("--\nReceived one packet! Socket: "<< iaddr.GetIpv4 ()
<< " port: " << iaddr.GetPort () << " at time = " <<
Simulator::Now ().GetSeconds () << "\n--");
//cast iaddr to void, to suppress 'iaddr' set but not used compiler warning
//in optimized builds
(void) iaddr;
}
}
}

View File

@@ -242,9 +242,8 @@ Receiver::Receive(Ptr<Socket> socket)
Address from;
while (packet = socket->RecvFrom(from)) {
if (InetSocketAddress::IsMatchingType (from)) {
InetSocketAddress address = InetSocketAddress::ConvertFrom (from);
NS_LOG_INFO ("Received " << packet->GetSize() << " bytes from " <<
address.GetIpv4());
InetSocketAddress::ConvertFrom (from).GetIpv4());
}
TimestampTag timestamp;

View File

@@ -334,6 +334,11 @@ Experiment::ApplicationSetup (Ptr<Node> client, Ptr<Node> server, double start,
<< " position (" << clientPos.x << "," << clientPos.y << "," << clientPos.z << ")"
<< "\n");
//cast serverPos,clientPos,iaddrClient to void, to suppress variable set but not
//used compiler warning in optimized builds
(void) serverPos;
(void) clientPos;
(void) ipv4AddrClient;
// Equipping the source node with OnOff Application used for sending
OnOffHelper onoff ("ns3::UdpSocketFactory", Address(InetSocketAddress(Ipv4Address("10.0.0.1"), port)));

View File

@@ -102,6 +102,9 @@ void ReceivePacket (Ptr<Socket> socket)
socket->GetSockName (addr);
InetSocketAddress iaddr = InetSocketAddress::ConvertFrom (addr);
NS_LOG_UNCOND ("Received one packet! Socket: " << iaddr.GetIpv4 () << " port: " << iaddr.GetPort ());
//cast iaddr to void, to suppress iaddr set but not used compiler warning
//in optimized builds
(void) iaddr;
}
static void GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize,

View File

@@ -165,9 +165,13 @@ void PacketSink::HandleRead (Ptr<Socket> socket)
if (InetSocketAddress::IsMatchingType (from))
{
m_totalRx += packet->GetSize();
InetSocketAddress address = InetSocketAddress::ConvertFrom (from);
NS_LOG_INFO ("Received " << packet->GetSize() << " bytes from " <<
address.GetIpv4() << " [" << InetSocketAddress::ConvertFrom (from) << "]"
address.GetIpv4() << " [" << address << "]"
<< " total Rx " << m_totalRx);
//cast address to void , to suppress 'address' set but not used
//compiler warning in optimized builds
(void) address;
}
m_rxTrace (packet, from);
}

View File

@@ -112,6 +112,9 @@ void Ipv4RawSocketImplTest::ReceivePkt (Ptr<Socket> socket)
NS_ASSERT (m_receivedPacket->GetSize () == 2);
m_receivedPacket = socket->Recv (std::numeric_limits<uint32_t>::max(), 0);
NS_ASSERT (availableData == m_receivedPacket->GetSize ());
//cast availableData to void, to suppress 'availableData' set but not used
//compiler warning
(void) availableData;
}
void Ipv4RawSocketImplTest::ReceivePkt2 (Ptr<Socket> socket)
@@ -122,6 +125,9 @@ void Ipv4RawSocketImplTest::ReceivePkt2 (Ptr<Socket> socket)
NS_ASSERT (m_receivedPacket2->GetSize () == 2);
m_receivedPacket2 = socket->Recv (std::numeric_limits<uint32_t>::max(), 0);
NS_ASSERT (availableData == m_receivedPacket2->GetSize ());
//cast availableData to void, to suppress 'availableData' set but not used
//compiler warning
(void) availableData;
}
void

View File

@@ -94,6 +94,9 @@ void UdpSocketLoopbackTest::ReceivePkt (Ptr<Socket> socket)
availableData = socket->GetRxAvailable ();
m_receivedPacket = socket->Recv (std::numeric_limits<uint32_t>::max(), 0);
NS_ASSERT (availableData == m_receivedPacket->GetSize ());
//cast availableData to void, to suppress 'availableData' set but not used
//compiler warning
(void) availableData;
}
void
@@ -152,6 +155,9 @@ void UdpSocketImplTest::ReceivePkt (Ptr<Socket> socket)
availableData = socket->GetRxAvailable ();
m_receivedPacket = socket->Recv (std::numeric_limits<uint32_t>::max(), 0);
NS_ASSERT (availableData == m_receivedPacket->GetSize ());
//cast availableData to void, to suppress 'availableData' set but not used
//compiler warning
(void) availableData;
}
void UdpSocketImplTest::ReceivePkt2 (Ptr<Socket> socket)
@@ -160,6 +166,9 @@ void UdpSocketImplTest::ReceivePkt2 (Ptr<Socket> socket)
availableData = socket->GetRxAvailable ();
m_receivedPacket2 = socket->Recv (std::numeric_limits<uint32_t>::max(), 0);
NS_ASSERT (availableData == m_receivedPacket2->GetSize ());
//cast availableData to void, to suppress 'availableData' set but not used
//compiler warning
(void) availableData;
}
void

View File

@@ -82,8 +82,7 @@ WifiInterferenceTestCase::ReceivePacket (Ptr<Socket> socket)
{
Address addr;
socket->GetSockName (addr);
InetSocketAddress iaddr = InetSocketAddress::ConvertFrom (addr);
NS_LOG_UNCOND ("Received one packet! Socket: " << iaddr.GetIpv4 () << " port: " << iaddr.GetPort ());
NS_LOG_UNCOND ("Received one packet! Socket: " << InetSocketAddress::ConvertFrom (addr).GetIpv4 () << " port: " << iaddr.GetPort ());
}
void