Bug 1170: Formulate best practices for dealing with unused debug variables.

Fixed clang-3.4 unused function warnings in optimized builds like the following:
"""
../examples/energy/energy-model-example.cc:39:1: error: unused function
'PrintReceivedPacket' [-Werror,-Wunused-function]
PrintReceivedPacket (Address& from)
^
1 error generated.
"""

Implemented "if (false)" trick inside NS_LOG* macros for optimized builds.

"sizeof()" trick might be a little better but it produces the following
warning with clang-3.4:
"""
../examples/energy/energy-model-example.cc:39:1: error: function
'PrintReceivedPacket' is not needed and will not be emitted
[-Werror,-Wunneeded-internal-declaration]
PrintReceivedPacket (Address& from)
^
1 error generated.
"""


Macros from log.h, that depend on NS3_LOG_ENABLE, were moved to log-macros-enabled.h and log-macros-disabled.h to make log.h smaller.
This commit is contained in:
Andrey Mazo
2014-03-23 19:08:54 +04:00
parent de004b4c7d
commit 210aefc777
6 changed files with 280 additions and 214 deletions

View File

@@ -248,6 +248,8 @@ def build(bld):
'model/ptr.h',
'model/object.h',
'model/log.h',
'model/log-macros-enabled.h',
'model/log-macros-disabled.h',
'model/assert.h',
'model/breakpoint.h',
'model/fatal-error.h',