1 // Boost.Geometry (aka GGL, Generic Geometry Library)
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.
8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
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)
14 #ifndef BOOST_GEOMETRY_CORE_ASSERT_HPP
15 #define BOOST_GEOMETRY_CORE_ASSERT_HPP
17 #include <boost/assert.hpp>
19 #undef BOOST_GEOMETRY_ASSERT
20 #undef BOOST_GEOMETRY_ASSERT_MSG
22 #if defined(BOOST_GEOMETRY_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_GEOMETRY_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) )
24 #include <boost/config.hpp> // for BOOST_LIKELY
25 #include <boost/current_function.hpp>
27 namespace boost { namespace geometry
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
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__))
38 #define BOOST_GEOMETRY_ASSERT(expr) BOOST_ASSERT(expr)
39 #define BOOST_GEOMETRY_ASSERT_MSG(expr, msg) BOOST_ASSERT_MSG(expr, msg)
43 #endif // BOOST_GEOMETRY_CORE_EXCEPTION_HPP