Coverage Report

Created: 2026-04-01 06:58

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/Fast-DDS/thirdparty/boost/include/boost/throw_exception.hpp
Line
Count
Source
1
#ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED
2
#define 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, 2018, 2019 Peter Dimov
14
//  Copyright (c) 2008-2009 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/throw_exception
21
//
22
23
#include <boost/assert/source_location.hpp>
24
#include <boost/config.hpp>
25
#include <boost/config/workaround.hpp>
26
#include <exception>
27
28
#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x593) )
29
# define BOOST_EXCEPTION_DISABLE
30
#endif
31
32
namespace boost
33
{
34
35
// All boost exceptions are required to derive from std::exception,
36
// to ensure compatibility with BOOST_NO_EXCEPTIONS.
37
38
0
inline void throw_exception_assert_compatibility( std::exception const & ) {}
39
40
} // namespace boost
41
42
#if defined( BOOST_NO_EXCEPTIONS )
43
44
namespace boost
45
{
46
47
BOOST_NORETURN void throw_exception( std::exception const & e ); // user defined
48
BOOST_NORETURN void throw_exception( std::exception const & e, boost::source_location const & loc ); // user defined
49
50
} // namespace boost
51
52
#elif defined( BOOST_EXCEPTION_DISABLE )
53
54
namespace boost
55
{
56
57
template<class E> BOOST_NORETURN void throw_exception( E const & e )
58
{
59
    throw_exception_assert_compatibility( e );
60
    throw e;
61
}
62
63
template<class E> BOOST_NORETURN void throw_exception( E const & e, boost::source_location const & )
64
{
65
    throw_exception_assert_compatibility( e );
66
    throw e;
67
}
68
69
} // namespace boost
70
71
#else // !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE )
72
73
#include <boost/exception/exception.hpp>
74
75
namespace boost
76
{
77
78
// boost::wrapexcept<E>
79
80
namespace detail
81
{
82
83
typedef char (&wrapexcept_s1)[ 1 ];
84
typedef char (&wrapexcept_s2)[ 2 ];
85
86
template<class T> wrapexcept_s1 wrapexcept_is_convertible( T* );
87
template<class T> wrapexcept_s2 wrapexcept_is_convertible( void* );
88
89
template<class E, class B, int I = sizeof( wrapexcept_is_convertible<B>( static_cast< E* >( 0 ) ) ) > struct wrapexcept_add_base;
90
91
template<class E, class B> struct wrapexcept_add_base<E, B, 1>
92
{
93
    struct type {};
94
};
95
96
template<class E, class B> struct wrapexcept_add_base<E, B, 2>
97
{
98
    typedef B type;
99
};
100
101
} // namespace detail
102
103
template<class E> struct BOOST_SYMBOL_VISIBLE wrapexcept:
104
    public detail::wrapexcept_add_base<E, boost::exception_detail::clone_base>::type,
105
    public E,
106
    public detail::wrapexcept_add_base<E, boost::exception>::type
107
{
108
private:
109
110
    struct deleter
111
    {
112
        wrapexcept * p_;
113
0
        ~deleter() { delete p_; }
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_year>::deleter::~deleter()
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_month>::deleter::~deleter()
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_day_of_month>::deleter::~deleter()
Unexecuted instantiation: boost::wrapexcept<std::runtime_error>::deleter::~deleter()
114
    };
115
116
private:
117
118
    void copy_from( void const* )
119
0
    {
120
0
    }
Unexecuted instantiation: boost::wrapexcept<boost::bad_weak_ptr>::copy_from(void const*)
Unexecuted instantiation: boost::wrapexcept<std::runtime_error>::copy_from(void const*)
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_weekday>::copy_from(void const*)
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_year>::copy_from(void const*)
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_month>::copy_from(void const*)
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_day_of_month>::copy_from(void const*)
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_day_of_year>::copy_from(void const*)
121
122
    void copy_from( boost::exception const* p )
123
    {
124
        static_cast<boost::exception&>( *this ) = *p;
125
    }
126
127
public:
128
129
0
    explicit wrapexcept( E const & e ): E( e )
130
0
    {
131
0
        copy_from( &e );
132
0
    }
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_year>::wrapexcept(boost::gregorian::bad_year const&)
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_month>::wrapexcept(boost::gregorian::bad_month const&)
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_day_of_month>::wrapexcept(boost::gregorian::bad_day_of_month const&)
Unexecuted instantiation: boost::wrapexcept<std::runtime_error>::wrapexcept(std::runtime_error const&)
133
134
    explicit wrapexcept( E const & e, boost::source_location const & loc ): E( e )
135
    {
136
        copy_from( &e );
137
138
        set_info( *this, throw_file( loc.file_name() ) );
139
        set_info( *this, throw_line( loc.line() ) );
140
        set_info( *this, throw_function( loc.function_name() ) );
141
    }
142
143
    virtual boost::exception_detail::clone_base const * clone() const
144
0
    {
145
0
        wrapexcept * p = new wrapexcept( *this );
146
0
        deleter del = { p };
147
148
0
        boost::exception_detail::copy_boost_exception( p, this );
149
150
0
        del.p_ = 0;
151
0
        return p;
152
0
    }
Unexecuted instantiation: boost::wrapexcept<boost::bad_weak_ptr>::clone() const
Unexecuted instantiation: boost::wrapexcept<std::runtime_error>::clone() const
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_weekday>::clone() const
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_year>::clone() const
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_month>::clone() const
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_day_of_month>::clone() const
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_day_of_year>::clone() const
153
154
    virtual void rethrow() const
155
0
    {
156
0
        throw *this;
157
0
    }
Unexecuted instantiation: boost::wrapexcept<boost::bad_weak_ptr>::rethrow() const
Unexecuted instantiation: boost::wrapexcept<std::runtime_error>::rethrow() const
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_weekday>::rethrow() const
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_year>::rethrow() const
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_month>::rethrow() const
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_day_of_month>::rethrow() const
Unexecuted instantiation: boost::wrapexcept<boost::gregorian::bad_day_of_year>::rethrow() const
158
};
159
160
// boost::throw_exception
161
162
template<class E> BOOST_NORETURN void throw_exception( E const & e )
163
0
{
164
0
    throw_exception_assert_compatibility( e );
165
0
    throw wrapexcept<E>( e );
166
0
}
Unexecuted instantiation: void boost::throw_exception<boost::bad_weak_ptr>(boost::bad_weak_ptr const&)
Unexecuted instantiation: void boost::throw_exception<std::runtime_error>(std::runtime_error const&)
Unexecuted instantiation: void boost::throw_exception<boost::gregorian::bad_weekday>(boost::gregorian::bad_weekday const&)
Unexecuted instantiation: void boost::throw_exception<boost::gregorian::bad_year>(boost::gregorian::bad_year const&)
Unexecuted instantiation: void boost::throw_exception<boost::gregorian::bad_month>(boost::gregorian::bad_month const&)
Unexecuted instantiation: void boost::throw_exception<boost::gregorian::bad_day_of_month>(boost::gregorian::bad_day_of_month const&)
Unexecuted instantiation: void boost::throw_exception<boost::gregorian::bad_day_of_year>(boost::gregorian::bad_day_of_year const&)
167
168
template<class E> BOOST_NORETURN void throw_exception( E const & e, boost::source_location const & loc )
169
{
170
    throw_exception_assert_compatibility( e );
171
    throw wrapexcept<E>( e, loc );
172
}
173
174
} // namespace boost
175
176
#endif
177
178
// BOOST_THROW_EXCEPTION
179
180
#define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x, BOOST_CURRENT_LOCATION)
181
182
#endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED