Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65966 - trunk/boost/wave/util
From: hartmut.kaiser_at_[hidden]
Date: 2010-10-14 18:12:47


Author: hkaiser
Date: 2010-10-14 18:12:45 EDT (Thu, 14 Oct 2010)
New Revision: 65966
URL: http://svn.boost.org/trac/boost/changeset/65966

Log:
Wave: fixing pp hook problems
Text files modified:
   trunk/boost/wave/util/cpp_iterator.hpp | 28 ++++++++++------------------
   trunk/boost/wave/util/cpp_macromap.hpp | 7 ++++---
   trunk/boost/wave/util/cpp_macromap_utils.hpp | 13 +++++++++++++
   3 files changed, 27 insertions(+), 21 deletions(-)

Modified: trunk/boost/wave/util/cpp_iterator.hpp
==============================================================================
--- trunk/boost/wave/util/cpp_iterator.hpp (original)
+++ trunk/boost/wave/util/cpp_iterator.hpp 2010-10-14 18:12:45 EDT (Thu, 14 Oct 2010)
@@ -662,11 +662,7 @@
                 if (!ctx.get_if_block_status()) {
                 // skip this token because of the disabled #if block
                     whitespace.shift_tokens(id); // whitespace controller
-#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
- ctx.get_hooks().skipped_token(act_token);
-#else
- ctx.get_hooks().skipped_token(ctx.derived(), act_token);
-#endif
+ util::call_skipped_token_hook(ctx, act_token);
                     continue;
                 }
                 return act_token;
@@ -698,11 +694,7 @@
                 }
 
             // next token
-#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
- ctx.get_hooks().skipped_token(act_token);
-#else
- ctx.get_hooks().skipped_token(ctx.derived(), act_token);
-#endif
+ util::call_skipped_token_hook(ctx, act_token);
                 ++iter_ctx->first;
             }
 
@@ -913,7 +905,7 @@
             }
 
             // this token gets skipped
- call_skipped_token_hook(ctx, *it);
+ util::call_skipped_token_hook(ctx, *it);
         }
         BOOST_ASSERT(it == end || id != T_UNKNOWN);
         return it != end && IS_CATEGORY(id, PPTokenType);
@@ -928,7 +920,7 @@
 
         // this token gets skipped
         if (call_hook)
- call_skipped_token_hook(ctx, *it);
+ util::call_skipped_token_hook(ctx, *it);
 
         for (++it; it != end; ++it) {
         token_id id = token_id(*it);
@@ -937,7 +929,7 @@
                 context_policies::util::ccomment_has_newline(*it))
             {
                 if (call_hook)
- call_skipped_token_hook(ctx, *it);
+ util::call_skipped_token_hook(ctx, *it);
                 ++it; // skip eol/C/C++ comment
                 return true; // no more significant tokens on this line
             }
@@ -947,7 +939,7 @@
 
             // this token gets skipped
             if (call_hook)
- call_skipped_token_hook(ctx, *it);
+ util::call_skipped_token_hook(ctx, *it);
         }
         return false;
     }
@@ -966,13 +958,13 @@
                 context_policies::util::ccomment_has_newline(*it))
             {
                 // always call hook for eol
- call_skipped_token_hook(ctx, *it);
+ util::call_skipped_token_hook(ctx, *it);
                 ++it; // skip eol/C/C++ comment
                 return true; // found eol
             }
 
             if (call_hook)
- call_skipped_token_hook(ctx, *it);
+ util::call_skipped_token_hook(ctx, *it);
         }
         return false;
     }
@@ -986,7 +978,7 @@
         while (IS_CATEGORY(*it, WhiteSpaceTokenType)) {
             typename ContainerT::iterator save = it++;
             if (call_hook)
- call_skipped_token_hook(ctx, *save);
+ util::call_skipped_token_hook(ctx, *save);
             c.erase(save);
         }
     }
@@ -1142,7 +1134,7 @@
             }
         }
         else {
- impl::call_skipped_token_hook(ctx, *it);
+ util::call_skipped_token_hook(ctx, *it);
         }
     }
     else {

Modified: trunk/boost/wave/util/cpp_macromap.hpp
==============================================================================
--- trunk/boost/wave/util/cpp_macromap.hpp (original)
+++ trunk/boost/wave/util/cpp_macromap.hpp 2010-10-14 18:12:45 EDT (Thu, 14 Oct 2010)
@@ -1276,8 +1276,9 @@
                     seqstart, seqend))
             {
                 // do not expand this macro, just copy the whole sequence
+ expanded.push_back(curr_token);
                 std::copy(seqstart, first,
- std::inserter(replacement_list, replacement_list.end()));
+ std::inserter(expanded, expanded.end()));
                 return false; // no further preprocessing required
             }
 #endif
@@ -1296,7 +1297,7 @@
                   macro_def.macroname, macro_def.macrodefinition, curr_token))
             {
                 // do not expand this macro, just copy the whole sequence
- replacement_list.push_back(curr_token);
+ expanded.push_back(curr_token);
                 ++first; // skip macro name
                 return false; // no further preprocessing required
             }
@@ -1339,7 +1340,7 @@
                   macro_def.macroname, macro_def.macrodefinition, curr_token))
             {
                 // do not expand this macro, just copy the whole sequence
- replacement_list.push_back(curr_token);
+ expanded.push_back(curr_token);
                 ++first; // skip macro name
                 return false; // no further preprocessing required
             }

Modified: trunk/boost/wave/util/cpp_macromap_utils.hpp
==============================================================================
--- trunk/boost/wave/util/cpp_macromap_utils.hpp (original)
+++ trunk/boost/wave/util/cpp_macromap_utils.hpp 2010-10-14 18:12:45 EDT (Thu, 14 Oct 2010)
@@ -542,6 +542,19 @@
 }
 
 ///////////////////////////////////////////////////////////////////////////////
+// call 'skipped_token' preprocessing hook
+template <typename ContextT>
+void call_skipped_token_hook(ContextT& ctx,
+ typename ContextT::token_type const& skipped)
+{
+#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
+ ctx.get_hooks().skipped_token(skipped);
+#else
+ ctx.get_hooks().skipped_token(ctx.derived(), skipped);
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
 } // namespace util
 } // namespace wave
 } // namespace boost


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk