make non-static global debugging-only functions static inline (bug 1170).
Compilers shouldn't warn on unused static inline function and just don't emit code for them in optimized builds. Also debugging-only functions don't pollute symbol tables.
This commit is contained in:
@@ -35,7 +35,7 @@ NS_LOG_COMPONENT_DEFINE ("EnergyExample");
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
std::string
|
||||
static inline std::string
|
||||
PrintReceivedPacket (Address& from)
|
||||
{
|
||||
InetSocketAddress iaddr = InetSocketAddress::ConvertFrom (from);
|
||||
|
||||
@@ -119,7 +119,7 @@ RoutingExperiment::RoutingExperiment ()
|
||||
{
|
||||
}
|
||||
|
||||
std::string
|
||||
static inline std::string
|
||||
PrintReceivedPacket (Ptr<Socket> socket, Ptr<Packet> packet)
|
||||
{
|
||||
SocketAddressTag tag;
|
||||
|
||||
@@ -309,14 +309,14 @@ Experiment::SendMultiDestinations (Ptr<Node> sender, NodeContainer c)
|
||||
}
|
||||
}
|
||||
|
||||
Vector
|
||||
static inline Vector
|
||||
GetPosition (Ptr<Node> node)
|
||||
{
|
||||
Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
|
||||
return mobility->GetPosition ();
|
||||
}
|
||||
|
||||
std::string
|
||||
static inline std::string
|
||||
PrintPosition (Ptr<Node> client, Ptr<Node> server)
|
||||
{
|
||||
Vector serverPos = GetPosition (server);
|
||||
|
||||
@@ -96,7 +96,7 @@ NS_LOG_COMPONENT_DEFINE ("WifiSimpleInterference");
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
std::string PrintReceivedPacket (Ptr<Socket> socket)
|
||||
static inline std::string PrintReceivedPacket (Ptr<Socket> socket)
|
||||
{
|
||||
Address addr;
|
||||
socket->GetSockName (addr);
|
||||
@@ -108,7 +108,7 @@ std::string PrintReceivedPacket (Ptr<Socket> socket)
|
||||
return oss.str ();
|
||||
}
|
||||
|
||||
void ReceivePacket (Ptr<Socket> socket)
|
||||
static void ReceivePacket (Ptr<Socket> socket)
|
||||
{
|
||||
NS_LOG_UNCOND (PrintReceivedPacket (socket));
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ WifiInterferenceTestCase::~WifiInterferenceTestCase ()
|
||||
{
|
||||
}
|
||||
|
||||
std::string
|
||||
static inline std::string
|
||||
PrintReceivedPacket (Ptr<Socket> socket)
|
||||
{
|
||||
Address addr;
|
||||
|
||||
@@ -77,7 +77,7 @@ int linksNumber = 0;
|
||||
int nodesNumber = 0;
|
||||
std::map<std::string, Ptr<Node> > nodeMap;
|
||||
|
||||
void
|
||||
static inline void
|
||||
PrintNodeInfo (std::string & uid, std::string & loc, bool dns, bool bb,
|
||||
std::vector <std::string>::size_type neighListSize,
|
||||
std::string & name, int radius)
|
||||
|
||||
Reference in New Issue
Block a user