2002-05-21 23:39:58 +00:00
|
|
|
//
|
2003-03-03 15:53:48 +00:00
|
|
|
// boost/assert.hpp - BOOST_ASSERT(expr)
|
2011-06-05 12:59:35 +00:00
|
|
|
// BOOST_ASSERT_MSG(expr, msg)
|
|
|
|
// BOOST_VERIFY(expr)
|
2015-05-16 11:41:23 +00:00
|
|
|
// BOOST_VERIFY_MSG(expr, msg)
|
2015-12-20 13:04:54 +00:00
|
|
|
// BOOST_ASSERT_IS_VOID
|
2002-05-21 23:39:58 +00:00
|
|
|
//
|
|
|
|
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
2015-05-16 11:41:23 +00:00
|
|
|
// Copyright (c) 2007, 2014 Peter Dimov
|
2011-06-05 12:59:35 +00:00
|
|
|
// Copyright (c) Beman Dawes 2011
|
2015-12-20 13:04:54 +00:00
|
|
|
// Copyright (c) 2015 Ion Gaztanaga
|
2002-05-21 23:39:58 +00:00
|
|
|
//
|
2015-05-16 11:41:23 +00:00
|
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
|
|
// See accompanying file LICENSE_1_0.txt or copy at
|
|
|
|
// http://www.boost.org/LICENSE_1_0.txt
|
2002-05-21 23:39:58 +00:00
|
|
|
//
|
2003-03-03 15:53:48 +00:00
|
|
|
// Note: There are no include guards. This is intentional.
|
2002-05-21 23:39:58 +00:00
|
|
|
//
|
2015-05-16 11:41:23 +00:00
|
|
|
// See http://www.boost.org/libs/assert/assert.html for documentation.
|
2002-05-21 23:39:58 +00:00
|
|
|
//
|
|
|
|
|
2011-06-05 12:59:35 +00:00
|
|
|
//
|
|
|
|
// Stop inspect complaining about use of 'assert':
|
|
|
|
//
|
|
|
|
// boostinspect:naassert_macro
|
|
|
|
//
|
|
|
|
|
2015-05-16 11:41:23 +00:00
|
|
|
//
|
2015-12-20 13:04:54 +00:00
|
|
|
// BOOST_ASSERT, BOOST_ASSERT_MSG, BOOST_ASSERT_IS_VOID
|
2015-05-16 11:41:23 +00:00
|
|
|
//
|
2011-06-05 12:59:35 +00:00
|
|
|
|
2003-03-03 15:53:48 +00:00
|
|
|
#undef BOOST_ASSERT
|
2015-05-16 11:41:23 +00:00
|
|
|
#undef BOOST_ASSERT_MSG
|
2015-12-20 13:04:54 +00:00
|
|
|
#undef BOOST_ASSERT_IS_VOID
|
2002-05-21 23:39:58 +00:00
|
|
|
|
2015-05-16 11:41:23 +00:00
|
|
|
#if defined(BOOST_DISABLE_ASSERTS) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) )
|
2002-05-21 23:39:58 +00:00
|
|
|
|
2003-03-03 15:53:48 +00:00
|
|
|
# define BOOST_ASSERT(expr) ((void)0)
|
2015-05-16 11:41:23 +00:00
|
|
|
# define BOOST_ASSERT_MSG(expr, msg) ((void)0)
|
2015-12-20 13:04:54 +00:00
|
|
|
# define BOOST_ASSERT_IS_VOID
|
2002-05-21 23:39:58 +00:00
|
|
|
|
2015-05-16 11:41:23 +00:00
|
|
|
#elif defined(BOOST_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) )
|
2002-05-21 23:39:58 +00:00
|
|
|
|
2015-05-16 11:41:23 +00:00
|
|
|
#include <boost/config.hpp> // for BOOST_LIKELY
|
2002-05-21 23:39:58 +00:00
|
|
|
#include <boost/current_function.hpp>
|
|
|
|
|
2003-03-03 15:53:48 +00:00
|
|
|
namespace boost
|
|
|
|
{
|
2015-05-16 11:41:23 +00:00
|
|
|
void assertion_failed(char const * expr, char const * function, char const * file, long line); // user defined
|
|
|
|
void assertion_failed_msg(char const * expr, char const * msg, char const * function, char const * file, long line); // user defined
|
2003-03-03 15:53:48 +00:00
|
|
|
} // namespace boost
|
2002-05-21 23:39:58 +00:00
|
|
|
|
2015-05-16 11:41:23 +00:00
|
|
|
#define BOOST_ASSERT(expr) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
|
|
|
|
#define BOOST_ASSERT_MSG(expr, msg) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
|
2002-05-21 23:39:58 +00:00
|
|
|
|
2003-03-03 15:53:48 +00:00
|
|
|
#else
|
2011-06-05 12:59:35 +00:00
|
|
|
|
2015-05-16 11:41:23 +00:00
|
|
|
# include <assert.h> // .h to support old libraries w/o <cassert> - effect is the same
|
2011-06-05 12:59:35 +00:00
|
|
|
|
2015-05-16 11:41:23 +00:00
|
|
|
# define BOOST_ASSERT(expr) assert(expr)
|
|
|
|
# define BOOST_ASSERT_MSG(expr, msg) assert((expr)&&(msg))
|
2015-12-20 13:04:54 +00:00
|
|
|
#if defined(NDEBUG)
|
|
|
|
# define BOOST_ASSERT_IS_VOID
|
|
|
|
#endif
|
2011-06-05 12:59:35 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2015-05-16 11:41:23 +00:00
|
|
|
//
|
|
|
|
// BOOST_VERIFY, BOOST_VERIFY_MSG
|
|
|
|
//
|
2011-06-05 12:59:35 +00:00
|
|
|
|
2008-09-30 18:01:03 +00:00
|
|
|
#undef BOOST_VERIFY
|
2015-05-16 11:41:23 +00:00
|
|
|
#undef BOOST_VERIFY_MSG
|
2008-09-30 18:01:03 +00:00
|
|
|
|
|
|
|
#if defined(BOOST_DISABLE_ASSERTS) || ( !defined(BOOST_ENABLE_ASSERT_HANDLER) && defined(NDEBUG) )
|
|
|
|
|
|
|
|
# define BOOST_VERIFY(expr) ((void)(expr))
|
2015-05-16 11:41:23 +00:00
|
|
|
# define BOOST_VERIFY_MSG(expr, msg) ((void)(expr))
|
2008-09-30 18:01:03 +00:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
# define BOOST_VERIFY(expr) BOOST_ASSERT(expr)
|
2015-05-16 11:41:23 +00:00
|
|
|
# define BOOST_VERIFY_MSG(expr, msg) BOOST_ASSERT_MSG(expr,msg)
|
2008-09-30 18:01:03 +00:00
|
|
|
|
|
|
|
#endif
|