fixing stuff
[dyninst.git] / dynutil / h / dyn_detail / boost / throw_exception.hpp
1 #ifndef DYN_DETAIL_BOOST_THROW_EXCEPTION_HPP_INCLUDED
2 #define DYN_DETAIL_BOOST_THROW_EXCEPTION_HPP_INCLUDED
3
4 // MS compatible compilers support #pragma once
5
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
7 # pragma once
8 #endif
9
10 //
11 //  boost/throw_exception.hpp
12 //
13 //  Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
14 //  Copyright (c) 2008 Emil Dotchevski and Reverge Studios, Inc.
15 //
16 //  Distributed under the Boost Software License, Version 1.0. (See
17 //  accompanying file LICENSE_1_0.txt or copy at
18 //  http://www.boost.org/LICENSE_1_0.txt)
19 //
20 //  http://www.boost.org/libs/utility/throw_exception.html
21 //
22
23 #include <dyn_detail/boost/config.hpp>
24 #include <dyn_detail/boost/detail/workaround.hpp>
25 #include <exception>
26
27 #if !defined( DYN_DETAIL_BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && DYN_DETAIL_BOOST_WORKAROUND( __BORLANDC__, DYN_DETAIL_BOOST_TESTED_AT(0x593) )
28 # define DYN_DETAIL_BOOST_EXCEPTION_DISABLE
29 #endif
30
31 #if !defined( DYN_DETAIL_BOOST_EXCEPTION_DISABLE ) && defined( DYN_DETAIL_BOOST_MSVC ) && DYN_DETAIL_BOOST_WORKAROUND( DYN_DETAIL_BOOST_MSVC, < 1310 )
32 # define DYN_DETAIL_BOOST_EXCEPTION_DISABLE
33 #endif
34
35 #if !defined( DYN_DETAIL_BOOST_NO_EXCEPTIONS ) && !defined( DYN_DETAIL_BOOST_EXCEPTION_DISABLE )
36 #include <dyn_detail/boost/exception/exception.hpp>
37 #include <dyn_detail/boost/current_function.hpp>
38 # define DYN_DETAIL_BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(::boost::enable_error_info(x) <<\
39     ::boost::throw_function(DYN_DETAIL_BOOST_CURRENT_FUNCTION) <<\
40     ::boost::throw_file(__FILE__) <<\
41     ::boost::throw_line((int)__LINE__))
42 #else
43 # define DYN_DETAIL_BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x)
44 #endif
45 namespace dyn_detail
46 {
47   
48 namespace boost
49 {
50
51 #ifdef DYN_DETAIL_BOOST_NO_EXCEPTIONS
52
53 void throw_exception( std::exception const & e ); // user defined
54
55 #else
56
57 inline void throw_exception_assert_compatibility( std::exception const & ) { }
58
59 template<class E> inline void throw_exception( E const & e )
60 {
61     //All boost exceptions are required to derive std::exception,
62     //to ensure compatibility with DYN_DETAIL_BOOST_NO_EXCEPTIONS.
63     throw_exception_assert_compatibility(e);
64
65 #ifndef DYN_DETAIL_BOOST_EXCEPTION_DISABLE
66     throw enable_current_exception(enable_error_info(e));
67 #else
68     throw e;
69 #endif
70 }
71
72 #endif
73
74 } // namespace boost
75 } // namespace dyn_detail
76
77 #endif // #ifndef DYN_DETAIL_BOOST_THROW_EXCEPTION_HPP_INCLUDED