|
Boost-Commit : |
From: hartmut.kaiser_at_[hidden]
Date: 2008-01-31 16:04:05
Author: hkaiser
Date: 2008-01-31 16:04:04 EST (Thu, 31 Jan 2008)
New Revision: 43039
URL: http://svn.boost.org/trac/boost/changeset/43039
Log:
Wave: fixed expanding_function_like_macro()
Text files modified:
branches/release/boost/wave/util/cpp_macromap.hpp | 39 ++++++++++++++++++++++++++++++++++++---
branches/release/libs/wave/ChangeLog | 5 ++++-
2 files changed, 40 insertions(+), 4 deletions(-)
Modified: branches/release/boost/wave/util/cpp_macromap.hpp
==============================================================================
--- branches/release/boost/wave/util/cpp_macromap.hpp (original)
+++ branches/release/boost/wave/util/cpp_macromap.hpp 2008-01-31 16:04:04 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 ¶meter_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 ¶meter_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 ¶meter_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 ¶meter_count)
+ std::vector<ContainerT> &arguments, IteratorT &next, IteratorT &endparen,
+ IteratorT const &end, SizeT const ¶meter_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: branches/release/libs/wave/ChangeLog
==============================================================================
--- branches/release/libs/wave/ChangeLog (original)
+++ branches/release/libs/wave/ChangeLog 2008-01-31 16:04:04 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
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