Chris@16: // Chris@16: // boost/assert.hpp - BOOST_ASSERT(expr) Chris@16: // BOOST_ASSERT_MSG(expr, msg) Chris@16: // BOOST_VERIFY(expr) Chris@101: // BOOST_VERIFY_MSG(expr, msg) Chris@16: // Chris@16: // Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. Chris@101: // Copyright (c) 2007, 2014 Peter Dimov Chris@16: // Copyright (c) Beman Dawes 2011 Chris@16: // Chris@101: // Distributed under the Boost Software License, Version 1.0. Chris@101: // See accompanying file LICENSE_1_0.txt or copy at Chris@101: // http://www.boost.org/LICENSE_1_0.txt Chris@16: // Chris@16: // Note: There are no include guards. This is intentional. Chris@16: // Chris@101: // See http://www.boost.org/libs/assert/assert.html for documentation. Chris@16: // Chris@16: Chris@16: // Chris@16: // Stop inspect complaining about use of 'assert': Chris@16: // Chris@16: // boostinspect:naassert_macro Chris@16: // Chris@16: Chris@101: // Chris@101: // BOOST_ASSERT, BOOST_ASSERT_MSG Chris@101: // Chris@16: Chris@16: #undef BOOST_ASSERT Chris@101: #undef BOOST_ASSERT_MSG Chris@16: Chris@101: #if defined(BOOST_DISABLE_ASSERTS) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) ) Chris@16: Chris@16: # define BOOST_ASSERT(expr) ((void)0) Chris@101: # define BOOST_ASSERT_MSG(expr, msg) ((void)0) Chris@16: Chris@101: #elif defined(BOOST_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) ) Chris@16: Chris@101: #include // for BOOST_LIKELY Chris@16: #include Chris@16: Chris@16: namespace boost Chris@16: { Chris@101: void assertion_failed(char const * expr, char const * function, char const * file, long line); // user defined Chris@101: void assertion_failed_msg(char const * expr, char const * msg, char const * function, char const * file, long line); // user defined Chris@16: } // namespace boost Chris@16: Chris@101: #define BOOST_ASSERT(expr) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)) Chris@101: #define BOOST_ASSERT_MSG(expr, msg) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)) Chris@16: Chris@16: #else Chris@101: Chris@16: # include // .h to support old libraries w/o - effect is the same Chris@101: Chris@16: # define BOOST_ASSERT(expr) assert(expr) Chris@101: # define BOOST_ASSERT_MSG(expr, msg) assert((expr)&&(msg)) Chris@101: Chris@16: #endif Chris@16: Chris@101: // Chris@101: // BOOST_VERIFY, BOOST_VERIFY_MSG Chris@101: // Chris@16: Chris@16: #undef BOOST_VERIFY Chris@101: #undef BOOST_VERIFY_MSG Chris@16: Chris@16: #if defined(BOOST_DISABLE_ASSERTS) || ( !defined(BOOST_ENABLE_ASSERT_HANDLER) && defined(NDEBUG) ) Chris@16: Chris@16: # define BOOST_VERIFY(expr) ((void)(expr)) Chris@101: # define BOOST_VERIFY_MSG(expr, msg) ((void)(expr)) Chris@16: Chris@16: #else Chris@16: Chris@16: # define BOOST_VERIFY(expr) BOOST_ASSERT(expr) Chris@101: # define BOOST_VERIFY_MSG(expr, msg) BOOST_ASSERT_MSG(expr,msg) Chris@16: Chris@16: #endif