1 |
dev-zero 08/01/24 12:47:19 |
2 |
|
3 |
Added: 05_all_1.34.1-function.patch |
4 |
06_all_1.34.1-gcc43_regex-include.patch |
5 |
07_all_1.34.1-CVE-2008-0171_and_0172.patch |
6 |
Log: |
7 |
Added boost patchset |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 src/patchsets/boost/1.34.1/patches/05_all_1.34.1-function.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/boost/1.34.1/patches/05_all_1.34.1-function.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/boost/1.34.1/patches/05_all_1.34.1-function.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: 05_all_1.34.1-function.patch |
16 |
=================================================================== |
17 |
diff -Naur boost_1_34_1.orig/boost/function/function_base.hpp boost_1_34_1/boost/function/function_base.hpp |
18 |
--- boost_1_34_1.orig/boost/function/function_base.hpp 2006-10-13 16:29:45.000000000 +0200 |
19 |
+++ boost_1_34_1/boost/function/function_base.hpp 2007-12-21 14:45:15.000000000 +0100 |
20 |
@@ -15,6 +15,7 @@ |
21 |
#include <memory> |
22 |
#include <new> |
23 |
#include <typeinfo> |
24 |
+#include <functional> // unary_function, binary_function |
25 |
#include <boost/config.hpp> |
26 |
#include <boost/assert.hpp> |
27 |
#include <boost/type_traits/is_integral.hpp> |
28 |
@@ -30,6 +31,20 @@ |
29 |
#endif |
30 |
#include <boost/function_equal.hpp> |
31 |
|
32 |
+#if defined(BOOST_MSVC) |
33 |
+# pragma warning( push ) |
34 |
+# pragma warning( disable : 4793 ) // complaint about native code generation |
35 |
+# pragma warning( disable : 4127 ) // "conditional expression is constant" |
36 |
+#endif |
37 |
+ |
38 |
+// Define BOOST_FUNCTION_STD_NS to the namespace that contains type_info. |
39 |
+#ifdef BOOST_NO_EXCEPTION_STD_NAMESPACE |
40 |
+// Embedded VC++ does not have type_info in namespace std |
41 |
+# define BOOST_FUNCTION_STD_NS |
42 |
+#else |
43 |
+# define BOOST_FUNCTION_STD_NS std |
44 |
+#endif |
45 |
+ |
46 |
// Borrowed from Boost.Python library: determines the cases where we |
47 |
// need to use std::type_info::name to compare instead of operator==. |
48 |
# if (defined(__GNUC__) && __GNUC__ >= 3) \ |
49 |
@@ -59,7 +74,7 @@ |
50 |
|
51 |
#if defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ |
52 |
|| defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \ |
53 |
- || !(BOOST_STRICT_CONFIG || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540) |
54 |
+ || !(defined(BOOST_STRICT_CONFIG) || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540) |
55 |
# define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX |
56 |
#endif |
57 |
|
58 |
@@ -198,8 +213,8 @@ |
59 |
struct reference_manager |
60 |
{ |
61 |
static inline void |
62 |
- get(const function_buffer& in_buffer, function_buffer& out_buffer, |
63 |
- functor_manager_operation_type op) |
64 |
+ manage(const function_buffer& in_buffer, function_buffer& out_buffer, |
65 |
+ functor_manager_operation_type op) |
66 |
{ |
67 |
switch (op) { |
68 |
case clone_functor_tag: |
69 |
@@ -215,8 +230,8 @@ |
70 |
// DPG TBD: Since we're only storing a pointer, it's |
71 |
// possible that the user could ask for a base class or |
72 |
// derived class. Is that okay? |
73 |
- const std::type_info& check_type = |
74 |
- *static_cast<const std::type_info*>(out_buffer.const_obj_ptr); |
75 |
+ const BOOST_FUNCTION_STD_NS::type_info& check_type = |
76 |
+ *static_cast<const BOOST_FUNCTION_STD_NS::type_info*>(out_buffer.const_obj_ptr); |
77 |
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(F))) |
78 |
out_buffer.obj_ptr = in_buffer.obj_ptr; |
79 |
else |
80 |
@@ -265,8 +280,8 @@ |
81 |
else if (op == destroy_functor_tag) |
82 |
out_buffer.func_ptr = 0; |
83 |
else /* op == check_functor_type_tag */ { |
84 |
- const std::type_info& check_type = |
85 |
- *static_cast<const std::type_info*>(out_buffer.const_obj_ptr); |
86 |
+ const BOOST_FUNCTION_STD_NS::type_info& check_type = |
87 |
+ *static_cast<const BOOST_FUNCTION_STD_NS::type_info*>(out_buffer.const_obj_ptr); |
88 |
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor))) |
89 |
out_buffer.obj_ptr = &in_buffer.func_ptr; |
90 |
else |
91 |
@@ -287,8 +302,8 @@ |
92 |
// Some compilers (Borland, vc6, ...) are unhappy with ~functor_type. |
93 |
reinterpret_cast<functor_type*>(&out_buffer.data)->~Functor(); |
94 |
} else /* op == check_functor_type_tag */ { |
95 |
- const std::type_info& check_type = |
96 |
- *static_cast<const std::type_info*>(out_buffer.const_obj_ptr); |
97 |
+ const BOOST_FUNCTION_STD_NS::type_info& check_type = |
98 |
+ *static_cast<const BOOST_FUNCTION_STD_NS::type_info*>(out_buffer.const_obj_ptr); |
99 |
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor))) |
100 |
out_buffer.obj_ptr = &in_buffer.data; |
101 |
else |
102 |
@@ -348,8 +363,8 @@ |
103 |
# endif // BOOST_NO_STD_ALLOCATOR |
104 |
out_buffer.obj_ptr = 0; |
105 |
} else /* op == check_functor_type_tag */ { |
106 |
- const std::type_info& check_type = |
107 |
- *static_cast<const std::type_info*>(out_buffer.const_obj_ptr); |
108 |
+ const BOOST_FUNCTION_STD_NS::type_info& check_type = |
109 |
+ *static_cast<const BOOST_FUNCTION_STD_NS::type_info*>(out_buffer.const_obj_ptr); |
110 |
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor))) |
111 |
out_buffer.obj_ptr = in_buffer.obj_ptr; |
112 |
else |
113 |
@@ -368,6 +383,15 @@ |
114 |
mpl::bool_<(function_allows_small_object_optimization<functor_type>::value)>()); |
115 |
} |
116 |
|
117 |
+ // For member pointers, we treat them as function objects with |
118 |
+ // the small-object optimization always enabled. |
119 |
+ static inline void |
120 |
+ manager(const function_buffer& in_buffer, function_buffer& out_buffer, |
121 |
+ functor_manager_operation_type op, member_ptr_tag) |
122 |
+ { |
123 |
+ manager(in_buffer, out_buffer, op, mpl::true_()); |
124 |
+ } |
125 |
+ |
126 |
public: |
127 |
/* Dispatch to an appropriate manager based on whether we have a |
128 |
function pointer or a function object pointer. */ |
129 |
@@ -456,7 +480,6 @@ |
130 |
*/ |
131 |
struct vtable_base |
132 |
{ |
133 |
- vtable_base() : manager(0) { } |
134 |
void (*manager)(const function_buffer& in_buffer, |
135 |
function_buffer& out_buffer, |
136 |
functor_manager_operation_type op); |
137 |
@@ -480,13 +503,13 @@ |
138 |
|
139 |
/** Retrieve the type of the stored function object, or typeid(void) |
140 |
if this is empty. */ |
141 |
- const std::type_info& target_type() const |
142 |
+ const BOOST_FUNCTION_STD_NS::type_info& target_type() const |
143 |
{ |
144 |
if (!vtable) return typeid(void); |
145 |
|
146 |
detail::function::function_buffer type; |
147 |
vtable->manager(functor, type, detail::function::get_functor_type_tag); |
148 |
- return *static_cast<const std::type_info*>(type.const_obj_ptr); |
149 |
+ return *static_cast<const BOOST_FUNCTION_STD_NS::type_info*>(type.const_obj_ptr); |
150 |
} |
151 |
|
152 |
template<typename Functor> |
153 |
@@ -558,7 +581,7 @@ |
154 |
#endif |
155 |
|
156 |
public: // should be protected, but GCC 2.95.3 will fail to allow access |
157 |
- detail::function::vtable_base* vtable; |
158 |
+ const detail::function::vtable_base* vtable; |
159 |
mutable detail::function::function_buffer functor; |
160 |
}; |
161 |
|
162 |
@@ -733,4 +756,8 @@ |
163 |
#undef BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL |
164 |
#undef BOOST_FUNCTION_COMPARE_TYPE_ID |
165 |
|
166 |
+#if defined(BOOST_MSVC) |
167 |
+# pragma warning( pop ) |
168 |
+#endif |
169 |
+ |
170 |
#endif // BOOST_FUNCTION_BASE_HEADER |
171 |
diff -Naur boost_1_34_1.orig/boost/function/function_template.hpp boost_1_34_1/boost/function/function_template.hpp |
172 |
--- boost_1_34_1.orig/boost/function/function_template.hpp 2006-09-29 19:23:28.000000000 +0200 |
173 |
+++ boost_1_34_1/boost/function/function_template.hpp 2007-12-19 15:13:28.000000000 +0100 |
174 |
@@ -11,6 +11,11 @@ |
175 |
// protection. |
176 |
#include <boost/function/detail/prologue.hpp> |
177 |
|
178 |
+#if defined(BOOST_MSVC) |
179 |
+# pragma warning( push ) |
180 |
+# pragma warning( disable : 4127 ) // "conditional expression is constant" |
181 |
+#endif |
182 |
+ |
183 |
#define BOOST_FUNCTION_TEMPLATE_PARMS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, typename T) |
184 |
|
185 |
#define BOOST_FUNCTION_TEMPLATE_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, T) |
186 |
@@ -54,12 +59,20 @@ |
187 |
BOOST_JOIN(function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) |
188 |
#define BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER \ |
189 |
BOOST_JOIN(void_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) |
190 |
+#define BOOST_FUNCTION_MEMBER_INVOKER \ |
191 |
+ BOOST_JOIN(member_invoker,BOOST_FUNCTION_NUM_ARGS) |
192 |
+#define BOOST_FUNCTION_VOID_MEMBER_INVOKER \ |
193 |
+ BOOST_JOIN(void_member_invoker,BOOST_FUNCTION_NUM_ARGS) |
194 |
#define BOOST_FUNCTION_GET_FUNCTION_INVOKER \ |
195 |
BOOST_JOIN(get_function_invoker,BOOST_FUNCTION_NUM_ARGS) |
196 |
#define BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER \ |
197 |
BOOST_JOIN(get_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) |
198 |
#define BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER \ |
199 |
BOOST_JOIN(get_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) |
200 |
+#define BOOST_FUNCTION_GET_MEMBER_INVOKER \ |
201 |
+ BOOST_JOIN(get_member_invoker,BOOST_FUNCTION_NUM_ARGS) |
202 |
+#define BOOST_FUNCTION_GET_INVOKER \ |
203 |
+ BOOST_JOIN(get_invoker,BOOST_FUNCTION_NUM_ARGS) |
204 |
#define BOOST_FUNCTION_VTABLE BOOST_JOIN(basic_vtable,BOOST_FUNCTION_NUM_ARGS) |
205 |
|
206 |
#ifndef BOOST_NO_VOID_RETURNS |
207 |
@@ -70,16 +83,6 @@ |
208 |
# define BOOST_FUNCTION_RETURN(X) X; return BOOST_FUNCTION_VOID_RETURN_TYPE () |
209 |
#endif |
210 |
|
211 |
-#ifdef BOOST_MSVC |
212 |
-# pragma warning(push) |
213 |
-# pragma warning(disable: 4127) // conditional expression is constant. |
214 |
-#endif |
215 |
- |
216 |
-#ifdef BOOST_MSVC |
217 |
-# pragma warning(push) |
218 |
-# pragma warning(disable: 4127) // conditional expression is constant. |
219 |
-#endif |
220 |
- |
221 |
namespace boost { |
222 |
namespace detail { |
223 |
namespace function { |
224 |
@@ -191,6 +194,44 @@ |
225 |
} |
226 |
}; |
227 |
|
228 |
+#if BOOST_FUNCTION_NUM_ARGS > 0 |
229 |
+ /* Handle invocation of member pointers. */ |
230 |
+ template< |
231 |
+ typename MemberPtr, |
232 |
+ typename R BOOST_FUNCTION_COMMA |
233 |
+ BOOST_FUNCTION_TEMPLATE_PARMS |
234 |
+ > |
235 |
+ struct BOOST_FUNCTION_MEMBER_INVOKER |
236 |
+ { |
237 |
+ static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA |
238 |
+ BOOST_FUNCTION_PARMS) |
239 |
+ |
240 |
+ { |
241 |
+ MemberPtr* f = |
242 |
+ reinterpret_cast<MemberPtr*>(&function_obj_ptr.data); |
243 |
+ return boost::mem_fn(*f)(BOOST_FUNCTION_ARGS); |
244 |
+ } |
245 |
+ }; |
246 |
+ |
247 |
+ template< |
248 |
+ typename MemberPtr, |
249 |
+ typename R BOOST_FUNCTION_COMMA |
250 |
+ BOOST_FUNCTION_TEMPLATE_PARMS |
251 |
+ > |
252 |
+ struct BOOST_FUNCTION_VOID_MEMBER_INVOKER |
253 |
+ { |
254 |
+ static BOOST_FUNCTION_VOID_RETURN_TYPE |
255 |
+ invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA |
256 |
+ BOOST_FUNCTION_PARMS) |
257 |
+ |
258 |
+ { |
259 |
+ MemberPtr* f = |
260 |
+ reinterpret_cast<MemberPtr*>(&function_obj_ptr.data); |
261 |
+ BOOST_FUNCTION_RETURN(boost::mem_fn(*f)(BOOST_FUNCTION_ARGS)); |
262 |
+ } |
263 |
+ }; |
264 |
+#endif |
265 |
+ |
266 |
template< |
267 |
typename FunctionPtr, |
268 |
typename R BOOST_FUNCTION_COMMA |
269 |
@@ -254,12 +295,130 @@ |
270 |
>::type type; |
271 |
}; |
272 |
|
273 |
+#if BOOST_FUNCTION_NUM_ARGS > 0 |
274 |
+ /* Retrieve the appropriate invoker for a member pointer. */ |
275 |
+ template< |
276 |
+ typename MemberPtr, |
277 |
+ typename R BOOST_FUNCTION_COMMA |
278 |
+ BOOST_FUNCTION_TEMPLATE_PARMS |
279 |
+ > |
280 |
+ struct BOOST_FUNCTION_GET_MEMBER_INVOKER |
281 |
+ { |
282 |
+ typedef typename mpl::if_c<(is_void<R>::value), |
283 |
+ BOOST_FUNCTION_VOID_MEMBER_INVOKER< |
284 |
+ MemberPtr, |
285 |
+ R BOOST_FUNCTION_COMMA |
286 |
+ BOOST_FUNCTION_TEMPLATE_ARGS |
287 |
+ >, |
288 |
+ BOOST_FUNCTION_MEMBER_INVOKER< |
289 |
+ MemberPtr, |
290 |
+ R BOOST_FUNCTION_COMMA |
291 |
+ BOOST_FUNCTION_TEMPLATE_ARGS |
292 |
+ > |
293 |
+ >::type type; |
294 |
+ }; |
295 |
+#endif |
296 |
+ |
297 |
+ /* Given the tag returned by get_function_tag, retrieve the |
298 |
+ actual invoker that will be used for the given function |
299 |
+ object. |
300 |
+ |
301 |
+ Each specialization contains an "apply" nested class template |
302 |
+ that accepts the function object, return type, function |
303 |
+ argument types, and allocator. The resulting "apply" class |
304 |
+ contains two typedefs, "invoker_type" and "manager_type", |
305 |
+ which correspond to the invoker and manager types. */ |
306 |
+ template<typename Tag> |
307 |
+ struct BOOST_FUNCTION_GET_INVOKER { }; |
308 |
+ |
309 |
+ /* Retrieve the invoker for a function pointer. */ |
310 |
+ template<> |
311 |
+ struct BOOST_FUNCTION_GET_INVOKER<function_ptr_tag> |
312 |
+ { |
313 |
+ template<typename FunctionPtr, |
314 |
+ typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS, |
315 |
+ typename Allocator> |
316 |
+ struct apply |
317 |
+ { |
318 |
+ typedef typename BOOST_FUNCTION_GET_FUNCTION_INVOKER< |
319 |
+ FunctionPtr, |
320 |
+ R BOOST_FUNCTION_COMMA |
321 |
+ BOOST_FUNCTION_TEMPLATE_ARGS |
322 |
+ >::type |
323 |
+ invoker_type; |
324 |
+ |
325 |
+ typedef functor_manager<FunctionPtr, Allocator> manager_type; |
326 |
+ }; |
327 |
+ }; |
328 |
+ |
329 |
+#if BOOST_FUNCTION_NUM_ARGS > 0 |
330 |
+ /* Retrieve the invoker for a member pointer. */ |
331 |
+ template<> |
332 |
+ struct BOOST_FUNCTION_GET_INVOKER<member_ptr_tag> |
333 |
+ { |
334 |
+ template<typename MemberPtr, |
335 |
+ typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS, |
336 |
+ typename Allocator> |
337 |
+ struct apply |
338 |
+ { |
339 |
+ typedef typename BOOST_FUNCTION_GET_MEMBER_INVOKER< |
340 |
+ MemberPtr, |
341 |
+ R BOOST_FUNCTION_COMMA |
342 |
+ BOOST_FUNCTION_TEMPLATE_ARGS |
343 |
+ >::type |
344 |
+ invoker_type; |
345 |
+ |
346 |
+ typedef functor_manager<MemberPtr, Allocator> manager_type; |
347 |
+ }; |
348 |
+ }; |
349 |
+#endif |
350 |
+ |
351 |
+ /* Retrieve the invoker for a function object. */ |
352 |
+ template<> |
353 |
+ struct BOOST_FUNCTION_GET_INVOKER<function_obj_tag> |
354 |
+ { |
355 |
+ template<typename FunctionObj, |
356 |
+ typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS, |
357 |
+ typename Allocator> |
358 |
+ struct apply |
359 |
+ { |
360 |
+ typedef typename BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< |
361 |
+ FunctionObj, |
362 |
+ R BOOST_FUNCTION_COMMA |
363 |
+ BOOST_FUNCTION_TEMPLATE_ARGS |
364 |
+ >::type |
365 |
+ invoker_type; |
366 |
+ |
367 |
+ typedef functor_manager<FunctionObj, Allocator> manager_type; |
368 |
+ }; |
369 |
+ }; |
370 |
+ |
371 |
+ /* Retrieve the invoker for a reference to a function object. */ |
372 |
+ template<> |
373 |
+ struct BOOST_FUNCTION_GET_INVOKER<function_obj_ref_tag> |
374 |
+ { |
375 |
+ template<typename RefWrapper, |
376 |
+ typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS, |
377 |
+ typename Allocator> |
378 |
+ struct apply |
379 |
+ { |
380 |
+ typedef typename BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER< |
381 |
+ typename RefWrapper::type, |
382 |
+ R BOOST_FUNCTION_COMMA |
383 |
+ BOOST_FUNCTION_TEMPLATE_ARGS |
384 |
+ >::type |
385 |
+ invoker_type; |
386 |
+ |
387 |
+ typedef reference_manager<typename RefWrapper::type> manager_type; |
388 |
+ }; |
389 |
+ }; |
390 |
+ |
391 |
/** |
392 |
* vtable for a specific boost::function instance. |
393 |
*/ |
394 |
template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS, |
395 |
typename Allocator> |
396 |
- struct BOOST_FUNCTION_VTABLE : vtable_base |
397 |
+ struct BOOST_FUNCTION_VTABLE |
398 |
{ |
399 |
#ifndef BOOST_NO_VOID_RETURNS |
400 |
typedef R result_type; |
401 |
@@ -272,50 +431,25 @@ |
402 |
BOOST_FUNCTION_TEMPLATE_ARGS); |
403 |
|
404 |
template<typename F> |
405 |
- BOOST_FUNCTION_VTABLE(F f) : vtable_base(), invoker(0) |
406 |
- { |
407 |
- init(f); |
408 |
- } |
409 |
- |
410 |
- template<typename F> |
411 |
- bool assign_to(F f, function_buffer& functor) |
412 |
+ bool assign_to(const F& f, function_buffer& functor) const |
413 |
{ |
414 |
typedef typename get_function_tag<F>::type tag; |
415 |
return assign_to(f, functor, tag()); |
416 |
} |
417 |
|
418 |
- void clear(function_buffer& functor) |
419 |
+ void clear(function_buffer& functor) const |
420 |
{ |
421 |
- if (manager) |
422 |
- manager(functor, functor, destroy_functor_tag); |
423 |
+ if (base.manager) |
424 |
+ base.manager(functor, functor, destroy_functor_tag); |
425 |
} |
426 |
- |
427 |
+#ifndef BOOST_NO_PRIVATE_IN_AGGREGATE |
428 |
private: |
429 |
- template<typename F> |
430 |
- void init(F f) |
431 |
- { |
432 |
- typedef typename get_function_tag<F>::type tag; |
433 |
- init(f, tag()); |
434 |
- } |
435 |
- |
436 |
+#endif |
437 |
// Function pointers |
438 |
template<typename FunctionPtr> |
439 |
- void init(FunctionPtr /*f*/, function_ptr_tag) |
440 |
- { |
441 |
- typedef typename BOOST_FUNCTION_GET_FUNCTION_INVOKER< |
442 |
- FunctionPtr, |
443 |
- R BOOST_FUNCTION_COMMA |
444 |
- BOOST_FUNCTION_TEMPLATE_ARGS |
445 |
- >::type |
446 |
- actual_invoker_type; |
447 |
- |
448 |
- invoker = &actual_invoker_type::invoke; |
449 |
- manager = &functor_manager<FunctionPtr, Allocator>::manage; |
450 |
- } |
451 |
- |
452 |
- template<typename FunctionPtr> |
453 |
bool |
454 |
- assign_to(FunctionPtr f, function_buffer& functor, function_ptr_tag) |
455 |
+ assign_to(FunctionPtr f, function_buffer& functor, |
456 |
+ function_ptr_tag) const |
457 |
{ |
458 |
this->clear(functor); |
459 |
if (f) { |
460 |
@@ -331,22 +465,13 @@ |
461 |
// Member pointers |
462 |
#if BOOST_FUNCTION_NUM_ARGS > 0 |
463 |
template<typename MemberPtr> |
464 |
- void init(MemberPtr f, member_ptr_tag) |
465 |
- { |
466 |
- // DPG TBD: Add explicit support for member function |
467 |
- // objects, so we invoke through mem_fn() but we retain the |
468 |
- // right target_type() values. |
469 |
- this->init(mem_fn(f)); |
470 |
- } |
471 |
- |
472 |
- template<typename MemberPtr> |
473 |
- bool assign_to(MemberPtr f, function_buffer& functor, member_ptr_tag) |
474 |
+ bool |
475 |
+ assign_to(MemberPtr f, function_buffer& functor, member_ptr_tag) const |
476 |
{ |
477 |
- // DPG TBD: Add explicit support for member function |
478 |
- // objects, so we invoke through mem_fn() but we retain the |
479 |
- // right target_type() values. |
480 |
if (f) { |
481 |
- this->assign_to(mem_fn(f), functor); |
482 |
+ // Always use the small-object optimization for member |
483 |
+ // pointers. |
484 |
+ assign_functor(f, functor, mpl::true_()); |
485 |
return true; |
486 |
} else { |
487 |
return false; |
488 |
@@ -355,24 +480,11 @@ |
489 |
#endif // BOOST_FUNCTION_NUM_ARGS > 0 |
490 |
|
491 |
// Function objects |
492 |
- template<typename FunctionObj> |
493 |
- void init(FunctionObj /*f*/, function_obj_tag) |
494 |
- { |
495 |
- typedef typename BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< |
496 |
- FunctionObj, |
497 |
- R BOOST_FUNCTION_COMMA |
498 |
- BOOST_FUNCTION_TEMPLATE_ARGS |
499 |
- >::type |
500 |
- actual_invoker_type; |
501 |
- |
502 |
- invoker = &actual_invoker_type::invoke; |
503 |
- manager = &functor_manager<FunctionObj, Allocator>::manage; |
504 |
- } |
505 |
- |
506 |
// Assign to a function object using the small object optimization |
507 |
template<typename FunctionObj> |
508 |
void |
509 |
- assign_functor(FunctionObj f, function_buffer& functor, mpl::true_) |
510 |
+ assign_functor(const FunctionObj& f, function_buffer& functor, |
511 |
+ mpl::true_) const |
512 |
{ |
513 |
new ((void*)&functor.data) FunctionObj(f); |
514 |
} |
515 |
@@ -380,7 +492,8 @@ |
516 |
// Assign to a function object allocated on the heap. |
517 |
template<typename FunctionObj> |
518 |
void |
519 |
- assign_functor(FunctionObj f, function_buffer& functor, mpl::false_) |
520 |
+ assign_functor(const FunctionObj& f, function_buffer& functor, |
521 |
+ mpl::false_) const |
522 |
{ |
523 |
#ifndef BOOST_NO_STD_ALLOCATOR |
524 |
typedef typename Allocator::template rebind<FunctionObj>::other |
525 |
@@ -400,7 +513,8 @@ |
526 |
|
527 |
template<typename FunctionObj> |
528 |
bool |
529 |
- assign_to(FunctionObj f, function_buffer& functor, function_obj_tag) |
530 |
+ assign_to(const FunctionObj& f, function_buffer& functor, |
531 |
+ function_obj_tag) const |
532 |
{ |
533 |
if (!boost::detail::function::has_empty_target(boost::addressof(f))) { |
534 |
assign_functor(f, functor, |
535 |
@@ -413,24 +527,9 @@ |
536 |
|
537 |
// Reference to a function object |
538 |
template<typename FunctionObj> |
539 |
- void |
540 |
- init(const reference_wrapper<FunctionObj>& /*f*/, function_obj_ref_tag) |
541 |
- { |
542 |
- typedef typename BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER< |
543 |
- FunctionObj, |
544 |
- R BOOST_FUNCTION_COMMA |
545 |
- BOOST_FUNCTION_TEMPLATE_ARGS |
546 |
- >::type |
547 |
- actual_invoker_type; |
548 |
- |
549 |
- invoker = &actual_invoker_type::invoke; |
550 |
- manager = &reference_manager<FunctionObj>::get; |
551 |
- } |
552 |
- |
553 |
- template<typename FunctionObj> |
554 |
bool |
555 |
assign_to(const reference_wrapper<FunctionObj>& f, |
556 |
- function_buffer& functor, function_obj_ref_tag) |
557 |
+ function_buffer& functor, function_obj_ref_tag) const |
558 |
{ |
559 |
if (!boost::detail::function::has_empty_target(f.get_pointer())) { |
560 |
// DPG TBD: We might need to detect constness of |
561 |
@@ -445,6 +544,7 @@ |
562 |
} |
563 |
|
564 |
public: |
565 |
+ vtable_base base; |
566 |
invoker_type invoker; |
567 |
}; |
568 |
} // end namespace function |
569 |
@@ -456,6 +556,17 @@ |
570 |
typename Allocator = BOOST_FUNCTION_DEFAULT_ALLOCATOR |
571 |
> |
572 |
class BOOST_FUNCTION_FUNCTION : public function_base |
573 |
+ |
574 |
+#if BOOST_FUNCTION_NUM_ARGS == 1 |
575 |
+ |
576 |
+ , public std::unary_function<T0,R> |
577 |
+ |
578 |
+#elif BOOST_FUNCTION_NUM_ARGS == 2 |
579 |
+ |
580 |
+ , public std::binary_function<T0,T1,R> |
581 |
+ |
582 |
+#endif |
583 |
+ |
584 |
{ |
585 |
public: |
586 |
#ifndef BOOST_NO_VOID_RETURNS |
587 |
@@ -537,7 +648,7 @@ |
588 |
if (this->empty()) |
589 |
boost::throw_exception(bad_function_call()); |
590 |
|
591 |
- return static_cast<vtable_type*>(vtable)->invoker |
592 |
+ return reinterpret_cast<const vtable_type*>(vtable)->invoker |
593 |
(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); |
594 |
} |
595 |
#else |
596 |
@@ -561,12 +672,16 @@ |
597 |
operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) |
598 |
{ |
599 |
this->clear(); |
600 |
+#ifndef BOOST_NO_EXCEPTIONS |
601 |
try { |
602 |
this->assign_to(f); |
603 |
} catch (...) { |
604 |
vtable = 0; |
605 |
throw; |
606 |
} |
607 |
+#else |
608 |
+ this->assign_to(f); |
609 |
+#endif |
610 |
return *this; |
611 |
} |
612 |
|
613 |
@@ -592,12 +707,16 @@ |
614 |
return *this; |
615 |
|
616 |
this->clear(); |
617 |
+#ifndef BOOST_NO_EXCEPTIONS |
618 |
try { |
619 |
this->assign_to_own(f); |
620 |
} catch (...) { |
621 |
vtable = 0; |
622 |
throw; |
623 |
} |
624 |
+#else |
625 |
+ this->assign_to_own(f); |
626 |
+#endif |
627 |
return *this; |
628 |
} |
629 |
|
630 |
@@ -615,7 +734,7 @@ |
631 |
void clear() |
632 |
{ |
633 |
if (vtable) { |
634 |
- static_cast<vtable_type*>(vtable)->clear(this->functor); |
635 |
+ reinterpret_cast<const vtable_type*>(vtable)->clear(this->functor); |
636 |
vtable = 0; |
637 |
} |
638 |
} |
639 |
@@ -650,10 +769,24 @@ |
640 |
} |
641 |
|
642 |
template<typename Functor> |
643 |
- void assign_to(Functor f) |
644 |
+ void assign_to(const Functor& f) |
645 |
{ |
646 |
- static vtable_type stored_vtable(f); |
647 |
- if (stored_vtable.assign_to(f, functor)) vtable = &stored_vtable; |
648 |
+ using detail::function::vtable_base; |
649 |
+ |
650 |
+ typedef typename detail::function::get_function_tag<Functor>::type tag; |
651 |
+ typedef detail::function::BOOST_FUNCTION_GET_INVOKER<tag> get_invoker; |
652 |
+ typedef typename get_invoker:: |
653 |
+ template apply<Functor, R BOOST_FUNCTION_COMMA |
654 |
+ BOOST_FUNCTION_TEMPLATE_ARGS, Allocator> |
655 |
+ handler_type; |
656 |
+ |
657 |
+ typedef typename handler_type::invoker_type invoker_type; |
658 |
+ typedef typename handler_type::manager_type manager_type; |
659 |
+ |
660 |
+ static const vtable_type stored_vtable = |
661 |
+ { { &manager_type::manage }, &invoker_type::invoke }; |
662 |
+ |
663 |
+ if (stored_vtable.assign_to(f, functor)) vtable = &stored_vtable.base; |
664 |
else vtable = 0; |
665 |
} |
666 |
}; |
667 |
@@ -688,7 +821,7 @@ |
668 |
if (this->empty()) |
669 |
boost::throw_exception(bad_function_call()); |
670 |
|
671 |
- return static_cast<vtable_type*>(vtable)->invoker |
672 |
+ return reinterpret_cast<const vtable_type*>(vtable)->invoker |
673 |
(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); |
674 |
} |
675 |
#endif |
676 |
@@ -798,21 +931,14 @@ |
677 |
} |
678 |
}; |
679 |
|
680 |
-#ifdef BOOST_MSVC |
681 |
-# pragma warning(pop) |
682 |
-#endif |
683 |
- |
684 |
#undef BOOST_FUNCTION_PARTIAL_SPEC |
685 |
#endif // have partial specialization |
686 |
|
687 |
} // end namespace boost |
688 |
|
689 |
-#ifdef BOOST_MSVC |
690 |
-# pragma warning(pop) |
691 |
-#endif |
692 |
- |
693 |
// Cleanup after ourselves... |
694 |
#undef BOOST_FUNCTION_VTABLE |
695 |
+#undef BOOST_FUNCTION_GET_INVOKER |
696 |
#undef BOOST_FUNCTION_DEFAULT_ALLOCATOR |
697 |
#undef BOOST_FUNCTION_COMMA |
698 |
#undef BOOST_FUNCTION_FUNCTION |
699 |
@@ -822,10 +948,12 @@ |
700 |
#undef BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER |
701 |
#undef BOOST_FUNCTION_FUNCTION_REF_INVOKER |
702 |
#undef BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER |
703 |
+#undef BOOST_FUNCTION_MEMBER_INVOKER |
704 |
+#undef BOOST_FUNCTION_VOID_MEMBER_INVOKER |
705 |
#undef BOOST_FUNCTION_GET_FUNCTION_INVOKER |
706 |
#undef BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER |
707 |
#undef BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER |
708 |
-#undef BOOST_FUNCTION_GET_MEM_FUNCTION_INVOKER |
709 |
+#undef BOOST_FUNCTION_GET_MEMBER_INVOKER |
710 |
#undef BOOST_FUNCTION_TEMPLATE_PARMS |
711 |
#undef BOOST_FUNCTION_TEMPLATE_ARGS |
712 |
#undef BOOST_FUNCTION_PARMS |
713 |
@@ -835,3 +963,7 @@ |
714 |
#undef BOOST_FUNCTION_ARG_TYPES |
715 |
#undef BOOST_FUNCTION_VOID_RETURN_TYPE |
716 |
#undef BOOST_FUNCTION_RETURN |
717 |
+ |
718 |
+#if defined(BOOST_MSVC) |
719 |
+# pragma warning( pop ) |
720 |
+#endif |
721 |
|
722 |
|
723 |
|
724 |
1.1 src/patchsets/boost/1.34.1/patches/06_all_1.34.1-gcc43_regex-include.patch |
725 |
|
726 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/boost/1.34.1/patches/06_all_1.34.1-gcc43_regex-include.patch?rev=1.1&view=markup |
727 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/boost/1.34.1/patches/06_all_1.34.1-gcc43_regex-include.patch?rev=1.1&content-type=text/plain |
728 |
|
729 |
Index: 06_all_1.34.1-gcc43_regex-include.patch |
730 |
=================================================================== |
731 |
diff -Nurp boost_1_34_1/boost/regex/v4/cpp_regex_traits.hpp boost_1_34_1_new/boost/regex/v4/cpp_regex_traits.hpp |
732 |
--- boost_1_34_1/boost/regex/v4/cpp_regex_traits.hpp 2007-01-15 12:09:44.000000000 +0100 |
733 |
+++ boost_1_34_1_new/boost/regex/v4/cpp_regex_traits.hpp 2007-12-21 21:01:33.000000000 +0100 |
734 |
@@ -39,6 +39,7 @@ |
735 |
#include <boost/regex/pending/object_cache.hpp> |
736 |
#endif |
737 |
|
738 |
+#include <climits> |
739 |
#include <istream> |
740 |
#include <ios> |
741 |
|
742 |
|
743 |
|
744 |
|
745 |
1.1 src/patchsets/boost/1.34.1/patches/07_all_1.34.1-CVE-2008-0171_and_0172.patch |
746 |
|
747 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/boost/1.34.1/patches/07_all_1.34.1-CVE-2008-0171_and_0172.patch?rev=1.1&view=markup |
748 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/boost/1.34.1/patches/07_all_1.34.1-CVE-2008-0171_and_0172.patch?rev=1.1&content-type=text/plain |
749 |
|
750 |
Index: 07_all_1.34.1-CVE-2008-0171_and_0172.patch |
751 |
=================================================================== |
752 |
Index: /trunk/boost/regex/v4/basic_regex_parser.hpp |
753 |
=================================================================== |
754 |
--- boost/regex/v4/basic_regex_parser.hpp (revision 38864) |
755 |
+++ boost/regex/v4/basic_regex_parser.hpp (revision 42674) |
756 |
@@ -785,4 +785,5 @@ |
757 |
case syntax_element_jump: |
758 |
case syntax_element_startmark: |
759 |
+ case syntax_element_backstep: |
760 |
// can't legally repeat any of the above: |
761 |
fail(regex_constants::error_badrepeat, m_position - m_base); |
762 |
@@ -1870,4 +1871,5 @@ |
763 |
{ |
764 |
re_syntax_base* b = this->getaddress(expected_alt_point); |
765 |
+ // Make sure we have exactly one alternative following this state: |
766 |
if(b->type != syntax_element_alt) |
767 |
{ |
768 |
@@ -1878,4 +1880,13 @@ |
769 |
{ |
770 |
fail(regex_constants::error_bad_pattern, m_position - m_base); |
771 |
+ return false; |
772 |
+ } |
773 |
+ // check for invalid repetition of next state: |
774 |
+ b = this->getaddress(expected_alt_point); |
775 |
+ b = this->getaddress(static_cast<re_alt*>(b)->next.i, b); |
776 |
+ if((b->type != syntax_element_assert_backref) |
777 |
+ && (b->type != syntax_element_startmark)) |
778 |
+ { |
779 |
+ fail(regex_constants::error_badrepeat, m_position - m_base); |
780 |
return false; |
781 |
} |
782 |
Index: /trunk/libs/regex/test/regress/test_perl_ex.cpp |
783 |
=================================================================== |
784 |
--- libs/regex/test/regress/test_perl_ex.cpp (revision 30980) |
785 |
+++ libs/regex/test/regress/test_perl_ex.cpp (revision 42674) |
786 |
@@ -122,4 +122,15 @@ |
787 |
TEST_INVALID_REGEX("(?:(a)|b)(?(?<", perl); |
788 |
TEST_INVALID_REGEX("(?:(a)|b)(?(?<a", perl); |
789 |
+ |
790 |
+ TEST_INVALID_REGEX("(?(?!#?)+)", perl); |
791 |
+ TEST_INVALID_REGEX("(?(?=:-){0})", perl); |
792 |
+ TEST_INVALID_REGEX("(?(123){1})", perl); |
793 |
+ TEST_INVALID_REGEX("(?(?<=A)*)", perl); |
794 |
+ TEST_INVALID_REGEX("(?(?<=A)+)", perl); |
795 |
+ |
796 |
+ TEST_INVALID_REGEX("(?<!*|^)", perl); |
797 |
+ TEST_INVALID_REGEX("(?<!*|A)", perl); |
798 |
+ TEST_INVALID_REGEX("(?<=?|A)", perl); |
799 |
+ TEST_INVALID_REGEX("(?<=*|\\B)", perl); |
800 |
} |
801 |
|
802 |
|
803 |
|
804 |
|
805 |
-- |
806 |
gentoo-commits@l.g.o mailing list |