mirror of
https://github.com/boostorg/function.git
synced 2025-07-30 04:47:14 +02:00
Removed all but one old-style cast, breaking GCC 2.95.3; fixes #3410
[SVN r62614]
This commit is contained in:
@ -315,7 +315,7 @@ namespace boost {
|
|||||||
if (op == clone_functor_tag || op == move_functor_tag) {
|
if (op == clone_functor_tag || op == move_functor_tag) {
|
||||||
const functor_type* in_functor =
|
const functor_type* in_functor =
|
||||||
reinterpret_cast<const functor_type*>(&in_buffer.data);
|
reinterpret_cast<const functor_type*>(&in_buffer.data);
|
||||||
new ((void*)&out_buffer.data) functor_type(*in_functor);
|
new (reinterpret_cast<void*>(&out_buffer.data)) functor_type(*in_functor);
|
||||||
|
|
||||||
if (op == move_functor_tag) {
|
if (op == move_functor_tag) {
|
||||||
reinterpret_cast<functor_type*>(&in_buffer.data)->~Functor();
|
reinterpret_cast<functor_type*>(&in_buffer.data)->~Functor();
|
||||||
@ -369,8 +369,10 @@ namespace boost {
|
|||||||
// Clone the functor
|
// Clone the functor
|
||||||
// GCC 2.95.3 gets the CV qualifiers wrong here, so we
|
// GCC 2.95.3 gets the CV qualifiers wrong here, so we
|
||||||
// can't do the static_cast that we should do.
|
// can't do the static_cast that we should do.
|
||||||
|
// jewillco: Changing this to static_cast because GCC 2.95.3 is
|
||||||
|
// obsolete.
|
||||||
const functor_type* f =
|
const functor_type* f =
|
||||||
(const functor_type*)(in_buffer.obj_ptr);
|
static_cast<const functor_type*>(in_buffer.obj_ptr);
|
||||||
functor_type* new_f = new functor_type(*f);
|
functor_type* new_f = new functor_type(*f);
|
||||||
out_buffer.obj_ptr = new_f;
|
out_buffer.obj_ptr = new_f;
|
||||||
} else if (op == move_functor_tag) {
|
} else if (op == move_functor_tag) {
|
||||||
@ -474,7 +476,7 @@ namespace boost {
|
|||||||
// GCC 2.95.3 gets the CV qualifiers wrong here, so we
|
// GCC 2.95.3 gets the CV qualifiers wrong here, so we
|
||||||
// can't do the static_cast that we should do.
|
// can't do the static_cast that we should do.
|
||||||
const functor_wrapper_type* f =
|
const functor_wrapper_type* f =
|
||||||
(const functor_wrapper_type*)(in_buffer.obj_ptr);
|
static_cast<const functor_wrapper_type*>(in_buffer.obj_ptr);
|
||||||
wrapper_allocator_type wrapper_allocator(static_cast<Allocator const &>(*f));
|
wrapper_allocator_type wrapper_allocator(static_cast<Allocator const &>(*f));
|
||||||
wrapper_allocator_pointer_type copy = wrapper_allocator.allocate(1);
|
wrapper_allocator_pointer_type copy = wrapper_allocator.allocate(1);
|
||||||
wrapper_allocator.construct(copy, *f);
|
wrapper_allocator.construct(copy, *f);
|
||||||
@ -671,7 +673,7 @@ public:
|
|||||||
detail::function::check_functor_type_tag);
|
detail::function::check_functor_type_tag);
|
||||||
// GCC 2.95.3 gets the CV qualifiers wrong here, so we
|
// GCC 2.95.3 gets the CV qualifiers wrong here, so we
|
||||||
// can't do the static_cast that we should do.
|
// can't do the static_cast that we should do.
|
||||||
return (const Functor*)(type_result.obj_ptr);
|
return static_cast<const Functor*>(type_result.obj_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
@ -715,7 +717,7 @@ public:
|
|||||||
public: // should be protected, but GCC 2.95.3 will fail to allow access
|
public: // should be protected, but GCC 2.95.3 will fail to allow access
|
||||||
detail::function::vtable_base* get_vtable() const {
|
detail::function::vtable_base* get_vtable() const {
|
||||||
return reinterpret_cast<detail::function::vtable_base*>(
|
return reinterpret_cast<detail::function::vtable_base*>(
|
||||||
reinterpret_cast<std::size_t>(vtable) & ~(std::size_t)0x01);
|
reinterpret_cast<std::size_t>(vtable) & ~static_cast<std::size_t>(0x01));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_trivial_copy_and_destroy() const {
|
bool has_trivial_copy_and_destroy() const {
|
||||||
|
@ -514,7 +514,7 @@ namespace boost {
|
|||||||
if (f) {
|
if (f) {
|
||||||
// should be a reinterpret cast, but some compilers insist
|
// should be a reinterpret cast, but some compilers insist
|
||||||
// on giving cv-qualifiers to free functions
|
// on giving cv-qualifiers to free functions
|
||||||
functor.func_ptr = (void (*)())(f);
|
functor.func_ptr = reinterpret_cast<void (*)()>(f);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -563,7 +563,7 @@ namespace boost {
|
|||||||
void
|
void
|
||||||
assign_functor(FunctionObj f, function_buffer& functor, mpl::true_)
|
assign_functor(FunctionObj f, function_buffer& functor, mpl::true_)
|
||||||
{
|
{
|
||||||
new ((void*)&functor.data) FunctionObj(f);
|
new (reinterpret_cast<void*>(&functor.data)) FunctionObj(f);
|
||||||
}
|
}
|
||||||
template<typename FunctionObj,typename Allocator>
|
template<typename FunctionObj,typename Allocator>
|
||||||
void
|
void
|
||||||
@ -625,7 +625,7 @@ namespace boost {
|
|||||||
assign_to(const reference_wrapper<FunctionObj>& f,
|
assign_to(const reference_wrapper<FunctionObj>& f,
|
||||||
function_buffer& functor, function_obj_ref_tag)
|
function_buffer& functor, function_obj_ref_tag)
|
||||||
{
|
{
|
||||||
functor.obj_ref.obj_ptr = (void *)f.get_pointer();
|
functor.obj_ref.obj_ptr = (void *)(f.get_pointer());
|
||||||
functor.obj_ref.is_const_qualified = is_const<FunctionObj>::value;
|
functor.obj_ref.is_const_qualified = is_const<FunctionObj>::value;
|
||||||
functor.obj_ref.is_volatile_qualified = is_volatile<FunctionObj>::value;
|
functor.obj_ref.is_volatile_qualified = is_volatile<FunctionObj>::value;
|
||||||
return true;
|
return true;
|
||||||
@ -677,7 +677,7 @@ namespace boost {
|
|||||||
|
|
||||||
vtable_type* get_vtable() const {
|
vtable_type* get_vtable() const {
|
||||||
return reinterpret_cast<vtable_type*>(
|
return reinterpret_cast<vtable_type*>(
|
||||||
reinterpret_cast<std::size_t>(vtable) & ~(std::size_t)0x01);
|
reinterpret_cast<std::size_t>(vtable) & ~static_cast<size_t>(0x01));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct clear_type {};
|
struct clear_type {};
|
||||||
@ -917,7 +917,7 @@ namespace boost {
|
|||||||
if (boost::has_trivial_copy_constructor<Functor>::value &&
|
if (boost::has_trivial_copy_constructor<Functor>::value &&
|
||||||
boost::has_trivial_destructor<Functor>::value &&
|
boost::has_trivial_destructor<Functor>::value &&
|
||||||
detail::function::function_allows_small_object_optimization<Functor>::value)
|
detail::function::function_allows_small_object_optimization<Functor>::value)
|
||||||
value |= (std::size_t)0x01;
|
value |= static_cast<size_t>(0x01);
|
||||||
vtable = reinterpret_cast<detail::function::vtable_base *>(value);
|
vtable = reinterpret_cast<detail::function::vtable_base *>(value);
|
||||||
} else
|
} else
|
||||||
vtable = 0;
|
vtable = 0;
|
||||||
@ -951,7 +951,7 @@ namespace boost {
|
|||||||
if (boost::has_trivial_copy_constructor<Functor>::value &&
|
if (boost::has_trivial_copy_constructor<Functor>::value &&
|
||||||
boost::has_trivial_destructor<Functor>::value &&
|
boost::has_trivial_destructor<Functor>::value &&
|
||||||
detail::function::function_allows_small_object_optimization<Functor>::value)
|
detail::function::function_allows_small_object_optimization<Functor>::value)
|
||||||
value |= (std::size_t)0x01;
|
value |= static_cast<std::size_t>(0x01);
|
||||||
vtable = reinterpret_cast<detail::function::vtable_base *>(value);
|
vtable = reinterpret_cast<detail::function::vtable_base *>(value);
|
||||||
} else
|
} else
|
||||||
vtable = 0;
|
vtable = 0;
|
||||||
|
Reference in New Issue
Block a user