From 406b2a9aa1bba785d7bff2798026830d44679e5a Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 21 Oct 2014 09:15:40 +0100 Subject: [PATCH 1/9] Apply patch from https://svn.boost.org/trac/boost/ticket/10682 --- doc/history.qbk | 4 ++-- doc/install.qbk | 2 +- doc/introduction.qbk | 2 +- doc/locale.qbk | 2 +- doc/non_std_strings.qbk | 2 +- doc/old_regex.qbk | 10 +++++----- doc/regex_split.qbk | 2 +- doc/syntax_basic.qbk | 2 +- include/boost/regex/v4/regex_workaround.hpp | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/history.qbk b/doc/history.qbk index d190debb..aebaee81 100644 --- a/doc/history.qbk +++ b/doc/history.qbk @@ -25,7 +25,7 @@ this gets bumped up from v4 to v5. * Fixed documentation typos from [@https://svn.boost.org/trac/boost/ticket/9283 #9283]. * Fixed bug in collation code that failed if the locale generated collation strings with embedded nul's, see [@https://svn.boost.org/trac/boost/ticket/9451 #9451]. -* Apply patch for unusual thread usage (no statically initiallized mutexes), see [@https://svn.boost.org/trac/boost/ticket/9461 #9461]. +* Apply patch for unusual thread usage (no statically initialized mutexes), see [@https://svn.boost.org/trac/boost/ticket/9461 #9461]. * Added better checks for invalid UTF-8 sequences, see [@https://svn.boost.org/trac/boost/ticket/9473 #9473]. [h4 Boost-1.54] @@ -153,7 +153,7 @@ and * Breaking Change: POSIX-extended and POSIX-basic regular expressions now enforce the letter of the POSIX standard much more closely than before. * Added support for (?imsx-imsx) constructs. * Added support for lookbehind expressions (?<=positive-lookbehind) and (?& v, std::string& s, boost::match_flag_type flags = match_default, unsigned max_count = ~0);`] [Splits the input string and pushes each one onto the vector. diff --git a/doc/regex_split.qbk b/doc/regex_split.qbk index d05e7f05..75543952 100644 --- a/doc/regex_split.qbk +++ b/doc/regex_split.qbk @@ -87,7 +87,7 @@ from a html file, and print them out to cout: char c; while(is.get(c)) { - // use logarithmic growth stategy, in case + // use logarithmic growth strategy, in case // in_avail (above) returned zero: if(s.capacity() == s.size()) s.reserve(s.capacity() * 3); diff --git a/doc/syntax_basic.qbk b/doc/syntax_basic.qbk index 019d731a..c3741934 100644 --- a/doc/syntax_basic.qbk +++ b/doc/syntax_basic.qbk @@ -156,7 +156,7 @@ An expression of the form `[[.col.]` matches the collating element /col/. A collating element is any single character, or any sequence of characters that collates as a single unit. Collating elements may also be used as the end point of a range, for example: `[[.ae.]-c]` matches -the character sequence "ae", plus any single character in the rangle "ae"-c, +the character sequence "ae", plus any single character in the range "ae"-c, assuming that "ae" is treated as a single collating element in the current locale. Collating elements may be used in place of escapes (which are not diff --git a/include/boost/regex/v4/regex_workaround.hpp b/include/boost/regex/v4/regex_workaround.hpp index 46a8a8d3..fc57472a 100644 --- a/include/boost/regex/v4/regex_workaround.hpp +++ b/include/boost/regex/v4/regex_workaround.hpp @@ -71,7 +71,7 @@ using std::distance; /***************************************************************************** * - * Fix broken broken namespace support: + * Fix broken namespace support: * ****************************************************************************/ From abf57b082b89a70bacdc1241f805c26fbd0cbe79 Mon Sep 17 00:00:00 2001 From: Zoey Greer Date: Tue, 11 Nov 2014 13:57:37 -0500 Subject: [PATCH 2/9] Initialize m_position, m_end, and m_flags The constructor for basic_regex_formatter left m_position, m_end, and m_flags uninitialized, as uncovered by Coverity CID12310. We now value-initialize them in the initializer list. --- include/boost/regex/v4/regex_format.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/regex/v4/regex_format.hpp b/include/boost/regex/v4/regex_format.hpp index 80c654e4..a34c40ad 100644 --- a/include/boost/regex/v4/regex_format.hpp +++ b/include/boost/regex/v4/regex_format.hpp @@ -96,7 +96,7 @@ class basic_regex_formatter public: typedef typename traits::char_type char_type; basic_regex_formatter(OutputIterator o, const Results& r, const traits& t) - : m_traits(t), m_results(r), m_out(o), m_state(output_copy), m_restore_state(output_copy), m_have_conditional(false) {} + : m_traits(t), m_results(r), m_out(o), m_position(), m_end(), m_flags(), m_state(output_copy), m_restore_state(output_copy), m_have_conditional(false) {} OutputIterator format(ForwardIter p1, ForwardIter p2, match_flag_type f); OutputIterator format(ForwardIter p1, match_flag_type f) { From ddd48205b8d46d23bcd0728f67856c9a855ed97b Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 13 Nov 2014 11:01:50 +0000 Subject: [PATCH 3/9] Silence Covertity warnings, see https://github.com/boostorg/regex/pull/7 --- include/boost/regex/v4/match_results.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/boost/regex/v4/match_results.hpp b/include/boost/regex/v4/match_results.hpp index 63e51175..3e79b7a7 100644 --- a/include/boost/regex/v4/match_results.hpp +++ b/include/boost/regex/v4/match_results.hpp @@ -76,10 +76,15 @@ public: // construct/copy/destroy: explicit match_results(const Allocator& a = Allocator()) #ifndef BOOST_NO_STD_ALLOCATOR - : m_subs(a), m_base(), m_last_closed_paren(0), m_is_singular(true) {} + : m_subs(a), m_base(), m_null(), m_last_closed_paren(0), m_is_singular(true) {} #else - : m_subs(), m_base(), m_last_closed_paren(0), m_is_singular(true) { (void)a; } + : m_subs(), m_base(), m_null(), m_last_closed_paren(0), m_is_singular(true) { (void)a; } #endif + // + // IMPORTANT: in the code below, the crazy looking checks around m_is_singular are + // all required because it is illegal to copy a singular iterator. + // See https://svn.boost.org/trac/boost/ticket/3632. + // match_results(const match_results& m) : m_subs(m.m_subs), m_named_subs(m.m_named_subs), m_last_closed_paren(m.m_last_closed_paren), m_is_singular(m.m_is_singular) { From dbda6314da08f8b63c668fa436f6715d55b317c3 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 13 Nov 2014 11:02:36 +0000 Subject: [PATCH 4/9] Initialize all members in initializer list, see https://github.com/boostorg/regex/pull/6 --- include/boost/regex/v4/perl_matcher.hpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/include/boost/regex/v4/perl_matcher.hpp b/include/boost/regex/v4/perl_matcher.hpp index 0a37a84a..b7b3b58e 100644 --- a/include/boost/regex/v4/perl_matcher.hpp +++ b/include/boost/regex/v4/perl_matcher.hpp @@ -254,13 +254,8 @@ class repeater_count std::size_t count; // the number of iterations so far BidiIterator start_pos; // where the last repeat started public: - repeater_count(repeater_count** s) - { - stack = s; - next = 0; - state_id = -1; - count = 0; - } + repeater_count(repeater_count** s) : stack(s), next(0), state_id(-1), count(0), start_pos() {} + repeater_count(int i, repeater_count** s, BidiIterator start) : start_pos(start) { From 115c4e7f4264180f915aa53f5954054c8af9abe4 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 13 Nov 2014 11:23:12 +0000 Subject: [PATCH 5/9] Fix typo, see https://svn.boost.org/trac/boost/ticket/10268 --- include/boost/regex/v4/basic_regex_parser.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/regex/v4/basic_regex_parser.hpp b/include/boost/regex/v4/basic_regex_parser.hpp index ca1adde3..3c331a57 100644 --- a/include/boost/regex/v4/basic_regex_parser.hpp +++ b/include/boost/regex/v4/basic_regex_parser.hpp @@ -1220,7 +1220,7 @@ bool basic_regex_parser::parse_alt() ) ) { - fail(regex_constants::error_empty, this->m_position - this->m_base, "A regular expression can start with the alternation operator |."); + fail(regex_constants::error_empty, this->m_position - this->m_base, "A regular expression cannot start with the alternation operator |."); return false; } // From f6a9bce728c8451d212836460aece6dfb7aa0896 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 2 Dec 2014 09:31:42 +0000 Subject: [PATCH 6/9] Fix icu behaviour with partial matches. See https://svn.boost.org/trac/boost/ticket/10114 --- include/boost/regex/icu.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/regex/icu.hpp b/include/boost/regex/icu.hpp index 37fec2ac..572172e5 100644 --- a/include/boost/regex/icu.hpp +++ b/include/boost/regex/icu.hpp @@ -397,10 +397,10 @@ void copy_results(MR1& out, MR2 const& in) out.set_base(in.base().base()); for(int i = 0; i < (int)in.size(); ++i) { - if(in[i].matched) + if(in[i].matched || !i) { out.set_first(in[i].first.base(), i); - out.set_second(in[i].second.base(), i); + out.set_second(in[i].second.base(), i, in[i].matched); } } } From 39aa10d82d6187d5cc33859b0bf8b96e5c7569e7 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Wed, 31 Dec 2014 19:31:20 +0000 Subject: [PATCH 7/9] Fix for: https://github.com/boostorg/regex/pull/9 --- src/fileiter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/fileiter.cpp b/src/fileiter.cpp index 780a12f1..5f65127f 100644 --- a/src/fileiter.cpp +++ b/src/fileiter.cpp @@ -267,14 +267,15 @@ void mapfile::lock(pointer* node)const read_size = std::fread(*node + sizeof(int), _size % buf_size, 1, hfile); else read_size = std::fread(*node + sizeof(int), buf_size, 1, hfile); -#ifndef BOOST_NO_EXCEPTIONS if((read_size == 0) || (std::ferror(hfile))) { +#ifndef BOOST_NO_EXCEPTIONS + unlock(node); throw std::runtime_error("Unable to read file."); - } #else - BOOST_REGEX_NOEH_ASSERT((0 == std::ferror(hfile)) && (read_size != 0)); + BOOST_REGEX_NOEH_ASSERT((0 == std::ferror(hfile)) && (read_size != 0)); #endif + } } else { From 8921188b707802e40ab14c68b5402f092c11aef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Hunold?= Date: Mon, 9 Feb 2015 12:09:56 +0100 Subject: [PATCH 8/9] Only specify debug library name for msvc and intel Boost.Build can then fallback to the release libraries for these compilers for user-defined variants. --- build/Jamfile.v2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index 75bf2a63..b00db691 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -60,9 +60,9 @@ if ! $(disable-icu) lib icuin : : icui18n shared shared @path_options ; lib icuin : : msvc debug icuind shared shared @path_options ; - lib icuin : : msvc release icuin shared shared @path_options ; + lib icuin : : msvc icuin shared shared @path_options ; lib icuin : : intel windows debug icuind shared shared @path_options ; - lib icuin : : intel windows release icuin shared shared @path_options ; + lib icuin : : intel windows icuin shared shared @path_options ; lib icuin : : this_is_an_invalid_library_name ; if $(ICU_PATH) From 13f707b38158c2f3a93c39202166e3b7636a678f Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 13 Feb 2015 19:24:05 +0000 Subject: [PATCH 9/9] Latest ICU doesn't permit the delayload option :( --- build/Jamfile.v2 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index 75bf2a63..241e4a99 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -103,12 +103,13 @@ if ! $(disable-icu) icuin/shared/shared BOOST_HAS_ICU=1 shared - msvc:/delayload:$(icuucd_name:B).dll - msvc:/delayload:$(icuuc_name:B).dll - msvc:/delayload:$(icudt_name:B).dll - msvc:/delayload:$(icuin_name:B).dll - msvc:/delayload:$(icuind_name:B).dll - msvc:delayimp.lib + # As of ICU-54 this does not work anymore (release mode): + #msvc:/delayload:$(icuucd_name:B).dll + #msvc:/delayload:$(icuuc_name:B).dll + #msvc:/delayload:$(icudt_name:B).dll + #msvc:/delayload:$(icuin_name:B).dll + #msvc:/delayload:$(icuind_name:B).dll + #msvc:delayimp.lib ; }