[Regex] regex_match changed to match_any in 1.33?
In boost/regex/v4/regex_match.hpp, a number of the overloads (the ones that don't take a result parameter) are now bitwise-oring in regex_constants::match_any. As a result, a sequence like boost::regexp exp("a(bc)?") char *value = "abcbc"; bool result = boost::regex_match(value, value + 5, exp); will now set result to true where it was previously false in 1.32. I fixed our code by passing in a dummy result object as an extra parameter. Was this change intentional? I couldn't find any documentation that mentions it. JVS
In boost/regex/v4/regex_match.hpp, a number of the overloads (the ones that don't take a result parameter) are now bitwise-oring in regex_constants::match_any.
As a result, a sequence like
boost::regexp exp("a(bc)?") char *value = "abcbc"; bool result = boost::regex_match(value, value + 5, exp);
will now set result to true where it was previously false in 1.32. I fixed our code by passing in a dummy result object as an extra parameter.
Was this change intentional? I couldn't find any documentation that mentions it.
It's intentional in the sense that or'ing with match_any *should never
effect whether a match is found or not*, only which or several possible
matches gets selected.
I can't reproduce your problem here, here's the test code I'm using:
#include
Hi, I use g++ 3.3 to compile giallo,but have lots of error: agile@guo:~/work/giallo$ bjam ...patience... ...found 929 targets... ...updating 85 targets... gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/socket_option.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/socket.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/address_info.ogcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/any_address.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/socket_init.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/address.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/protocol.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/interface.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/named_pipe.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/overlapped_arguments.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/event.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/select.o In file included from /home/agile/work/boost_1_33_0/boost/thread/detail/config.hpp:18, from /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:15, from /home/agile/work/giallo/libs/net/src/demultiplexer/unix/select.cpp:9, from /home/agile/work/giallo/libs/net/src/demultiplexer/select.cpp:29: /home/agile/work/boost_1_33_0/boost/config/requires_threads.hpp:47:5: #error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" In file included from /home/agile/work/giallo/libs/net/src/demultiplexer/unix/select.cpp:9, from /home/agile/work/giallo/libs/net/src/demultiplexer/select.cpp:29: /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:58: error: `cv_state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:58: error: `state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:58: error: invalid data member initialization /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:58: error: (use `=' to initialize static data members) /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:58: error: variable or field `do_lock' declared void /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:58: error: declaration of `int boost::mutex::do_lock' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:56: error: conflicts with previous declaration `void boost::mutex::do_lock()' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:59: error: `cv_state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:59: error: `state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:59: error: invalid data member initialization /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:59: error: variable or field `do_unlock' declared void /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:59: error: declaration of `int boost::mutex::do_unlock' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:57: error: conflicts with previous declaration `void boost::mutex::do_unlock()' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:100: error: `cv_state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:100: error: `state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:100: error: invalid data member initialization /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:100: error: variable or field `do_lock' declared void /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:100: error: declaration of `int boost::try_mutex::do_lock' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:97: error: conflicts with previous declaration `void boost::try_mutex::do_lock()' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:101: error: `cv_state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:101: error: `state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:101: error: invalid data member initialization /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:101: error: variable or field `do_unlock' declared void /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:101: error: declaration of `int boost::try_mutex::do_unlock' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:99: error: conflicts with previous declaration `void boost::try_mutex::do_unlock()' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:144: error: `cv_state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:144: error: `state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:144: error: invalid data member initialization /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:144: error: variable or field `do_lock' declared void /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:144: error: declaration of `int boost::timed_mutex::do_lock' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:140: error: conflicts with previous declaration `void boost::timed_mutex::do_lock()' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:145: error: `cv_state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:145: error: `state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:145: error: invalid data member initialization /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:145: error: variable or field `do_unlock' declared void /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:145: error: declaration of `int boost::timed_mutex::do_unlock' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:143: error: conflicts with previous declaration `void boost::timed_mutex::do_unlock()' In file included from /home/agile/work/giallo/libs/net/src/demultiplexer/select.cpp:29: /home/agile/work/boost_1_33_0/boost/thread/detail/lock.hpp: In instantiation of `boost::detail::thread::lock_opsboost::mutex': /home/agile/work/boost_1_33_0/boost/thread/detail/lock.hpp:81: instantiated from `void boost::detail::thread::scoped_lock<Mutex>::lock() [with Mutex = boost::mutex]' /home/agile/work/boost_1_33_0/boost/thread/detail/lock.hpp:71: instantiated from `boost::detail::thread::scoped_lock<Mutex>::scoped_lock(Mutex&, bool) [with Mutex = boost::mutex]' /home/agile/work/giallo/libs/net/src/demultiplexer/unix/select.cpp:232: instantiated from here /home/agile/work/boost_1_33_0/boost/thread/detail/lock.hpp:34: error: no type named `cv_state' in `class boost::mutex' /home/agile/work/boost_1_33_0/boost/thread/detail/lock.hpp:53: error: no type named `cv_state' in `class boost::mutex' /home/agile/work/boost_1_33_0/boost/thread/detail/lock.hpp:57: error: no type named `cv_state' in `class boost::mutex' set -e "g++" -c -Wall -ftemplate-depth-255 -g -O0 -fno-inline -I"bin/giallo/libs/net/build" -I"/home/agile/work/boost_1_33_0" -I"/home/agile/work/giallo" -o "bin/giallo/libs/net/build/libboost_net.a/gcc/debug/select.o" "/home/agile/work/giallo/libs/net/build/../src/demultiplexer/select.cpp" "/usr/bin/objcopy" --set-section-flags .debug_str=contents,debug "bin/giallo/libs/net/build/libboost_net.a/gcc/debug/select.o" ...failed gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/select.o... gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/completion_port.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/aio.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/wait_for_objects.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/signal_handler.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/trace.o In file included from /home/agile/work/boost_1_33_0/boost/thread/detail/config.hpp:18, from /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:15, from /home/agile/work/giallo/boost/net/detail/trace.hpp:14, from /home/agile/work/giallo/libs/net/src/trace.cpp:16: /home/agile/work/boost_1_33_0/boost/config/requires_threads.hpp:47:5: #error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" In file included from /home/agile/work/giallo/boost/net/detail/trace.hpp:14, from /home/agile/work/giallo/libs/net/src/trace.cpp:16: /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:58: error: `cv_state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:58: error: `state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:58: error: invalid data member initialization /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:58: error: (use `=' to initialize static data members) /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:58: error: variable or field `do_lock' declared void /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:58: error: declaration of `int boost::mutex::do_lock' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:56: error: conflicts with previous declaration `void boost::mutex::do_lock()' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:59: error: `cv_state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:59: error: `state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:59: error: invalid data member initialization /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:59: error: variable or field `do_unlock' declared void /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:59: error: declaration of `int boost::mutex::do_unlock' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:57: error: conflicts with previous declaration `void boost::mutex::do_unlock()' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:100: error: `cv_state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:100: error: `state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:100: error: invalid data member initialization /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:100: error: variable or field `do_lock' declared void /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:100: error: declaration of `int boost::try_mutex::do_lock' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:97: error: conflicts with previous declaration `void boost::try_mutex::do_lock()' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:101: error: `cv_state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:101: error: `state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:101: error: invalid data member initialization /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:101: error: variable or field `do_unlock' declared void /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:101: error: declaration of `int boost::try_mutex::do_unlock' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:99: error: conflicts with previous declaration `void boost::try_mutex::do_unlock()' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:144: error: `cv_state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:144: error: `state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:144: error: invalid data member initialization /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:144: error: variable or field `do_lock' declared void /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:144: error: declaration of `int boost::timed_mutex::do_lock' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:140: error: conflicts with previous declaration `void boost::timed_mutex::do_lock()' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:145: error: `cv_state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:145: error: `state' was not declared in this scope /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:145: error: invalid data member initialization /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:145: error: variable or field `do_unlock' declared void /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:145: error: declaration of `int boost::timed_mutex::do_unlock' /home/agile/work/boost_1_33_0/boost/thread/mutex.hpp:143: error: conflicts with previous declaration `void boost::timed_mutex::do_unlock()' set -e "g++" -c -Wall -ftemplate-depth-255 -g -O0 -fno-inline -I"bin/giallo/libs/net/build" -I"/home/agile/work/boost_1_33_0" -I"/home/agile/work/giallo" -o "bin/giallo/libs/net/build/libboost_net.a/gcc/debug/trace.o" "/home/agile/work/giallo/libs/net/build/../src/trace.cpp" "/usr/bin/objcopy" --set-section-flags .debug_str=contents,debug "bin/giallo/libs/net/build/libboost_net.a/gcc/debug/trace.o" ...failed gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/trace.o... gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/timer.o ...skipped <@giallo!libs!net!build/libboost_net.a/gcc/debug>libboost_net-gcc-d-1_33.a for lack of <@giallo!libs!net!build/libboost_net.a/gcc/debug>libboost_net-gcc-d-1_33.a(select.o)... MkDir1 bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/socket_option.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/socket.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/address_info.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/any_address.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/socket_init.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/address_storage.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/address.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/protocol.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/interface.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/named_pipe.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/overlapped_arguments.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/completion.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/event.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/select.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/completion_port.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/aio.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/wait_for_objects.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/signal_handler.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/trace.o gcc-C++-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/timer.o gcc-Archive-action bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/libboost_net-gcc-mt-d-1_33.a /usr/bin/ar: 正在创建 bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/libboost_net-gcc-mt-d-1_33.a system-Ranlib bin/giallo/libs/net/build/libboost_net.a/gcc/debug/threading-multi/libboost_net-gcc-mt-d-1_33.a
ghq7613 wrote:
Hi, I use g++ 3.3 to compile giallo,but have lots of error:
Yes, it isn't working just at the moment, as I mentioned in my other response; it might be a couple more days before Hugo gets everything checked in correctly. Please observe correct message threading when you send these requests; you'll have a better chance of getting a prompt response. Matt
Here's the output for my test code below:
jvs@bagheera:~/open/fennel/test$ BugTest
regex_match(without result): 1
regex_match(with result): 0
====
#include
I can't reproduce your problem here, here's the test code I'm using:
#include
#include <iostream> int main() { boost::regex exp("a(bc)?"); const char *value = "abcbc"; bool result = boost::regex_match(value, value + 5, exp); return result; }
John.
Here's the fix that'll be going into cvs at some point: RCS file: /cvsroot/boost/boost/boost/regex/v4/perl_matcher_non_recursive.hpp,v retrieving revision 1.31 diff -r1.31 perl_matcher_non_recursive.hpp 520,521c520,524 < // store position in case we fail: < push_non_greedy_repeat(rep->next.p); ---
if((next_count->get_count() < rep->max) && take_first) { // store position in case we fail: push_non_greedy_repeat(rep->next.p); }
John.
participants (5)
-
ghq7613
-
John Maddock
-
John Sichi
-
John V. Sichi
-
Matt Vogt