| 1 | // Boost.Geometry (aka GGL, Generic Geometry Library) |
| 2 | |
| 3 | // Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. |
| 4 | // Copyright (c) 2007, 2014 Peter Dimov |
| 5 | // Copyright (c) Beman Dawes 2011 |
| 6 | // Copyright (c) 2015 Oracle and/or its affiliates. |
| 7 | |
| 8 | // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle |
| 9 | |
| 10 | // Use, modification and distribution is subject to the Boost Software License, |
| 11 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
| 12 | // http://www.boost.org/LICENSE_1_0.txt) |
| 13 | |
| 14 | #ifndef BOOST_GEOMETRY_CORE_ASSERT_HPP |
| 15 | #define BOOST_GEOMETRY_CORE_ASSERT_HPP |
| 16 | |
| 17 | #include <boost/assert.hpp> |
| 18 | |
| 19 | #undef BOOST_GEOMETRY_ASSERT |
| 20 | #undef BOOST_GEOMETRY_ASSERT_MSG |
| 21 | |
| 22 | #if defined(BOOST_GEOMETRY_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_GEOMETRY_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) ) |
| 23 | |
| 24 | #include <boost/config.hpp> // for BOOST_LIKELY |
| 25 | #include <boost/current_function.hpp> |
| 26 | |
| 27 | namespace boost { namespace geometry |
| 28 | { |
| 29 | void assertion_failed(char const * expr, char const * function, char const * file, long line); // user defined |
| 30 | void assertion_failed_msg(char const * expr, char const * msg, char const * function, char const * file, long line); // user defined |
| 31 | }} // namespace boost::geometry |
| 32 | |
| 33 | #define BOOST_GEOMETRY_ASSERT(expr) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::geometry::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)) |
| 34 | #define BOOST_GEOMETRY_ASSERT_MSG(expr, msg) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::geometry::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)) |
| 35 | |
| 36 | #else |
| 37 | |
| 38 | #define BOOST_GEOMETRY_ASSERT(expr) BOOST_ASSERT(expr) |
| 39 | #define BOOST_GEOMETRY_ASSERT_MSG(expr, msg) BOOST_ASSERT_MSG(expr, msg) |
| 40 | |
| 41 | #endif |
| 42 | |
| 43 | #endif // BOOST_GEOMETRY_CORE_EXCEPTION_HPP |
| 44 | |