wave use to clarify PP usage

Does anyone have a tool that would clarify what's happening with some PP macros in, for example: boost/spirit/fusion/sequence/tuple.hpp For example, could wave be used to sort-of trace through the macro expansions to make the code easier to understand. For instance, I'm guessing that: BOOST_PP_REPEAT_FROM_TO( 2, FUSION_MAX_TUPLE_SIZE, FUSION_TUPLE_CONSTRUCTOR, _) does for 2 to FUSION_MAX_TUPLE_SIZE what: explicit tuple(typename detail::call_param<T0>::type _0) : base_type(_0) {} Does for a 1 argument CTOR. I could run it through cpp, but if there are several nested macro calls, it probably wouldn't help much in understand what's going on. TIA.

Larry Evans wrote:
Does anyone have a tool that would clarify what's happening with some PP macros in, for example:
boost/spirit/fusion/sequence/tuple.hpp
Wave? ;-)
For example, could wave be used to sort-of trace through the macro expansions to make the code easier to understand.
For instance, I'm guessing that:
BOOST_PP_REPEAT_FROM_TO( 2, FUSION_MAX_TUPLE_SIZE, FUSION_TUPLE_CONSTRUCTOR, _)
does for 2 to FUSION_MAX_TUPLE_SIZE what:
explicit tuple(typename detail::call_param<T0>::type _0) : base_type(_0) {}
Does for a 1 argument CTOR. I could run it through cpp, but if there are several nested macro calls, it probably wouldn't help much in understand what's going on.
Wave is able to trace the macro invocations. For this to happen you need to do the following: - place a pair of #pragma wave trace(on)/#pragma wave trace(off) around the macro(s) to expand (note, that in variadics mode, i.e. when specifying --variadics on the command line, you may want to use the operator _Pragma syntax: _Pragma("wave trace(on)")/_Pragma("wave trace(off)"), which is handy in some situations, because it can be placed nearly anywhere in the code) - specify the --traceto option on the command line ('--traceto file' for output to 'file' or '--traceto -' for output to stderr) You should try to narrow the macro expansion to trace to a minimum, because there will be generated quite a lot output. HTH Regards Hartmut

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Larry Evans
Does anyone have a tool that would clarify what's happening with some PP macros in, for example:
boost/spirit/fusion/sequence/tuple.hpp
For example, could wave be used to sort-of trace through the macro expansions to make the code easier to understand.
Wave does have a tracing facility.
Does for a 1 argument CTOR. I could run it through cpp, but if there are several nested macro calls, it probably wouldn't help much in understand what's going on.
It may or may not help that much--even with tracing--because of the workarounds in the pp-lib. Regards, Paul Mensonides
participants (3)
-
Hartmut Kaiser
-
Larry Evans
-
Paul Mensonides