Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79556 - in branches/release: boost boost/regex boost/regex/v4 libs/regex libs/regex/build libs/regex/doc libs/regex/performance libs/regex/src libs/regex/test/regress
From: john_at_[hidden]
Date: 2012-07-16 04:38:26


Author: johnmaddock
Date: 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
New Revision: 79556
URL: http://svn.boost.org/trac/boost/changeset/79556

Log:
Merge collected bug fixes from Trunk:
Refs #589.
Refs #7032.
Refs #7084.
Refs #6346.
Properties modified:
   branches/release/boost/cregex.hpp (props changed)
   branches/release/boost/regex/ (props changed)
   branches/release/boost/regex.hpp (props changed)
   branches/release/libs/regex/ (props changed)
   branches/release/libs/regex/performance/command_line.cpp (props changed)
   branches/release/libs/regex/performance/main.cpp (props changed)
   branches/release/libs/regex/performance/time_std.cpp (props changed)
Text files modified:
   branches/release/boost/regex/config.hpp | 5 ++++-
   branches/release/boost/regex/v4/basic_regex.hpp | 9 ++++++---
   branches/release/boost/regex/v4/basic_regex_parser.hpp | 15 +++++++++++++++
   branches/release/boost/regex/v4/instances.hpp | 5 ++++-
   branches/release/boost/regex/v4/match_results.hpp | 5 ++++-
   branches/release/boost/regex/v4/perl_matcher.hpp | 5 ++++-
   branches/release/boost/regex/v4/regex_iterator.hpp | 2 +-
   branches/release/libs/regex/build/Jamfile.v2 | 2 +-
   branches/release/libs/regex/doc/history.qbk | 6 ++++++
   branches/release/libs/regex/src/fileiter.cpp | 2 ++
   branches/release/libs/regex/src/posix_api.cpp | 1 +
   branches/release/libs/regex/src/regex.cpp | 1 +
   branches/release/libs/regex/src/regex_raw_buffer.cpp | 4 +++-
   branches/release/libs/regex/test/regress/test_not_regex.hpp | 4 ++++
   branches/release/libs/regex/test/regress/test_regex_search.hpp | 4 ++++
   branches/release/libs/regex/test/regress/test_replace.cpp | 4 ++++
   16 files changed, 64 insertions(+), 10 deletions(-)

Modified: branches/release/boost/regex/config.hpp
==============================================================================
--- branches/release/boost/regex/config.hpp (original)
+++ branches/release/boost/regex/config.hpp 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -170,7 +170,10 @@
 # define BOOST_REGEX_HAS_OTHER_WCHAR_T
 # ifdef BOOST_MSVC
 # pragma warning(push)
-# pragma warning(disable : 4251 4231 4660)
+# pragma warning(disable : 4251 4231)
+# if BOOST_MSVC < 1600
+# pragma warning(disable : 4660)
+# endif
 # endif
 # if defined(_DLL) && defined(BOOST_MSVC) && (BOOST_MSVC < 1600)
 # include <string>

Modified: branches/release/boost/regex/v4/basic_regex.hpp
==============================================================================
--- branches/release/boost/regex/v4/basic_regex.hpp (original)
+++ branches/release/boost/regex/v4/basic_regex.hpp 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -36,7 +36,10 @@
 namespace boost{
 #ifdef BOOST_MSVC
 #pragma warning(push)
-#pragma warning(disable : 4251 4231 4660 4800)
+#pragma warning(disable : 4251 4231 4800)
+#if BOOST_MSVC < 1600
+#pragma warning(disable : 4660)
+#endif
 #endif
 
 namespace re_detail{
@@ -243,11 +246,11 @@
    // begin, end:
    const_iterator BOOST_REGEX_CALL begin()const
    {
- return (!this->m_status ? 0 : this->m_expression);
+ return (this->m_status ? 0 : this->m_expression);
    }
    const_iterator BOOST_REGEX_CALL end()const
    {
- return (!this->m_status ? 0 : this->m_expression + this->m_expression_len);
+ return (this->m_status ? 0 : this->m_expression + this->m_expression_len);
    }
    flag_type BOOST_REGEX_CALL flags()const
    {

Modified: branches/release/boost/regex/v4/basic_regex_parser.hpp
==============================================================================
--- branches/release/boost/regex/v4/basic_regex_parser.hpp (original)
+++ branches/release/boost/regex/v4/basic_regex_parser.hpp 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -191,6 +191,7 @@
       this->m_pdata->m_status = error_code;
    m_position = m_end; // don't bother parsing anything else
 
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
    //
    // Augment error message with the regular expression text:
    //
@@ -211,6 +212,7 @@
       }
       message += "'.";
    }
+#endif
 
 #ifndef BOOST_NO_EXCEPTIONS
    if(0 == (this->flags() & regex_constants::no_except))
@@ -660,6 +662,11 @@
 bool basic_regex_parser<charT, traits>::parse_extended_escape()
 {
    ++m_position;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_escape, m_position - m_base, "Incomplete escape sequence found.");
+ return false;
+ }
    bool negate = false; // in case this is a character class escape: \w \d etc
    switch(this->m_traits.escape_syntax_type(*m_position))
    {
@@ -2089,6 +2096,14 @@
          return false;
       }
       v = this->m_traits.toi(m_position, m_end, 10);
+ if(m_position == m_end)
+ {
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
+ return false;
+ }
       if(*m_position == charT('R'))
       {
          if(++m_position == m_end)

Modified: branches/release/boost/regex/v4/instances.hpp
==============================================================================
--- branches/release/boost/regex/v4/instances.hpp (original)
+++ branches/release/boost/regex/v4/instances.hpp 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -84,7 +84,10 @@
 
 # ifdef BOOST_MSVC
 # pragma warning(push)
-# pragma warning(disable : 4251 4231 4660)
+# pragma warning(disable : 4251 4231)
+# if BOOST_MSVC < 1600
+# pragma warning(disable : 4660)
+# endif
 # endif
 
 template class BOOST_REGEX_TEMPLATE_DECL basic_regex< BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >;

Modified: branches/release/boost/regex/v4/match_results.hpp
==============================================================================
--- branches/release/boost/regex/v4/match_results.hpp (original)
+++ branches/release/boost/regex/v4/match_results.hpp 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -33,7 +33,10 @@
 namespace boost{
 #ifdef BOOST_MSVC
 #pragma warning(push)
-#pragma warning(disable : 4251 4231 4660)
+#pragma warning(disable : 4251 4231)
+# if BOOST_MSVC < 1600
+# pragma warning(disable : 4660)
+# endif
 #endif
 
 namespace re_detail{

Modified: branches/release/boost/regex/v4/perl_matcher.hpp
==============================================================================
--- branches/release/boost/regex/v4/perl_matcher.hpp (original)
+++ branches/release/boost/regex/v4/perl_matcher.hpp 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -344,7 +344,10 @@
 
 #ifdef BOOST_MSVC
 #pragma warning(push)
-#pragma warning(disable : 4251 4231 4660)
+#pragma warning(disable : 4251 4231)
+# if BOOST_MSVC < 1600
+# pragma warning(disable : 4660)
+# endif
 #endif
 
 template <class BidiIterator, class Allocator, class traits>

Modified: branches/release/boost/regex/v4/regex_iterator.hpp
==============================================================================
--- branches/release/boost/regex/v4/regex_iterator.hpp (original)
+++ branches/release/boost/regex/v4/regex_iterator.hpp 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -68,7 +68,7 @@
       // flags |= match_prev_avail;
       BidirectionalIterator next_start = what[0].second;
       match_flag_type f(flags);
- if(!what.length())
+ if(!what.length() || (f & regex_constants::match_posix))
          f |= regex_constants::match_not_initial_null;
       //if(base != next_start)
       // f |= regex_constants::match_not_bob;

Modified: branches/release/libs/regex/build/Jamfile.v2
==============================================================================
--- branches/release/libs/regex/build/Jamfile.v2 (original)
+++ branches/release/libs/regex/build/Jamfile.v2 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -15,7 +15,7 @@
 rule path_options ( properties * )
 {
     local result ;
- if <address-model>64 in $(properties)
+ if <address-model>64 in $(properties) && <toolset>msvc in $(properties)
     {
             result = <search>$(ICU_PATH)/bin64 <search>$(ICU_PATH)/lib64 ;
     }

Modified: branches/release/libs/regex/doc/history.qbk
==============================================================================
--- branches/release/libs/regex/doc/history.qbk (original)
+++ branches/release/libs/regex/doc/history.qbk 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -15,6 +15,12 @@
 
 All issues including closed ones can be viewed [@https://svn.boost.org/trac/boost/query?status=assigned&status=closed&status=new&status=reopened&component=regex&order=priority&col=id&col=summary&col=status&col=type&col=milestone&col=component here].
 
+[h4 Boost-1.51]
+
+Fixed issues:
+[@https://svn.boost.org/trac/boost/ticket/589 #589], [@https://svn.boost.org/trac/boost/ticket/7084 #7084],
+[@https://svn.boost.org/trac/boost/ticket/7032 #7032], [@https://svn.boost.org/trac/boost/ticket/6346 #6346].
+
 [h4 Boost-1.50]
 
 Fixed issue with `(?!)` not being a valid expression, and updated docs on what constitutes a valid conditional expression.

Modified: branches/release/libs/regex/src/fileiter.cpp
==============================================================================
--- branches/release/libs/regex/src/fileiter.cpp (original)
+++ branches/release/libs/regex/src/fileiter.cpp 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -19,6 +19,7 @@
 
 #define BOOST_REGEX_SOURCE
 
+#include <boost/config.hpp>
 #include <climits>
 #include <stdexcept>
 #include <string>
@@ -876,6 +877,7 @@
    {
       if(_fi_FindNextFile(dat, lpFindFileData))
          return dat;
+ closedir(h);
    }
    delete dat;
    return 0;

Modified: branches/release/libs/regex/src/posix_api.cpp
==============================================================================
--- branches/release/libs/regex/src/posix_api.cpp (original)
+++ branches/release/libs/regex/src/posix_api.cpp 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -18,6 +18,7 @@
 
 #define BOOST_REGEX_SOURCE
 
+#include <boost/config.hpp>
 #include <cstdio>
 #include <boost/regex.hpp>
 #include <boost/cregex.hpp>

Modified: branches/release/libs/regex/src/regex.cpp
==============================================================================
--- branches/release/libs/regex/src/regex.cpp (original)
+++ branches/release/libs/regex/src/regex.cpp 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -19,6 +19,7 @@
 
 #define BOOST_REGEX_SOURCE
 
+#include <boost/config.hpp>
 #include <new>
 #include <boost/regex.hpp>
 #include <boost/throw_exception.hpp>

Modified: branches/release/libs/regex/src/regex_raw_buffer.cpp
==============================================================================
--- branches/release/libs/regex/src/regex_raw_buffer.cpp (original)
+++ branches/release/libs/regex/src/regex_raw_buffer.cpp 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -18,6 +18,7 @@
 
 
 #define BOOST_REGEX_SOURCE
+#include <boost/config.hpp>
 #include <memory>
 #include <cstring>
 #include <boost/assert.hpp>
@@ -45,7 +46,8 @@
    // allocate and copy data:
    register pointer ptr = static_cast<pointer>(::operator new(newsize));
    BOOST_REGEX_NOEH_ASSERT(ptr)
- std::memcpy(ptr, start, datasize);
+ if(start)
+ std::memcpy(ptr, start, datasize);
 
    // get rid of old buffer:
    ::operator delete(start);

Modified: branches/release/libs/regex/test/regress/test_not_regex.hpp
==============================================================================
--- branches/release/libs/regex/test/regress/test_not_regex.hpp (original)
+++ branches/release/libs/regex/test/regress/test_not_regex.hpp 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -48,6 +48,10 @@
    {
       BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::status().", charT);
    }
+ if(r.begin() != r.end())
+ {
+ BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::begin().", charT);
+ }
 }
 
 template<class charT, class traits>

Modified: branches/release/libs/regex/test/regress/test_regex_search.hpp
==============================================================================
--- branches/release/libs/regex/test/regress/test_regex_search.hpp (original)
+++ branches/release/libs/regex/test/regress/test_regex_search.hpp 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -482,6 +482,10 @@
       {
          BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), charT);
       }
+ if(expression != std::basic_string<charT>(r.begin(), r.end()))
+ {
+ BOOST_REGEX_TEST_ERROR("Stored expression string was incorrect", charT);
+ }
       test_simple_search(r);
       test_regex_iterator(r);
       test_regex_token_iterator(r);

Modified: branches/release/libs/regex/test/regress/test_replace.cpp
==============================================================================
--- branches/release/libs/regex/test/regress/test_replace.cpp (original)
+++ branches/release/libs/regex/test/regress/test_replace.cpp 2012-07-16 04:38:23 EDT (Mon, 16 Jul 2012)
@@ -190,5 +190,9 @@
    TEST_REGEX_REPLACE("(?:(?<one>a)|(?<one>b))", perl, " ...b,,", match_default, "$1.$2.$+{one}", " ....b.b,,");
    TEST_REGEX_REPLACE("(?:(?<one>a)(?<one>b))", perl, " ...ab,,", match_default, "$1.$2.$+{one}", " ...a.b.a,,");
 
+ // See https://svn.boost.org/trac/boost/ticket/589
+ TEST_REGEX_REPLACE("(a*)", perl, "aabb", match_default, "{$1}", "{aa}{}b{}b{}");
+ TEST_REGEX_REPLACE("(a*)", extended, "aabb", match_default, "{$1}", "{aa}{}b{}b{}");
+ TEST_REGEX_REPLACE("(a*)", extended, "aabb", match_default|match_posix, "{$1}", "{aa}b{}b{}");
 }
 


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