[Boost.Regex] Not compiling without exceptions.

In cpp_regex_traits.cpp line 76 there is a re-throw. This does not work when compiling without exceptions. I see that gcc have a #ifndef __EXCEPTIONS # define __throw_exception_again #else # define __throw_exception_again throw #endif for this case. Something similar should work for boost as well. To allow compiling I did this: --- ../../boost/boost/throw_exception.hpp 2004-08-05 17:24:43.000000000 +0200 +++ boost/throw_exception.hpp 2005-03-08 03:04:27.066704153 +0100 @@ -32,6 +32,8 @@ void throw_exception(std::exception const & e); // user defined +#define BOOST_THROW_EXCEPTION_AGAIN + #else template<class E> inline void throw_exception(E const & e) @@ -39,6 +41,8 @@ throw e; } +#define BOOST_THROW_EXCEPTION_AGAIN throw + #endif } // namespace boost -- Lgb

"Lars Gullik Bjønnes" wrote:
In cpp_regex_traits.cpp line 76 there is a re-throw. This does not work when compiling without exceptions. [...]
To allow compiling I did this:
--- ../../boost/boost/throw_exception.hpp 2004-08-05 17:24:43.000000000 +0200 +++ boost/throw_exception.hpp 2005-03-08 03:04:27.066704153 +0100 @@ -32,6 +32,8 @@
void throw_exception(std::exception const & e); // user defined
+#define BOOST_THROW_EXCEPTION_AGAIN
throw_exception.hpp doesn't contain helper TRY/CATCH/RETHROW macros for two reasons: 1. Most non-g++ compilers accept the exception handling constructs in "no exceptions" mode; 2. The proper way to fix code that relies on catch(...)+throw is to introduce a RAII guard. This also helps with other catch(...)-related problems. This reminds me that I need to fix shared_count.hpp to not contain a rethrow. However, last time we discussed the issue, it was pointed out that the RAII way has performance implications compared to catch(...)+throw. This lead to detail/no_exception_support.hpp, which does contain a BOOST_RETHROW macro.

"Peter Dimov" <pdimov@mmltd.net> writes: | throw_exception.hpp doesn't contain helper TRY/CATCH/RETHROW macros | for two reasons:
| 1. Most non-g++ compilers accept the exception handling constructs in | "no exceptions" mode; That doesn't help me. and it is only re-throw that is problematic. The other constructs are taken care of. | 2. The proper way to fix code that relies on catch(...)+throw is to | introduce a RAII guard. This also helps with other catch(...)-related | problems.
| This reminds me that I need to fix shared_count.hpp to not contain a | rethrow. There the "no exceptions" case is handled. So strictly not needed. | However, last time we discussed the issue, it was pointed out that the | RAII way has performance implications compared to catch(...)+throw. | This lead to detail/no_exception_support.hpp, which does contain a | BOOST_RETHROW macro. So either it should be used or the re-throw rewritten. Seems to me that some semi-invasive changes must be done to cpp_regex_traits.cpp to use RAII to make the this->m_pmessages->close(cat) happen. So the question is how to solve for 1.33. IMHO the simple solution should be used: use BOOST_RETHROW and be done with it. Later if that macro is unwelcome in the code, it can be rewritten. -- Lgb

That doesn't help me.
and it is only re-throw that is problematic. The other constructs are taken care of.
That's a straightforward bug on my part, it'll be fixed in cvs shortly. For some reason VC++ didn't even give me a warning on that when I tested compiling without exception handling enabled :-( John.
participants (3)
-
John Maddock
-
larsbj@gullik.net
-
Peter Dimov