throw_exception.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // (C) Copyright Matt Borland 2021.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_MATH_TOOLS_THROW_EXCEPTION_HPP
  6. #define BOOST_MATH_TOOLS_THROW_EXCEPTION_HPP
  7. #include <boost/math/tools/is_standalone.hpp>
  8. #ifndef BOOST_MATH_STANDALONE
  9. #if defined(_MSC_VER) || defined(__GNUC__)
  10. # pragma push_macro( "I" )
  11. # undef I
  12. #endif
  13. #include <boost/throw_exception.hpp>
  14. #define BOOST_MATH_THROW_EXCEPTION(expr) boost::throw_exception(expr);
  15. #if defined(_MSC_VER) || defined(__GNUC__)
  16. # pragma pop_macro( "I" )
  17. #endif
  18. #else // Standalone mode - use standard library facilities
  19. #ifdef _MSC_VER
  20. # ifdef _CPPUNWIND
  21. # define BOOST_MATH_THROW_EXCEPTION(expr) throw expr;
  22. # else
  23. # define BOOST_MATH_THROW_EXCEPTION(expr)
  24. # endif
  25. #else
  26. # ifdef __EXCEPTIONS
  27. # define BOOST_MATH_THROW_EXCEPTION(expr) throw expr;
  28. # else
  29. # define BOOST_MATH_THROW_EXCEPTION(expr)
  30. # endif
  31. #endif
  32. #endif // BOOST_MATH_STANDALONE
  33. #endif // BOOST_MATH_TOOLS_THROW_EXCEPTION_HPP