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:
Andrey Mazo
2013-01-21 17:19:00 +04:00
parent 343c15bfd3
commit ec4007ca27
6 changed files with 8 additions and 8 deletions

View File

@@ -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);

View File

@@ -119,7 +119,7 @@ RoutingExperiment::RoutingExperiment ()
{
}
std::string
static inline std::string
PrintReceivedPacket (Ptr<Socket> socket, Ptr<Packet> packet)
{
SocketAddressTag tag;

View File

@@ -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);

View File

@@ -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));
}

View File

@@ -77,7 +77,7 @@ WifiInterferenceTestCase::~WifiInterferenceTestCase ()
{
}
std::string
static inline std::string
PrintReceivedPacket (Ptr<Socket> socket)
{
Address addr;

View File

@@ -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)