aboutsummaryrefslogtreecommitdiff
path: root/third-party/boost-math/include/boost/math/tools/throw_exception.hpp
blob: 3a918db9432e7d4b00b20e652717e29b69c2964f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//  (C) Copyright Matt Borland 2021.
//  Use, modification and distribution are subject to 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)

#ifndef BOOST_MATH_TOOLS_THROW_EXCEPTION_HPP
#define BOOST_MATH_TOOLS_THROW_EXCEPTION_HPP

#include <boost/math/tools/is_standalone.hpp>

#ifndef BOOST_MATH_STANDALONE

#if defined(_MSC_VER) || defined(__GNUC__)
# pragma push_macro( "I" )
# undef I
#endif

#include <boost/throw_exception.hpp>
#define BOOST_MATH_THROW_EXCEPTION(expr) boost::throw_exception(expr);

#if defined(_MSC_VER) || defined(__GNUC__)
# pragma pop_macro( "I" )
#endif

#else // Standalone mode - use standard library facilities

#ifdef _MSC_VER
#  ifdef _CPPUNWIND
#    define BOOST_MATH_THROW_EXCEPTION(expr) throw expr;
#  else
#    define BOOST_MATH_THROW_EXCEPTION(expr)
#  endif
#else
#  ifdef __EXCEPTIONS
#    define BOOST_MATH_THROW_EXCEPTION(expr) throw expr;
#  else
#    define BOOST_MATH_THROW_EXCEPTION(expr)
#  endif
#endif

#endif // BOOST_MATH_STANDALONE

#endif // BOOST_MATH_TOOLS_THROW_EXCEPTION_HPP