Boost logo

Boost-Commit :

From: hartmut.kaiser_at_[hidden]
Date: 2008-01-31 15:57:48


Author: hkaiser
Date: 2008-01-31 15:57:47 EST (Thu, 31 Jan 2008)
New Revision: 43038
URL: http://svn.boost.org/trac/boost/changeset/43038

Log:
Wave: fixed expanding_function_like_macro()
Text files modified:
   trunk/boost/spirit/tree/impl/tree_to_xml.ipp | 2 +-
   trunk/boost/wave/util/cpp_macromap.hpp | 39 ++++++++++++++++++++++++++++++++++++---
   trunk/libs/wave/ChangeLog | 5 ++++-
   trunk/tools/build/v2/user-config.jam | 6 +++++-
   4 files changed, 46 insertions(+), 6 deletions(-)

Modified: trunk/boost/spirit/tree/impl/tree_to_xml.ipp
==============================================================================
--- trunk/boost/spirit/tree/impl/tree_to_xml.ipp (original)
+++ trunk/boost/spirit/tree/impl/tree_to_xml.ipp 2008-01-31 15:57:47 EST (Thu, 31 Jan 2008)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2001-2007 Hartmut Kaiser
+ Copyright (c) 2001-2008 Hartmut Kaiser
     Copyright (c) 2001-2003 Daniel Nuffer
     http://spirit.sourceforge.net/
 

Modified: trunk/boost/wave/util/cpp_macromap.hpp
==============================================================================
--- trunk/boost/wave/util/cpp_macromap.hpp (original)
+++ trunk/boost/wave/util/cpp_macromap.hpp 2008-01-31 15:57:47 EST (Thu, 31 Jan 2008)
@@ -162,10 +162,18 @@
         bool expand_operator_defined);
 
 // Collect all arguments supplied to a macro invocation
+#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
     template <typename IteratorT, typename ContainerT, typename SizeT>
     typename std::vector<ContainerT>::size_type collect_arguments (
         token_type const curr_token, std::vector<ContainerT> &arguments,
         IteratorT &next, IteratorT const &end, SizeT const &parameter_count);
+#else
+ template <typename IteratorT, typename ContainerT, typename SizeT>
+ typename std::vector<ContainerT>::size_type collect_arguments (
+ token_type const curr_token, std::vector<ContainerT> &arguments,
+ IteratorT &next, IteratorT &endparen, IteratorT const &end,
+ SizeT const &parameter_count);
+#endif
 
 // Expand a single macro name
     template <typename IteratorT, typename ContainerT>
@@ -688,12 +696,21 @@
 // return the number of successfully detected non-empty arguments
 //
 ///////////////////////////////////////////////////////////////////////////////
+#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
+template <typename ContextT>
+template <typename IteratorT, typename ContainerT, typename SizeT>
+inline typename std::vector<ContainerT>::size_type
+macromap<ContextT>::collect_arguments (token_type const curr_token,
+ std::vector<ContainerT> &arguments, IteratorT &next,
+ IteratorT const &end, SizeT const &parameter_count)
+#else
 template <typename ContextT>
 template <typename IteratorT, typename ContainerT, typename SizeT>
 inline typename std::vector<ContainerT>::size_type
 macromap<ContextT>::collect_arguments (token_type const curr_token,
- std::vector<ContainerT> &arguments, IteratorT &next, IteratorT const &end,
- SizeT const &parameter_count)
+ std::vector<ContainerT> &arguments, IteratorT &next, IteratorT &endparen,
+ IteratorT const &end, SizeT const &parameter_count)
+#endif
 {
     using namespace boost::wave;
 
@@ -734,6 +751,9 @@
                 else {
                 // found closing parenthesis
 // trim_sequence(argument);
+#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS == 0
+ endparen = next;
+#endif
                     if (parameter_count > 0) {
                         if (argument->empty() ||
                             impl::is_whitespace_only(*argument))
@@ -1186,6 +1206,7 @@
         
 #if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS == 0
         IteratorT seqstart = first;
+ IteratorT seqend = first;
 #endif
 
         if (macro_def.is_functionlike) {
@@ -1193,9 +1214,15 @@
         
         // collect the arguments
         std::vector<ContainerT> arguments;
+#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
         typename std::vector<ContainerT>::size_type count_args =
             collect_arguments (curr_token, arguments, first, last,
                 macro_def.macroparameters.size());
+#else
+ typename std::vector<ContainerT>::size_type count_args =
+ collect_arguments (curr_token, arguments, first, seqend, last,
+ macro_def.macroparameters.size());
+#endif
 
         // verify the parameter count
             if (count_args < macro_def.macroparameters.size() ||
@@ -1240,7 +1267,7 @@
             if (ctx.get_hooks().expanding_function_like_macro(
                     ctx, macro_def.macroname, macro_def.macroparameters,
                     macro_def.macrodefinition, curr_token, arguments,
- seqstart, first))
+ seqend, first))
             {
                 // do not expand this macro, just copy the whole sequence
                 std::copy(seqstart, first,
@@ -1477,8 +1504,14 @@
     }
     
     std::vector<ContainerT> arguments;
+#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
     typename std::vector<ContainerT>::size_type count_args =
         collect_arguments (pragma_token, arguments, first, last, 1);
+#else
+ IteratorT endparen = first;
+ typename std::vector<ContainerT>::size_type count_args =
+ collect_arguments (pragma_token, arguments, first, endparen, last, 1);
+#endif
 
 // verify the parameter count
     if (pragma_token.get_position().get_file().empty())

Modified: trunk/libs/wave/ChangeLog
==============================================================================
--- trunk/libs/wave/ChangeLog (original)
+++ trunk/libs/wave/ChangeLog 2008-01-31 15:57:47 EST (Thu, 31 Jan 2008)
@@ -158,7 +158,10 @@
   its own.
 - Updates to the documentation.
 - Fixed a problem in flex_string::compare() (#include_next was non-functional).
-
+- Fixed a bug in the pp hook expanding_function_like_macro(), where the seqend
+ parameter was set to the first token after the closing parenthesis instead of
+ pointing at it.
+
 Boost V1.34.0
 - Wave Version 1.2.4
 - Added the possibility to explicitly enable/disable the generation of #line

Modified: trunk/tools/build/v2/user-config.jam
==============================================================================
--- trunk/tools/build/v2/user-config.jam (original)
+++ trunk/tools/build/v2/user-config.jam 2008-01-31 15:57:47 EST (Thu, 31 Jan 2008)
@@ -51,7 +51,11 @@
 
 # Configure msvc (default version, searched in standard location
 # and PATH).
-# using msvc ;
+using msvc : 8.0 : ;
+
+# using python : 2.4 : "C:/Program Files/Python24/python.exe" : "C:/Program Files/Python24/include/" ;
+
+using python ;
 
 # Borland configuration
 # using borland ;


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