1///////////////////////////////////////////////////////////////////////////////
2// Copyright 2004 - 2021 Pavel Vozenilek.
3// Copyright 2021 Matt Borland. Distributed under the Boost
4// Software License, Version 1.0. (See accompanying file
5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7#ifndef BOOST_MP_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP
8#define BOOST_MP_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP
9
10#include <boost/multiprecision/detail/standalone_config.hpp>
11
12#ifdef BOOST_MP_STANDALONE
13
14#ifndef BOOST_NO_EXCEPTIONS
15# define BOOST_MP_TRY { try
16# define BOOST_MP_CATCH(x) catch(x)
17# define BOOST_MP_RETHROW throw;
18# define BOOST_MP_CATCH_END }
19# define BOOST_MP_THROW_EXCEPTION(x) throw (x);
20#else
21# if !defined(BOOST_MSVC) || BOOST_MSVC >= 1900
22# define BOOST_MP_TRY { if (true)
23# define BOOST_MP_CATCH(x) else if (false)
24# else
25 // warning C4127: conditional expression is constant
26# define BOOST_MP_TRY { \
27 __pragma(warning(push)) \
28 __pragma(warning(disable: 4127)) \
29 if (true) \
30 __pragma(warning(pop))
31# define BOOST_MP_CATCH(x) else \
32 __pragma(warning(push)) \
33 __pragma(warning(disable: 4127)) \
34 if (false) \
35 __pragma(warning(pop))
36# endif
37# define BOOST_MP_RETHROW
38# define BOOST_MP_CATCH_END }
39# define BOOST_MP_THROW_EXCEPTION(x) {static_cast<void>(x);}
40#endif
41
42#else // Not standalone mode
43
44# include <boost/core/no_exceptions_support.hpp>
45# include <boost/throw_exception.hpp>
46
47# define BOOST_MP_TRY BOOST_TRY
48# define BOOST_MP_CATCH(x) BOOST_CATCH(x)
49# define BOOST_MP_RETHROW BOOST_RETHROW
50# define BOOST_MP_CATCH_END BOOST_CATCH_END
51# define BOOST_MP_THROW_EXCEPTION(x) BOOST_THROW_EXCEPTION(x)
52
53#endif // BOOST_MP_STANDALONE
54
55#endif // BOOST_MP_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP
56

source code of boost/libs/multiprecision/include/boost/multiprecision/detail/no_exceptions_support.hpp