On Mon, 29 Aug 2011 15:27:43 -0400, Edward Diener wrote:
I was trying to trace the output of a macro within a preprocessor directive in a file using the Wave trace facility. The directive is:
#elif BOOST_PP_ITERATION_FLAGS() == 1
so I specified:
#pragma wave trace(enable) #elif BOOST_PP_ITERATION_FLAGS() == 1 #pragma wave trace(disable)
But wave's trace showed me an empty file where the macro output ( -tsomefile ) should have been.
Is there a way to capture the output of the BOOST_PP_ITERATION_FLAGS() macro at the point where the #elif is occuring using Wave's trace facility ?
If this is from the curryable.hpp file, gcc does attempt to parse all of the #if/#elif directives for the level it is currently on. E.g. #if !BOOST_PP_IS_ITERATING // okay, will "decay" to 0 if not defined // ... #elif BOOST_PP_ITERATION_FLAGS() == 2 // will cause error // when not iterating, iteration flags is not defined // so this will result in 0() == 2 which is a syntax error // ... #endif The "problem" is that gcc requires a well-formed expression even if the first branch of #if is taken. The fix is to do this: #if !BOOST_PP_IS_ITERATING // ... #else #if BOOST_PP_ITERATION_FLAGS() == 2 // ... #endif #endif