Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51103 - trunk/boost/regex/v4
From: john_at_[hidden]
Date: 2009-02-08 11:30:45


Author: johnmaddock
Date: 2009-02-08 11:30:45 EST (Sun, 08 Feb 2009)
New Revision: 51103
URL: http://svn.boost.org/trac/boost/changeset/51103

Log:
Fixes #2713: change table initialisation so that it's initialised statically.
Text files modified:
   trunk/boost/regex/v4/perl_matcher.hpp | 4 ++++
   trunk/boost/regex/v4/perl_matcher_non_recursive.hpp | 6 +++++-
   trunk/boost/regex/v4/perl_matcher_recursive.hpp | 6 +++++-
   3 files changed, 14 insertions(+), 2 deletions(-)

Modified: trunk/boost/regex/v4/perl_matcher.hpp
==============================================================================
--- trunk/boost/regex/v4/perl_matcher.hpp (original)
+++ trunk/boost/regex/v4/perl_matcher.hpp 2009-02-08 11:30:45 EST (Sun, 08 Feb 2009)
@@ -403,6 +403,10 @@
    bool match_char_repeat();
    bool match_dot_repeat_fast();
    bool match_dot_repeat_slow();
+ bool match_dot_repeat_dispatch()
+ {
+ return ::boost::is_random_access_iterator<BidiIterator>::value ? match_dot_repeat_fast() : match_dot_repeat_slow();
+ }
    bool match_backstep();
    bool match_assert_backref();
    bool match_toggle_case();

Modified: trunk/boost/regex/v4/perl_matcher_non_recursive.hpp
==============================================================================
--- trunk/boost/regex/v4/perl_matcher_non_recursive.hpp (original)
+++ trunk/boost/regex/v4/perl_matcher_non_recursive.hpp 2009-02-08 11:30:45 EST (Sun, 08 Feb 2009)
@@ -154,7 +154,11 @@
       &perl_matcher<BidiIterator, Allocator, traits>::match_combining,
       &perl_matcher<BidiIterator, Allocator, traits>::match_soft_buffer_end,
       &perl_matcher<BidiIterator, Allocator, traits>::match_restart_continue,
- (::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_slow),
+ // Although this next line *should* be evaluated at compile time, in practice
+ // some compilers (VC++) emit run-time initialisation which breaks thread
+ // safety, so use a dispatch function instead:
+ //(::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_slow),
+ &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_dispatch,
       &perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat,
       &perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat,
       &perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat,

Modified: trunk/boost/regex/v4/perl_matcher_recursive.hpp
==============================================================================
--- trunk/boost/regex/v4/perl_matcher_recursive.hpp (original)
+++ trunk/boost/regex/v4/perl_matcher_recursive.hpp 2009-02-08 11:30:45 EST (Sun, 08 Feb 2009)
@@ -84,7 +84,11 @@
       &perl_matcher<BidiIterator, Allocator, traits>::match_combining,
       &perl_matcher<BidiIterator, Allocator, traits>::match_soft_buffer_end,
       &perl_matcher<BidiIterator, Allocator, traits>::match_restart_continue,
- (::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_slow),
+ // Although this next line *should* be evaluated at compile time, in practice
+ // some compilers (VC++) emit run-time initialisation which breaks thread
+ // safety, so use a dispatch function instead:
+ //(::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_slow),
+ &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_dispatch,
       &perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat,
       &perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat,
       &perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat,


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