|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r85427 - in branches/release: . boost boost/xpressive boost/xpressive/detail/dynamic boost/xpressive/detail/utility
From: eric_at_[hidden]
Date: 2013-08-22 15:50:55
Author: eric_niebler
Date: 2013-08-22 15:50:55 EDT (Thu, 22 Aug 2013)
New Revision: 85427
URL: http://svn.boost.org/trac/boost/changeset/85427
Log:
merge [85118],[85119],[85120],[85121] from trunk; fixes #8843, fixes #8880, fixes #8882, fixes #8474
Properties modified:
branches/release/ (props changed)
branches/release/boost/ (props changed)
branches/release/boost/xpressive/ (props changed)
Text files modified:
branches/release/boost/xpressive/detail/dynamic/parse_charset.hpp | 7 +++++--
branches/release/boost/xpressive/detail/dynamic/parser_traits.hpp | 5 +++--
branches/release/boost/xpressive/detail/utility/sequence_stack.hpp | 33 ++++++++++++++++++++-------------
branches/release/boost/xpressive/match_results.hpp | 3 ++-
branches/release/boost/xpressive/regex_algorithms.hpp | 1 -
branches/release/boost/xpressive/regex_compiler.hpp | 37 ++++++++++++++++++++++++++-----------
6 files changed, 56 insertions(+), 30 deletions(-)
Modified: branches/release/boost/xpressive/detail/dynamic/parse_charset.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/dynamic/parse_charset.hpp Thu Aug 22 15:45:30 2013 (r85426)
+++ branches/release/boost/xpressive/detail/dynamic/parse_charset.hpp 2013-08-22 15:50:55 EDT (Thu, 22 Aug 2013) (r85427)
@@ -13,6 +13,7 @@
# pragma once
#endif
+#include <boost/config.hpp>
#include <boost/integer.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/throw_exception.hpp>
@@ -198,7 +199,7 @@
using namespace regex_constants;
typedef typename RegexTraits::char_type char_type;
typedef typename RegexTraits::char_class_type char_class_type;
- BOOST_ASSERT(begin != end);
+ BOOST_XPR_ENSURE_(begin != end, error_brack, "unexpected end of pattern found");
RegexTraits const &rxtraits = tr.traits();
bool const icase = (0 != (regex_constants::icase_ & tr.flags()));
FwdIter iprev = FwdIter();
@@ -246,6 +247,7 @@
case token_charset_hyphen:
case token_charset_invert:
begin = iprev2; // un-get these tokens and fall through
+ BOOST_FALLTHROUGH;
case token_literal:
ch_next = *begin++;
BOOST_XPR_ENSURE_(ch_prev <= ch_next, error_range, "invalid charset range");
@@ -264,7 +266,8 @@
chset.set_range(ch_prev, esc.ch_, rxtraits, icase);
continue;
}
- case token_charset_end: // fall through
+ BOOST_FALLTHROUGH;
+ case token_charset_end:
default: // not a range.
begin = iprev; // backup to hyphen token
chset.set_char(ch_prev, rxtraits, icase);
Modified: branches/release/boost/xpressive/detail/dynamic/parser_traits.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/dynamic/parser_traits.hpp Thu Aug 22 15:45:30 2013 (r85426)
+++ branches/release/boost/xpressive/detail/dynamic/parser_traits.hpp 2013-08-22 15:50:55 EDT (Thu, 22 Aug 2013) (r85427)
@@ -15,6 +15,7 @@
#include <string>
#include <climits>
+#include <boost/config.hpp>
#include <boost/assert.hpp>
#include <boost/throw_exception.hpp>
#include <boost/xpressive/regex_error.hpp>
@@ -394,9 +395,9 @@
case BOOST_XPR_CHAR_(char_type, 'm'): this->flag_(!set, single_line); break;
case BOOST_XPR_CHAR_(char_type, 's'): this->flag_(!set, not_dot_newline); break;
case BOOST_XPR_CHAR_(char_type, 'x'): this->flag_(set, ignore_white_space); break;
- case BOOST_XPR_CHAR_(char_type, ':'): ++begin; // fall-through
+ case BOOST_XPR_CHAR_(char_type, ':'): ++begin; BOOST_FALLTHROUGH;
case BOOST_XPR_CHAR_(char_type, ')'): return token_no_mark;
- case BOOST_XPR_CHAR_(char_type, '-'): if(false == (set = !set)) break; // else fall-through
+ case BOOST_XPR_CHAR_(char_type, '-'): if(false == (set = !set)) break; BOOST_FALLTHROUGH;
default: BOOST_THROW_EXCEPTION(regex_error(error_paren, "unknown pattern modifier"));
}
while(BOOST_XPR_ENSURE_(++begin != end, error_paren, "incomplete extension"));
Modified: branches/release/boost/xpressive/detail/utility/sequence_stack.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/utility/sequence_stack.hpp Thu Aug 22 15:45:30 2013 (r85426)
+++ branches/release/boost/xpressive/detail/utility/sequence_stack.hpp 2013-08-22 15:50:55 EDT (Thu, 22 Aug 2013) (r85427)
@@ -31,22 +31,29 @@
template<typename T>
struct sequence_stack
{
+ struct allocate_guard_t;
+ friend struct allocate_guard_t;
+ struct allocate_guard_t
+ {
+ std::size_t i;
+ T *p;
+ bool dismissed;
+ ~allocate_guard_t()
+ {
+ if(!this->dismissed)
+ sequence_stack::deallocate(this->p, this->i);
+ }
+ };
private:
static T *allocate(std::size_t size, T const &t)
{
- std::size_t i = 0;
- T *p = (T *)::operator new(size * sizeof(T));
- try
- {
- for(; i < size; ++i)
- ::new((void *)(p+i)) T(t);
- }
- catch(...)
- {
- deallocate(p, i);
- throw;
- }
- return p;
+ allocate_guard_t guard = {0, (T *)::operator new(size * sizeof(T)), false};
+
+ for(; guard.i < size; ++guard.i)
+ ::new((void *)(guard.p + guard.i)) T(t);
+ guard.dismissed = true;
+
+ return guard.p;
}
static void deallocate(T *p, std::size_t i)
Modified: branches/release/boost/xpressive/match_results.hpp
==============================================================================
--- branches/release/boost/xpressive/match_results.hpp Thu Aug 22 15:45:30 2013 (r85426)
+++ branches/release/boost/xpressive/match_results.hpp 2013-08-22 15:50:55 EDT (Thu, 22 Aug 2013) (r85427)
@@ -1096,11 +1096,12 @@
case BOOST_XPR_CHAR_(char_type, ':'):
if(metacolon)
{
+ BOOST_FALLTHROUGH;
case BOOST_XPR_CHAR_(char_type, ')'):
++cur;
return out;
}
- // else fall-through
+ BOOST_FALLTHROUGH;
default:
*out++ = *cur++;
Modified: branches/release/boost/xpressive/regex_algorithms.hpp
==============================================================================
--- branches/release/boost/xpressive/regex_algorithms.hpp Thu Aug 22 15:45:30 2013 (r85426)
+++ branches/release/boost/xpressive/regex_algorithms.hpp 2013-08-22 15:50:55 EDT (Thu, 22 Aug 2013) (r85427)
@@ -303,7 +303,6 @@
)
{
typedef core_access<BidiIter> access;
- typedef typename iterator_value<BidiIter>::type char_type;
match_results<BidiIter> &what = *state.context_.results_ptr_;
BOOST_ASSERT(0 != re.regex_id());
Modified: branches/release/boost/xpressive/regex_compiler.hpp
==============================================================================
--- branches/release/boost/xpressive/regex_compiler.hpp Thu Aug 22 15:45:30 2013 (r85426)
+++ branches/release/boost/xpressive/regex_compiler.hpp 2013-08-22 15:50:55 EDT (Thu, 22 Aug 2013) (r85427)
@@ -16,6 +16,7 @@
#endif
#include <map>
+#include <boost/config.hpp>
#include <boost/assert.hpp>
#include <boost/next_prior.hpp>
#include <boost/range/begin.hpp>
@@ -282,7 +283,7 @@
break;
case 2:
seq = detail::make_dynamic<BidiIter>(alternate_matcher()) | seq;
- // fall-through
+ BOOST_FALLTHROUGH;
default:
seq |= this->parse_sequence(tmp, end);
}
@@ -322,13 +323,15 @@
break;
case token_negative_lookahead:
- negative = true; // fall-through
+ negative = true;
+ BOOST_FALLTHROUGH;
case token_positive_lookahead:
lookahead = true;
break;
case token_negative_lookbehind:
- negative = true; // fall-through
+ negative = true;
+ BOOST_FALLTHROUGH;
case token_positive_lookbehind:
lookbehind = true;
break;
@@ -342,10 +345,16 @@
{
switch(this->traits_.get_token(begin, end))
{
- case token_group_end: return this->parse_atom(begin, end);
- case token_escape: BOOST_XPR_ENSURE_(begin != end, error_escape, "incomplete escape sequence");
- case token_literal: ++begin;
- default:;
+ case token_group_end:
+ return this->parse_atom(begin, end);
+ case token_escape:
+ BOOST_XPR_ENSURE_(begin != end, error_escape, "incomplete escape sequence");
+ BOOST_FALLTHROUGH;
+ case token_literal:
+ ++begin;
+ break;
+ default:
+ break;
}
}
break;
@@ -688,11 +697,17 @@
{
switch(this->traits_.get_token(begin, end))
{
- case token_quote_meta_end: return string_type(old_begin, old_end);
- case token_escape: BOOST_XPR_ENSURE_(begin != end, error_escape, "incomplete escape sequence");
+ case token_quote_meta_end:
+ return string_type(old_begin, old_end);
+ case token_escape:
+ BOOST_XPR_ENSURE_(begin != end, error_escape, "incomplete escape sequence");
+ BOOST_FALLTHROUGH;
case token_invalid_quantifier:
- case token_literal: ++begin;
- default:;
+ case token_literal:
+ ++begin;
+ break;
+ default:
+ break;
}
}
return string_type(old_begin, begin);
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