44 lines · plain
1// (C) Copyright Matt Borland 2021.2// Use, modification and distribution are subject to the3// Boost Software License, Version 1.0. (See accompanying file4// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)5 6#ifndef BOOST_MATH_TOOLS_THROW_EXCEPTION_HPP7#define BOOST_MATH_TOOLS_THROW_EXCEPTION_HPP8 9#include <boost/math/tools/is_standalone.hpp>10 11#ifndef BOOST_MATH_STANDALONE12 13#if defined(_MSC_VER) || defined(__GNUC__)14# pragma push_macro( "I" )15# undef I16#endif17 18#include <boost/throw_exception.hpp>19#define BOOST_MATH_THROW_EXCEPTION(expr) boost::throw_exception(expr);20 21#if defined(_MSC_VER) || defined(__GNUC__)22# pragma pop_macro( "I" )23#endif24 25#else // Standalone mode - use standard library facilities26 27#ifdef _MSC_VER28# ifdef _CPPUNWIND29# define BOOST_MATH_THROW_EXCEPTION(expr) throw expr;30# else31# define BOOST_MATH_THROW_EXCEPTION(expr)32# endif33#else34# ifdef __EXCEPTIONS35# define BOOST_MATH_THROW_EXCEPTION(expr) throw expr;36# else37# define BOOST_MATH_THROW_EXCEPTION(expr)38# endif39#endif40 41#endif // BOOST_MATH_STANDALONE42 43#endif // BOOST_MATH_TOOLS_THROW_EXCEPTION_HPP44