|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r57348 - trunk/boost/xpressive
From: eric_at_[hidden]
Date: 2009-11-03 19:32:07
Author: eric_niebler
Date: 2009-11-03 19:32:07 EST (Tue, 03 Nov 2009)
New Revision: 57348
URL: http://svn.boost.org/trac/boost/changeset/57348
Log:
eliminate unreachable code warnings on vc9
Text files modified:
trunk/boost/xpressive/regex_error.hpp | 35 +++++++++++++++++++++++++----------
1 files changed, 25 insertions(+), 10 deletions(-)
Modified: trunk/boost/xpressive/regex_error.hpp
==============================================================================
--- trunk/boost/xpressive/regex_error.hpp (original)
+++ trunk/boost/xpressive/regex_error.hpp 2009-11-03 19:32:07 EST (Tue, 03 Nov 2009)
@@ -77,19 +77,34 @@
namespace detail
{
- // To work around a GCC warning
- inline bool false_() { return false; }
+ inline bool ensure_(
+ bool cond
+ , regex_constants::error_type code
+ , char const *msg
+ , char const *fun
+ , char const *file
+ , unsigned long line
+ )
+ {
+ if(!cond)
+ {
+ #ifndef BOOST_EXCEPTION_DISABLE
+ boost::throw_exception(
+ boost::enable_error_info(boost::xpressive::regex_error(code, msg))
+ << boost::throw_function(fun)
+ << boost::throw_file(file)
+ << boost::throw_line((int)line)
+ );
+ #else
+ boost::throw_exception(boost::xpressive::regex_error(code, msg));
+ #endif
+ }
+ return true;
+ }
}
#define BOOST_XPR_ENSURE_(pred, code, msg) \
- ( \
- (pred) \
- ? true \
- : ( \
- BOOST_THROW_EXCEPTION(boost::xpressive::regex_error(code, msg)) \
- , boost::xpressive::detail::false_() \
- ) \
- ) \
+ boost::xpressive::detail::ensure_(pred, code, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__) \
/**/
}} // namespace boost::xpressive
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