replace ::cast_dynamic() with relevant ActionManager::get_*_action() calls
[ardour.git] / tools / boost-1.55-ptr-debug.patch
1 --- /usr/include/boost/smart_ptr/shared_ptr.hpp.orig    2016-01-15 11:54:21.423304649 -0500
2 +++ /usr/include/boost/smart_ptr/shared_ptr.hpp 2016-01-15 12:27:20.324047643 -0500
3 @@ -52,6 +52,13 @@
4  #endif
5  #endif
6  
7 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
8 +void boost_debug_shared_ptr_operator_equals (void const *, void const *, int, void const*, int);
9 +void boost_debug_shared_ptr_reset (void const *, void const *, int, void const*, int);
10 +void boost_debug_shared_ptr_destructor (void const *, void const *, int);
11 +void boost_debug_shared_ptr_constructor (void const *, void const *, int);
12 +#endif
13 +
14  namespace boost
15  {
16  
17 @@ -275,20 +282,29 @@
18  {
19      boost::detail::shared_count( p ).swap( pn );
20      boost::detail::sp_enable_shared_from_this( ppx, p, p );
21 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
22 +    boost_debug_shared_ptr_constructor (ppx, ppx->get(), ppx->use_count());
23 +#endif
24  }
25  
26  #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
27  
28 -template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * p, boost::detail::shared_count & pn )
29 +template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[] > * ppx, Y * p, boost::detail::shared_count & pn )
30  {
31      sp_assert_convertible< Y[], T[] >();
32      boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn );
33 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
34 +    /* no code for this yet - shared_ptr to array of T */
35 +#endif
36  }
37  
38  template< class T, std::size_t N, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * p, boost::detail::shared_count & pn )
39  {
40      sp_assert_convertible< Y[N], T[N] >();
41      boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn );
42 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
43 +    /* no code for this yet - shared_ptr to array of T */
44 +#endif
45  }
46  
47  #endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
48 @@ -298,6 +314,9 @@
49  template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T > * ppx, Y * p )
50  {
51      boost::detail::sp_enable_shared_from_this( ppx, p, p );
52 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
53 +    boost_debug_shared_ptr_constructor (ppx, ppx->get(), ppx->use_count());
54 +#endif
55  }
56  
57  #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
58 @@ -305,11 +324,17 @@
59  template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * /*p*/ )
60  {
61      sp_assert_convertible< Y[], T[] >();
62 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
63 +    /* no code for this yet - shared_ptr to array of T */
64 +#endif
65  }
66  
67  template< class T, std::size_t N, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * /*p*/ )
68  {
69      sp_assert_convertible< Y[N], T[N] >();
70 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
71 +    /* no code for this yet - shared_ptr to array of T */
72 +#endif
73  }
74  
75  #endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
76 @@ -338,12 +363,20 @@
77  
78      shared_ptr() BOOST_NOEXCEPT : px( 0 ), pn() // never throws in 1.30+
79      {
80 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
81 +       /* default constructor case */
82 +       boost_debug_shared_ptr_constructor (this, px, use_count());
83 +#endif
84      }
85  
86  #if !defined( BOOST_NO_CXX11_NULLPTR )
87  
88      shared_ptr( boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT : px( 0 ), pn() // never throws
89      {
90 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
91 +       /* explicit nullptr constructor case */
92 +       boost_debug_shared_ptr_constructor (this, px, use_count());
93 +#endif
94      }
95  
96  #endif
97 @@ -384,11 +417,23 @@
98  
99      template<class D, class A> shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a )
100      {
101 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
102 +       boost_debug_shared_ptr_constructor (this, px, use_count());
103 +#endif
104      }
105  
106  #endif
107  
108 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
109 +    ~shared_ptr() {
110 +       boost_debug_shared_ptr_destructor (this, get(), use_count());
111 +    }
112 +    shared_ptr(const shared_ptr<T>& r ) : px (r.px), pn (r.pn) {
113 +           boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
114 +    }
115 +#else
116  //  generated copy constructor, destructor are fine...
117 +#endif /* BOOST_SP_ENABLE_DEBUG_HOOKS */
118  
119  #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
120  
121 @@ -396,6 +441,9 @@
122  
123      shared_ptr( shared_ptr const & r ) BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
124      {
125 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
126 +       boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
127 +#endif
128      }
129  
130  #endif
131 @@ -405,6 +453,9 @@
132      {
133          boost::detail::sp_assert_convertible< Y, T >();
134  
135 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
136 +       boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.px, -1);
137 +#endif
138          // it is now safe to copy r.px, as pn(r.pn) did not throw
139          px = r.px;
140      }
141 @@ -415,6 +466,9 @@
142      {
143          if( !pn.empty() )
144          {
145 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
146 +       boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.px, -1);
147 +#endif
148              px = r.px;
149          }
150      }
151 @@ -432,6 +486,9 @@
152      BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
153      {
154          boost::detail::sp_assert_convertible< Y, T >();
155 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
156 +       boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
157 +#endif
158      }
159  
160      // aliasing
161 @@ -513,6 +570,9 @@
162      template<class Y>
163      shared_ptr & operator=(shared_ptr<Y> const & r) BOOST_NOEXCEPT
164      {
165 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
166 +       boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
167 +#endif
168          this_type(r).swap(*this);
169          return *this;
170      }
171 @@ -524,6 +584,9 @@
172      template<class Y>
173      shared_ptr & operator=( std::auto_ptr<Y> & r )
174      {
175 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
176 +       boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
177 +#endif
178          this_type( r ).swap( *this );
179          return *this;
180      }
181 @@ -533,6 +596,9 @@
182      template<class Y>
183      shared_ptr & operator=( std::auto_ptr<Y> && r )
184      {
185 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
186 +       boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
187 +#endif
188          this_type( static_cast< std::auto_ptr<Y> && >( r ) ).swap( *this );
189          return *this;
190      }
191 @@ -555,6 +621,9 @@
192      template<class Y, class D>
193      shared_ptr & operator=( std::unique_ptr<Y, D> && r )
194      {
195 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
196 +       boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
197 +#endif
198          this_type( static_cast< std::unique_ptr<Y, D> && >( r ) ).swap(*this);
199          return *this;
200      }
201 @@ -567,6 +636,9 @@
202  
203      shared_ptr( shared_ptr && r ) BOOST_NOEXCEPT : px( r.px ), pn()
204      {
205 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
206 +       boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
207 +#endif
208          pn.swap( r.pn );
209          r.px = 0;
210      }
211 @@ -585,12 +657,18 @@
212      {
213          boost::detail::sp_assert_convertible< Y, T >();
214  
215 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
216 +       boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
217 +#endif
218          pn.swap( r.pn );
219          r.px = 0;
220      }
221  
222      shared_ptr & operator=( shared_ptr && r ) BOOST_NOEXCEPT
223      {
224 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
225 +       boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
226 +#endif
227          this_type( static_cast< shared_ptr && >( r ) ).swap( *this );
228          return *this;
229      }
230 @@ -598,6 +676,9 @@
231      template<class Y>
232      shared_ptr & operator=( shared_ptr<Y> && r ) BOOST_NOEXCEPT
233      {
234 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
235 +       boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
236 +#endif
237          this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );
238          return *this;
239      }
240 @@ -608,6 +689,9 @@
241  
242      shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT // never throws
243      {
244 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
245 +       boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
246 +#endif
247          this_type().swap(*this);
248          return *this;
249      }
250 @@ -616,27 +700,42 @@
251  
252      void reset() BOOST_NOEXCEPT // never throws in 1.30+
253      {
254 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
255 +       boost_debug_shared_ptr_reset (this, get(), use_count(), 0, 0);
256 +#endif
257          this_type().swap(*this);
258      }
259  
260      template<class Y> void reset( Y * p ) // Y must be complete
261      {
262          BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors
263 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
264 +       boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
265 +#endif
266          this_type( p ).swap( *this );
267      }
268  
269      template<class Y, class D> void reset( Y * p, D d )
270      {
271 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
272 +       boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
273 +#endif
274          this_type( p, d ).swap( *this );
275      }
276  
277      template<class Y, class D, class A> void reset( Y * p, D d, A a )
278      {
279 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
280 +       boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
281 +#endif
282          this_type( p, d, a ).swap( *this );
283      }
284  
285      template<class Y> void reset( shared_ptr<Y> const & r, element_type * p )
286      {
287 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
288 +           boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
289 +#endif
290          this_type( r, p ).swap( *this );
291      }
292