diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index d97619db..75bf2a63 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -15,7 +15,7 @@ local disable-icu = [ MATCH (--disable-icu) : [ modules.peek : ARGV ] ] ; rule path_options ( properties * ) { local result ; - if 64 in $(properties) + if 64 in $(properties) && msvc in $(properties) { result = $(ICU_PATH)/bin64 $(ICU_PATH)/lib64 ; } diff --git a/doc/history.qbk b/doc/history.qbk index f83aef93..3be7549f 100644 --- a/doc/history.qbk +++ b/doc/history.qbk @@ -15,6 +15,12 @@ Currently open issues can be viewed [@https://svn.boost.org/trac/boost/query?sta 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. diff --git a/include/boost/regex/config.hpp b/include/boost/regex/config.hpp index 6b7db45d..e8cec5b7 100644 --- a/include/boost/regex/config.hpp +++ b/include/boost/regex/config.hpp @@ -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 diff --git a/include/boost/regex/v4/basic_regex.hpp b/include/boost/regex/v4/basic_regex.hpp index 1e71877e..0b63e3aa 100644 --- a/include/boost/regex/v4/basic_regex.hpp +++ b/include/boost/regex/v4/basic_regex.hpp @@ -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 @@ public: // 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 { diff --git a/include/boost/regex/v4/basic_regex_parser.hpp b/include/boost/regex/v4/basic_regex_parser.hpp index 57997047..72dc4eeb 100644 --- a/include/boost/regex/v4/basic_regex_parser.hpp +++ b/include/boost/regex/v4/basic_regex_parser.hpp @@ -191,6 +191,7 @@ void basic_regex_parser::fail(regex_constants::error_type error_c 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 @@ void basic_regex_parser::fail(regex_constants::error_type error_c } message += "'."; } +#endif #ifndef BOOST_NO_EXCEPTIONS if(0 == (this->flags() & regex_constants::no_except)) @@ -660,6 +662,11 @@ template bool basic_regex_parser::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 @@ insert_recursion: 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) diff --git a/include/boost/regex/v4/instances.hpp b/include/boost/regex/v4/instances.hpp index c62d136f..2839c0b7 100644 --- a/include/boost/regex/v4/instances.hpp +++ b/include/boost/regex/v4/instances.hpp @@ -84,7 +84,10 @@ template class BOOST_REGEX_DECL ::boost::re_detail::perl_matcher; diff --git a/include/boost/regex/v4/match_results.hpp b/include/boost/regex/v4/match_results.hpp index ca9898f4..63e51175 100644 --- a/include/boost/regex/v4/match_results.hpp +++ b/include/boost/regex/v4/match_results.hpp @@ -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{ diff --git a/include/boost/regex/v4/perl_matcher.hpp b/include/boost/regex/v4/perl_matcher.hpp index 52cc55cc..ddaafbd7 100644 --- a/include/boost/regex/v4/perl_matcher.hpp +++ b/include/boost/regex/v4/perl_matcher.hpp @@ -344,7 +344,10 @@ struct recursion_info #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 diff --git a/include/boost/regex/v4/regex_iterator.hpp b/include/boost/regex/v4/regex_iterator.hpp index c2f2c49f..09e75c69 100644 --- a/include/boost/regex/v4/regex_iterator.hpp +++ b/include/boost/regex/v4/regex_iterator.hpp @@ -68,7 +68,7 @@ public: // 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; diff --git a/src/fileiter.cpp b/src/fileiter.cpp index 38c0d2c3..780a12f1 100644 --- a/src/fileiter.cpp +++ b/src/fileiter.cpp @@ -19,6 +19,7 @@ #define BOOST_REGEX_SOURCE +#include #include #include #include @@ -876,6 +877,7 @@ _fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindF { if(_fi_FindNextFile(dat, lpFindFileData)) return dat; + closedir(h); } delete dat; return 0; diff --git a/src/posix_api.cpp b/src/posix_api.cpp index abafd8f2..e59c19ea 100644 --- a/src/posix_api.cpp +++ b/src/posix_api.cpp @@ -18,6 +18,7 @@ #define BOOST_REGEX_SOURCE +#include #include #include #include diff --git a/src/regex.cpp b/src/regex.cpp index 27ac43cc..ea20a06b 100644 --- a/src/regex.cpp +++ b/src/regex.cpp @@ -19,6 +19,7 @@ #define BOOST_REGEX_SOURCE +#include #include #include #include diff --git a/src/regex_raw_buffer.cpp b/src/regex_raw_buffer.cpp index 7a8de803..f75f0a51 100644 --- a/src/regex_raw_buffer.cpp +++ b/src/regex_raw_buffer.cpp @@ -18,6 +18,7 @@ #define BOOST_REGEX_SOURCE +#include #include #include #include @@ -45,7 +46,8 @@ void BOOST_REGEX_CALL raw_storage::resize(size_type n) // allocate and copy data: register pointer ptr = static_cast(::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); diff --git a/test/regress/test_not_regex.hpp b/test/regress/test_not_regex.hpp index c1032994..18dfccfb 100644 --- a/test/regress/test_not_regex.hpp +++ b/test/regress/test_not_regex.hpp @@ -48,6 +48,10 @@ void test_empty(boost::basic_regex& r) { 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 diff --git a/test/regress/test_regex_search.hpp b/test/regress/test_regex_search.hpp index ff70d765..0d87f94c 100644 --- a/test/regress/test_regex_search.hpp +++ b/test/regress/test_regex_search.hpp @@ -482,6 +482,10 @@ void test(boost::basic_regex& r, const test_regex_search_tag&) { BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), charT); } + if(expression != std::basic_string(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); diff --git a/test/regress/test_replace.cpp b/test/regress/test_replace.cpp index 2d8724eb..be518268 100644 --- a/test/regress/test_replace.cpp +++ b/test/regress/test_replace.cpp @@ -190,5 +190,9 @@ void test_replace() TEST_REGEX_REPLACE("(?:(?a)|(?b))", perl, " ...b,,", match_default, "$1.$2.$+{one}", " ....b.b,,"); TEST_REGEX_REPLACE("(?:(?a)(?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{}"); }