core: (re)fix log-macros-disabled.h compilation broken by r13461 (eb9262b0)
This alters r13474 (d623d9) and reverts r13482 (4d42c9) Now includes explanation of why two versions are necessary.
This commit is contained in:
@@ -29,16 +29,47 @@
|
||||
#define NS3_LOG_MACROS_DISABLED_H
|
||||
|
||||
#ifndef NS3_LOG_ENABLE
|
||||
/*
|
||||
Implementation Note:
|
||||
|
||||
std::clog << msg
|
||||
This expression is required for forms like NS_LOG_LOGIC (... << std::endl ...)
|
||||
|
||||
|
||||
ns3::ParameterLogger (std::clog) << msg
|
||||
This expression is required for NS_LOG_FUNCTION (... << vector ...)
|
||||
|
||||
IMO ParameterLogger should work for both cases, but it fails
|
||||
with the error:
|
||||
|
||||
note: in expansion of macro NS_LOG_LOGIC (std::endl...
|
||||
error: no match for operator<< (operand types are ns3::ParameterLogger
|
||||
and <unresolved overloaded function type>)
|
||||
|
||||
note: candidate: template<class T> ns3::ParameterLogger&
|
||||
ns3::ParameterLogger::operator<<(T)
|
||||
note: template argument deduction/substitution failed
|
||||
note: couldn't deduce template parameter T
|
||||
|
||||
Note that std::endl is templated manipulator function, which needs the
|
||||
target stream to resolve it's own template parameters. The compiler
|
||||
should deduce this from the ParameterLogger::operator<< <T> ()
|
||||
implementation, but evidently fails to do so.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup logging
|
||||
* Empty logging macro implementation, used when logging is disabled.
|
||||
*/
|
||||
#define NS_LOG_NOOP_INTERNAL(msg) \
|
||||
while (false) \
|
||||
do \
|
||||
if (false) \
|
||||
{ \
|
||||
std::clog << msg; \
|
||||
}
|
||||
} \
|
||||
while (false)
|
||||
|
||||
#define NS_LOG(level, msg) \
|
||||
NS_LOG_NOOP_INTERNAL (msg)
|
||||
@@ -50,10 +81,12 @@
|
||||
* Empty logging macro implementation, used when logging is disabled.
|
||||
*/
|
||||
#define NS_LOG_NOOP_FUNC_INTERNAL(msg) \
|
||||
while (false) \
|
||||
do \
|
||||
if (false) \
|
||||
{ \
|
||||
ns3::ParameterLogger (std::clog) << msg; \
|
||||
}
|
||||
} \
|
||||
while (false)
|
||||
|
||||
#define NS_LOG_FUNCTION(parameters) \
|
||||
NS_LOG_NOOP_FUNC_INTERNAL (parameters)
|
||||
|
||||
@@ -1194,18 +1194,10 @@ LteRlcAm::ReassembleAndDeliver (Ptr<Packet> packet)
|
||||
std::list < Ptr<Packet> >::iterator it;
|
||||
|
||||
// Current reassembling state
|
||||
if (m_reassemblingState == WAITING_S0_FULL)
|
||||
{
|
||||
NS_LOG_LOGIC ("Reassembling State = 'WAITING_S0_FULL'");
|
||||
}
|
||||
else if (m_reassemblingState == WAITING_SI_SF)
|
||||
{
|
||||
NS_LOG_LOGIC ("Reassembling State = 'WAITING_SI_SF'");
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("Reassembling State = Unknown state");
|
||||
}
|
||||
if (m_reassemblingState == WAITING_S0_FULL) NS_LOG_LOGIC ("Reassembling State = 'WAITING_S0_FULL'");
|
||||
else if (m_reassemblingState == WAITING_SI_SF) NS_LOG_LOGIC ("Reassembling State = 'WAITING_SI_SF'");
|
||||
else NS_LOG_LOGIC ("Reassembling State = Unknown state");
|
||||
|
||||
|
||||
// Received framing Info
|
||||
NS_LOG_LOGIC ("Framing Info = " << (uint16_t)framingInfo);
|
||||
|
||||
@@ -648,18 +648,9 @@ LteRlcUm::ReassembleAndDeliver (Ptr<Packet> packet)
|
||||
std::list < Ptr<Packet> >::iterator it;
|
||||
|
||||
// Current reassembling state
|
||||
if (m_reassemblingState == WAITING_S0_FULL)
|
||||
{
|
||||
NS_LOG_LOGIC ("Reassembling State = 'WAITING_S0_FULL'");
|
||||
}
|
||||
else if (m_reassemblingState == WAITING_SI_SF)
|
||||
{
|
||||
NS_LOG_LOGIC ("Reassembling State = 'WAITING_SI_SF'");
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("Reassembling State = Unknown state");
|
||||
}
|
||||
if (m_reassemblingState == WAITING_S0_FULL) NS_LOG_LOGIC ("Reassembling State = 'WAITING_S0_FULL'");
|
||||
else if (m_reassemblingState == WAITING_SI_SF) NS_LOG_LOGIC ("Reassembling State = 'WAITING_SI_SF'");
|
||||
else NS_LOG_LOGIC ("Reassembling State = Unknown state");
|
||||
|
||||
// Received framing Info
|
||||
NS_LOG_LOGIC ("Framing Info = " << (uint16_t)framingInfo);
|
||||
|
||||
Reference in New Issue
Block a user