2 // boost/assert.hpp - BOOST_ASSERT(expr)
3 // BOOST_ASSERT_MSG(expr, msg)
5 // BOOST_VERIFY_MSG(expr, msg)
6 // BOOST_ASSERT_IS_VOID
8 // Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
9 // Copyright (c) 2007, 2014 Peter Dimov
10 // Copyright (c) Beman Dawes 2011
11 // Copyright (c) 2015 Ion Gaztanaga
13 // Distributed under the Boost Software License, Version 1.0.
14 // See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt
17 // Note: There are no include guards. This is intentional.
19 // See http://www.boost.org/libs/assert/assert.html for documentation.
23 // Stop inspect complaining about use of 'assert':
25 // boostinspect:naassert_macro
29 // BOOST_ASSERT, BOOST_ASSERT_MSG, BOOST_ASSERT_IS_VOID
33 #undef BOOST_ASSERT_MSG
34 #undef BOOST_ASSERT_IS_VOID
36 #if defined(BOOST_DISABLE_ASSERTS) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) )
38 # define BOOST_ASSERT(expr) ((void)0)
39 # define BOOST_ASSERT_MSG(expr, msg) ((void)0)
40 # define BOOST_ASSERT_IS_VOID
42 #elif defined(BOOST_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) )
44 #include <boost/config.hpp> // for BOOST_LIKELY
45 #include <boost/current_function.hpp>
49 void assertion_failed(char const * expr, char const * function, char const * file, long line); // user defined
50 void assertion_failed_msg(char const * expr, char const * msg, char const * function, char const * file, long line); // user defined
53 #define BOOST_ASSERT(expr) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
54 #define BOOST_ASSERT_MSG(expr, msg) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
58 # include <assert.h> // .h to support old libraries w/o <cassert> - effect is the same
60 # define BOOST_ASSERT(expr) assert(expr)
61 # define BOOST_ASSERT_MSG(expr, msg) assert((expr)&&(msg))
63 # define BOOST_ASSERT_IS_VOID
69 // BOOST_VERIFY, BOOST_VERIFY_MSG
73 #undef BOOST_VERIFY_MSG
75 #if defined(BOOST_DISABLE_ASSERTS) || ( !defined(BOOST_ENABLE_ASSERT_HANDLER) && defined(NDEBUG) )
77 # define BOOST_VERIFY(expr) ((void)(expr))
78 # define BOOST_VERIFY_MSG(expr, msg) ((void)(expr))
82 # define BOOST_VERIFY(expr) BOOST_ASSERT(expr)
83 # define BOOST_VERIFY_MSG(expr, msg) BOOST_ASSERT_MSG(expr,msg)