File: boost-ptr-debug.patch

package info (click to toggle)
ardour 1:5.12.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 74,708 kB
  • sloc: cpp: 512,951; xml: 123,656; ansic: 65,010; python: 22,599; sh: 5,368; asm: 1,347; perl: 888; php: 770; makefile: 253; objc: 28
file content (275 lines) | stat: -rw-r--r-- 8,173 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
--- shared_ptr.hpp.clean	2014-03-12 10:32:10.054102239 -0400
+++ shared_ptr.hpp	2014-03-12 10:34:09.413172291 -0400
@@ -51,6 +51,13 @@
 #endif
 #endif
 
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+void boost_debug_shared_ptr_operator_equals (void const *, void const *, int, void const*, int);
+void boost_debug_shared_ptr_reset (void const *, void const *, int, void const*, int);
+void boost_debug_shared_ptr_destructor (void const *, void const *, int);
+void boost_debug_shared_ptr_constructor (void const *, void const *, int);
+#endif
+
 namespace boost
 {
 
@@ -177,12 +184,31 @@
 
     shared_ptr(): px(0), pn() // never throws in 1.30+
     {
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+        boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
+    }
+
+    ~shared_ptr()
+    {
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+	boost_debug_shared_ptr_destructor (this, get(), use_count()); 
+#endif
+    }
+
+    shared_ptr(const shared_ptr<T>& r ) : px (r.px), pn (r.pn) {
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+	    boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
     }
 
     template<class Y>
     explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete
     {
         boost::detail::sp_enable_shared_from_this( this, p, p );
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+        boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
     }
 
     //
@@ -193,7 +219,10 @@
 
     template<class Y, class D> shared_ptr(Y * p, D d): px(p), pn(p, d)
     {
-        boost::detail::sp_enable_shared_from_this( this, p, p );
+        boost::detail::sp_enable_shared_from_this( this, p, p );        
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+	boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
     }
 
     // As above, but with allocator. A's copy constructor shall not throw.
@@ -201,6 +230,9 @@
     template<class Y, class D, class A> shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a )
     {
         boost::detail::sp_enable_shared_from_this( this, p, p );
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+        boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
     }
 
 //  generated copy constructor, destructor are fine...
@@ -220,6 +252,9 @@
     {
         // it is now safe to copy r.px, as pn(r.pn) did not throw
         px = r.px;
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+        boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
     }
 
     template<class Y>
@@ -229,6 +264,9 @@
         {
             px = r.px;
         }
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+        boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
     }
 
     template<class Y>
@@ -243,22 +281,34 @@
 #endif
     : px( r.px ), pn( r.pn ) // never throws
     {
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+        boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
     }
 
     // aliasing
     template< class Y >
     shared_ptr( shared_ptr<Y> const & r, T * p ): px( p ), pn( r.pn ) // never throws
     {
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+        boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
     }
 
     template<class Y>
     shared_ptr(shared_ptr<Y> const & r, boost::detail::static_cast_tag): px(static_cast<element_type *>(r.px)), pn(r.pn)
     {
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+        boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
     }
 
     template<class Y>
     shared_ptr(shared_ptr<Y> const & r, boost::detail::const_cast_tag): px(const_cast<element_type *>(r.px)), pn(r.pn)
     {
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+        boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
     }
 
     template<class Y>
@@ -268,6 +318,9 @@
         {
             pn = boost::detail::shared_count();
         }
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+        boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
     }
 
     template<class Y>
@@ -277,6 +330,9 @@
         {
             boost::throw_exception(std::bad_cast());
         }
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+        boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
     }
 
 #ifndef BOOST_NO_AUTO_PTR
@@ -287,6 +343,9 @@
         Y * tmp = r.get();
         pn = boost::detail::shared_count(r);
         boost::detail::sp_enable_shared_from_this( this, tmp, tmp );
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+        boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
     }
 
 #if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
@@ -297,6 +356,9 @@
         typename Ap::element_type * tmp = r.get();
         pn = boost::detail::shared_count( r );
         boost::detail::sp_enable_shared_from_this( this, tmp, tmp );
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+        boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
     }
 
 
@@ -308,6 +370,9 @@
 
     shared_ptr & operator=( shared_ptr const & r ) // never throws
     {
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+	boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
+#endif
         this_type(r).swap(*this);
         return *this;
     }
@@ -317,6 +382,9 @@
     template<class Y>
     shared_ptr & operator=(shared_ptr<Y> const & r) // never throws
     {
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+	boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
+#endif
         this_type(r).swap(*this);
         return *this;
     }
@@ -328,6 +396,9 @@
     template<class Y>
     shared_ptr & operator=( std::auto_ptr<Y> & r )
     {
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+        boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
+#endif
         this_type(r).swap(*this);
         return *this;
     }
@@ -354,6 +425,9 @@
     {
         pn.swap( r.pn );
         r.px = 0;
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+        boost_debug_shared_ptr_constructor (this, px, use_count());
+#endif
     }
 
     template<class Y>
@@ -370,10 +444,16 @@
     {
         pn.swap( r.pn );
         r.px = 0;
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++	    boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
     }
 
     shared_ptr & operator=( shared_ptr && r ) // never throws
     {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++	    boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
         this_type( static_cast< shared_ptr && >( r ) ).swap( *this );
         return *this;
     }
@@ -381,6 +461,9 @@
     template<class Y>
     shared_ptr & operator=( shared_ptr<Y> && r ) // never throws
     {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++	    boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
         this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );
         return *this;
     }
@@ -389,27 +472,42 @@
 
     void reset() // never throws in 1.30+
     {
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+	    boost_debug_shared_ptr_reset (this, get(), use_count(), 0, 0);
+#endif
         this_type().swap(*this);
     }
 
     template<class Y> void reset(Y * p) // Y must be complete
     {
         BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+	boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
+#endif
         this_type(p).swap(*this);
     }
 
     template<class Y, class D> void reset( Y * p, D d )
     {
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+	    boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
+#endif
         this_type( p, d ).swap( *this );
     }
 
     template<class Y, class D, class A> void reset( Y * p, D d, A a )
     {
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+	    boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
+#endif
         this_type( p, d, a ).swap( *this );
     }
 
     template<class Y> void reset( shared_ptr<Y> const & r, T * p )
     {
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+	    boost_debug_shared_ptr_reset (this, get(), use_count(), r.get(), r.use_count());
+#endif
         this_type( r, p ).swap( *this );
     }