mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-30 18:55:57 +08:00
cxxabi.h: Use __SIZE_TYPE_ and __PTRDIFF_TYPE__ in place of std::size_t and...
* inc/cxxabi.h: Use __SIZE_TYPE_ and __PTRDIFF_TYPE__ in place of std::size_t and std::ptrdiff_t respectively. * tinfo.cc: Likewise. * vec.cc: Likewise. From-SVN: r33759
This commit is contained in:
parent
b8f4101008
commit
9ad3ca3499
@ -1,3 +1,10 @@
|
||||
2000-05-07 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* inc/cxxabi.h: Use __SIZE_TYPE_ and __PTRDIFF_TYPE__ in place
|
||||
of std::size_t and std::ptrdiff_t respectively.
|
||||
* tinfo.cc: Likewise.
|
||||
* vec.cc: Likewise.
|
||||
|
||||
2000-05-06 Richard Henderson <rth@cygnus.com>
|
||||
|
||||
* typeck.c (build_c_cast): Don't warn integer->pointer size
|
||||
|
@ -49,10 +49,14 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
// We use the compiler builtins __SIZE__TYPE__ and __PTRDIFF_TYPE__ instead of
|
||||
// std::size_t and std::ptrdiff_t respectively. This makes us independant of
|
||||
// the conformance level of <cstddef> and whether -fhonor-std was supplied.
|
||||
// <cstddef> is not currently available during compiler building anyway.
|
||||
// including <stddef.h> would be wrong, as that would rudely place size_t in
|
||||
// the global namespace.
|
||||
|
||||
#include <typeinfo>
|
||||
// This should really be cstddef, but that currently is not available when
|
||||
// building the runtime.
|
||||
#include <stddef.h>
|
||||
|
||||
namespace __cxxabiv1
|
||||
{
|
||||
@ -207,11 +211,11 @@ public:
|
||||
{ return vmi_offset_flags & virtual_mask; }
|
||||
bool __is_public_p () const
|
||||
{ return vmi_offset_flags & public_mask; }
|
||||
std::ptrdiff_t __offset () const
|
||||
__PTRDIFF_TYPE__ __offset () const
|
||||
{
|
||||
// This shift, being of a signed type, is implementation defined. GCC
|
||||
// implements such shifts as arithmetic, which is what we want.
|
||||
return std::ptrdiff_t (vmi_offset_flags) >> offset_shift;
|
||||
return __PTRDIFF_TYPE__ (vmi_offset_flags) >> offset_shift;
|
||||
}
|
||||
};
|
||||
|
||||
@ -277,7 +281,7 @@ public:
|
||||
within this type. If SRC_PTR is one of our SRC_TYPE bases, indicate the
|
||||
virtuality. Returns not_contained for non containment or private
|
||||
containment. */
|
||||
inline __sub_kind __find_public_src (std::ptrdiff_t __src2dst,
|
||||
inline __sub_kind __find_public_src (__PTRDIFF_TYPE__ __src2dst,
|
||||
const void *__obj_ptr,
|
||||
const __class_type_info *__src_type,
|
||||
const void *__src_ptr) const;
|
||||
@ -289,7 +293,7 @@ public:
|
||||
indicates the static type started from and SRC_PTR points to that base
|
||||
within the most derived object. Fill in RESULT with what we find. Return
|
||||
true if we have located an ambiguous match. */
|
||||
virtual bool __do_dyncast (std::ptrdiff_t __src2dst,
|
||||
virtual bool __do_dyncast (__PTRDIFF_TYPE__ __src2dst,
|
||||
__sub_kind __access_path,
|
||||
const __class_type_info *__dst_type,
|
||||
const void *__obj_ptr,
|
||||
@ -301,7 +305,7 @@ public:
|
||||
inherited by the type started from -- which is not necessarily the
|
||||
current type. The current type will be a base of the destination type.
|
||||
OBJ_PTR points to the current base. */
|
||||
virtual __sub_kind __do_find_public_src (std::ptrdiff_t __src2dst,
|
||||
virtual __sub_kind __do_find_public_src (__PTRDIFF_TYPE__ __src2dst,
|
||||
const void *__obj_ptr,
|
||||
const __class_type_info *__src_type,
|
||||
const void *__src_ptr) const;
|
||||
@ -326,14 +330,14 @@ public:
|
||||
|
||||
/* implementation defined member functions */
|
||||
protected:
|
||||
virtual bool __do_dyncast (std::ptrdiff_t __src2dst,
|
||||
virtual bool __do_dyncast (__PTRDIFF_TYPE__ __src2dst,
|
||||
__sub_kind __access_path,
|
||||
const __class_type_info *__dst_type,
|
||||
const void *__obj_ptr,
|
||||
const __class_type_info *__src_type,
|
||||
const void *__src_ptr,
|
||||
__dyncast_result &__result) const;
|
||||
virtual __sub_kind __do_find_public_src (std::ptrdiff_t __src2dst,
|
||||
virtual __sub_kind __do_find_public_src (__PTRDIFF_TYPE__ __src2dst,
|
||||
const void *__obj_ptr,
|
||||
const __class_type_info *__src_type,
|
||||
const void *__sub_ptr) const;
|
||||
@ -376,14 +380,14 @@ public:
|
||||
|
||||
/* implementation defined member functions */
|
||||
protected:
|
||||
virtual bool __do_dyncast (std::ptrdiff_t __src2dst,
|
||||
virtual bool __do_dyncast (__PTRDIFF_TYPE__ __src2dst,
|
||||
__sub_kind __access_path,
|
||||
const __class_type_info *__dst_type,
|
||||
const void *__obj_ptr,
|
||||
const __class_type_info *__src_type,
|
||||
const void *__src_ptr,
|
||||
__dyncast_result &__result) const;
|
||||
virtual __sub_kind __do_find_public_src (std::ptrdiff_t __src2dst,
|
||||
virtual __sub_kind __do_find_public_src (__PTRDIFF_TYPE__ __src2dst,
|
||||
const void *__obj_ptr,
|
||||
const __class_type_info *__src_type,
|
||||
const void *__src_ptr) const;
|
||||
@ -398,7 +402,7 @@ extern "C++"
|
||||
void *__dynamic_cast (const void *__src_ptr, /* object started from */
|
||||
const __class_type_info *__src_type, /* static type of object */
|
||||
const __class_type_info *__dst_type, /* desired target type */
|
||||
std::ptrdiff_t __src2dst); /* how src and dst are related */
|
||||
__PTRDIFF_TYPE__ __src2dst); /* how src and dst are related */
|
||||
|
||||
/* src2dst has the following possible values
|
||||
>= 0: src_type is a unique public non-virtual base of dst_type
|
||||
@ -411,32 +415,32 @@ void *__dynamic_cast (const void *__src_ptr, /* object started from */
|
||||
|
||||
/* allocate and construct array */
|
||||
extern "C++"
|
||||
void *__cxa_vec_new (size_t __element_count,
|
||||
size_t __element_size,
|
||||
size_t __padding_size,
|
||||
void *__cxa_vec_new (__SIZE_TYPE__ __element_count,
|
||||
__SIZE_TYPE__ __element_size,
|
||||
__SIZE_TYPE__ __padding_size,
|
||||
void (*__constructor) (void *),
|
||||
void (*__destructor) (void *));
|
||||
|
||||
/* construct array */
|
||||
extern "C++"
|
||||
void __cxa_vec_ctor (void *__array_address,
|
||||
size_t __element_count,
|
||||
size_t __element_size,
|
||||
__SIZE_TYPE__ __element_count,
|
||||
__SIZE_TYPE__ __element_size,
|
||||
void (*__constructor) (void *),
|
||||
void (*__destructor) (void *));
|
||||
|
||||
/* destruct array */
|
||||
extern "C++"
|
||||
void __cxa_vec_dtor (void *__array_address,
|
||||
size_t __element_count,
|
||||
size_t __element_size,
|
||||
__SIZE_TYPE__ __element_count,
|
||||
__SIZE_TYPE__ __element_size,
|
||||
void (*__destructor) (void *));
|
||||
|
||||
/* destruct and release array */
|
||||
extern "C++"
|
||||
void __cxa_vec_delete (void *__array_address,
|
||||
size_t __element_size,
|
||||
size_t __padding_size,
|
||||
__SIZE_TYPE__ __element_size,
|
||||
__SIZE_TYPE__ __padding_size,
|
||||
void (*__destructor) (void *));
|
||||
|
||||
} /* namespace __cxxabiv1 */
|
||||
|
@ -579,14 +579,14 @@ using namespace abi;
|
||||
// initial part of a vtable, this structure is used with offsetof, so we don't
|
||||
// have to keep alignments consistent manually.
|
||||
struct vtable_prefix {
|
||||
ptrdiff_t whole_object; // offset to most derived object
|
||||
__PTRDIFF_TYPE__ whole_object; // offset to most derived object
|
||||
const __class_type_info *whole_type; // pointer to most derived type_info
|
||||
const void *origin; // what a class's vptr points to
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline const T *
|
||||
adjust_pointer (const void *base, ptrdiff_t offset)
|
||||
adjust_pointer (const void *base, __PTRDIFF_TYPE__ offset)
|
||||
{
|
||||
return reinterpret_cast <const T *>
|
||||
(reinterpret_cast <const char *> (base) + offset);
|
||||
@ -595,13 +595,13 @@ adjust_pointer (const void *base, ptrdiff_t offset)
|
||||
// ADDR is a pointer to an object. Convert it to a pointer to a base,
|
||||
// using OFFSET. IS_VIRTUAL is true, if we are getting a virtual base.
|
||||
inline void const *
|
||||
convert_to_base (void const *addr, bool is_virtual, ptrdiff_t offset)
|
||||
convert_to_base (void const *addr, bool is_virtual, __PTRDIFF_TYPE__ offset)
|
||||
{
|
||||
if (is_virtual)
|
||||
{
|
||||
const void *vtable = *static_cast <const void *const *> (addr);
|
||||
|
||||
offset = *adjust_pointer<ptrdiff_t> (vtable, offset);
|
||||
offset = *adjust_pointer<__PTRDIFF_TYPE__> (vtable, offset);
|
||||
}
|
||||
|
||||
return adjust_pointer<void> (addr, offset);
|
||||
@ -716,7 +716,7 @@ __do_upcast (const __class_type_info *dst_type,
|
||||
}
|
||||
|
||||
inline __class_type_info::__sub_kind __class_type_info::
|
||||
__find_public_src (ptrdiff_t src2dst,
|
||||
__find_public_src (__PTRDIFF_TYPE__ src2dst,
|
||||
const void *obj_ptr,
|
||||
const __class_type_info *src_type,
|
||||
const void *src_ptr) const
|
||||
@ -730,7 +730,7 @@ __find_public_src (ptrdiff_t src2dst,
|
||||
}
|
||||
|
||||
__class_type_info::__sub_kind __class_type_info::
|
||||
__do_find_public_src (ptrdiff_t,
|
||||
__do_find_public_src (__PTRDIFF_TYPE__,
|
||||
const void *obj_ptr,
|
||||
const __class_type_info *,
|
||||
const void *src_ptr) const
|
||||
@ -742,7 +742,7 @@ __do_find_public_src (ptrdiff_t,
|
||||
}
|
||||
|
||||
__class_type_info::__sub_kind __si_class_type_info::
|
||||
__do_find_public_src (ptrdiff_t src2dst,
|
||||
__do_find_public_src (__PTRDIFF_TYPE__ src2dst,
|
||||
const void *obj_ptr,
|
||||
const __class_type_info *src_type,
|
||||
const void *src_ptr) const
|
||||
@ -753,7 +753,7 @@ __do_find_public_src (ptrdiff_t src2dst,
|
||||
}
|
||||
|
||||
__class_type_info::__sub_kind __vmi_class_type_info::
|
||||
__do_find_public_src (ptrdiff_t src2dst,
|
||||
__do_find_public_src (__PTRDIFF_TYPE__ src2dst,
|
||||
const void *obj_ptr,
|
||||
const __class_type_info *src_type,
|
||||
const void *src_ptr) const
|
||||
@ -761,13 +761,13 @@ __do_find_public_src (ptrdiff_t src2dst,
|
||||
if (obj_ptr == src_ptr && *this == *src_type)
|
||||
return __contained_public;
|
||||
|
||||
for (size_t i = vmi_base_count; i--;)
|
||||
for (__SIZE_TYPE__ i = vmi_base_count; i--;)
|
||||
{
|
||||
if (!vmi_bases[i].__is_public_p ())
|
||||
continue; // Not public, can't be here.
|
||||
|
||||
const void *base = obj_ptr;
|
||||
ptrdiff_t offset = vmi_bases[i].__offset ();
|
||||
__PTRDIFF_TYPE__ offset = vmi_bases[i].__offset ();
|
||||
bool is_virtual = vmi_bases[i].__is_virtual_p ();
|
||||
|
||||
if (is_virtual)
|
||||
@ -791,7 +791,7 @@ __do_find_public_src (ptrdiff_t src2dst,
|
||||
}
|
||||
|
||||
bool __class_type_info::
|
||||
__do_dyncast (ptrdiff_t,
|
||||
__do_dyncast (__PTRDIFF_TYPE__,
|
||||
__sub_kind access_path,
|
||||
const __class_type_info *dst_type,
|
||||
const void *obj_ptr,
|
||||
@ -817,7 +817,7 @@ __do_dyncast (ptrdiff_t,
|
||||
}
|
||||
|
||||
bool __si_class_type_info::
|
||||
__do_dyncast (ptrdiff_t src2dst,
|
||||
__do_dyncast (__PTRDIFF_TYPE__ src2dst,
|
||||
__sub_kind access_path,
|
||||
const __class_type_info *dst_type,
|
||||
const void *obj_ptr,
|
||||
@ -857,7 +857,7 @@ __do_dyncast (ptrdiff_t src2dst,
|
||||
// work by filling in things lazily (when we know we need the information),
|
||||
// and opportunisticly take early success or failure results.
|
||||
bool __vmi_class_type_info::
|
||||
__do_dyncast (ptrdiff_t src2dst,
|
||||
__do_dyncast (__PTRDIFF_TYPE__ src2dst,
|
||||
__sub_kind access_path,
|
||||
const __class_type_info *dst_type,
|
||||
const void *obj_ptr,
|
||||
@ -884,12 +884,12 @@ __do_dyncast (ptrdiff_t src2dst,
|
||||
return false;
|
||||
}
|
||||
bool result_ambig = false;
|
||||
for (size_t i = vmi_base_count; i--;)
|
||||
for (__SIZE_TYPE__ i = vmi_base_count; i--;)
|
||||
{
|
||||
__dyncast_result result2;
|
||||
void const *base = obj_ptr;
|
||||
__sub_kind base_access = access_path;
|
||||
ptrdiff_t offset = vmi_bases[i].__offset ();
|
||||
__PTRDIFF_TYPE__ offset = vmi_bases[i].__offset ();
|
||||
bool is_virtual = vmi_bases[i].__is_virtual_p ();
|
||||
|
||||
if (is_virtual)
|
||||
@ -1071,12 +1071,12 @@ __do_upcast (__sub_kind access_path,
|
||||
if (src_details & __flags_unknown_mask)
|
||||
src_details = vmi_flags;
|
||||
|
||||
for (size_t i = vmi_base_count; i--;)
|
||||
for (__SIZE_TYPE__ i = vmi_base_count; i--;)
|
||||
{
|
||||
__upcast_result result2 (src_details);
|
||||
const void *base = obj_ptr;
|
||||
__sub_kind sub_access = access_path;
|
||||
ptrdiff_t offset = vmi_bases[i].__offset ();
|
||||
__PTRDIFF_TYPE__ offset = vmi_bases[i].__offset ();
|
||||
bool is_virtual = vmi_bases[i].__is_virtual_p ();
|
||||
|
||||
if (!vmi_bases[i].__is_public_p ())
|
||||
@ -1141,12 +1141,12 @@ extern "C++" void *
|
||||
__dynamic_cast (const void *src_ptr, // object started from
|
||||
const __class_type_info *src_type, // type of the starting object
|
||||
const __class_type_info *dst_type, // desired target type
|
||||
ptrdiff_t src2dst) // how src and dst are related
|
||||
__PTRDIFF_TYPE__ src2dst) // how src and dst are related
|
||||
{
|
||||
const void *vtable = *static_cast <const void *const *> (src_ptr);
|
||||
const vtable_prefix *prefix =
|
||||
adjust_pointer <vtable_prefix> (vtable,
|
||||
-offsetof (vtable_prefix, origin));
|
||||
adjust_pointer <vtable_prefix>
|
||||
(vtable, -__PTRDIFF_TYPE__(static_cast <vtable_prefix *> (NULL)->origin));
|
||||
const void *whole_ptr =
|
||||
adjust_pointer <void> (src_ptr, prefix->whole_object);
|
||||
const __class_type_info *whole_type = prefix->whole_type;
|
||||
|
@ -41,19 +41,19 @@ namespace __cxxabiv1
|
||||
|
||||
/* allocate and construct array */
|
||||
extern "C++" void *
|
||||
__cxa_vec_new (size_t element_count,
|
||||
size_t element_size,
|
||||
size_t padding_size,
|
||||
__cxa_vec_new (__SIZE_TYPE__ element_count,
|
||||
__SIZE_TYPE__ element_size,
|
||||
__SIZE_TYPE__ padding_size,
|
||||
void (*constructor) (void *),
|
||||
void (*destructor) (void *))
|
||||
{
|
||||
size_t size = element_count * element_size + padding_size;
|
||||
__SIZE_TYPE__ size = element_count * element_size + padding_size;
|
||||
char *base = static_cast <char *> (operator new[] (size));
|
||||
|
||||
if (padding_size)
|
||||
{
|
||||
base += padding_size;
|
||||
reinterpret_cast <size_t *> (base)[-1] = element_count;
|
||||
reinterpret_cast <__SIZE_TYPE__ *> (base)[-1] = element_count;
|
||||
}
|
||||
try
|
||||
{
|
||||
@ -72,12 +72,12 @@ __cxa_vec_new (size_t element_count,
|
||||
/* construct array */
|
||||
extern "C++" void
|
||||
__cxa_vec_ctor (void *array_address,
|
||||
size_t element_count,
|
||||
size_t element_size,
|
||||
__SIZE_TYPE__ element_count,
|
||||
__SIZE_TYPE__ element_size,
|
||||
void (*constructor) (void *),
|
||||
void (*destructor) (void *))
|
||||
{
|
||||
size_t ix = 0;
|
||||
__SIZE_TYPE__ ix = 0;
|
||||
char *ptr = static_cast <char *> (array_address);
|
||||
|
||||
try
|
||||
@ -97,14 +97,14 @@ __cxa_vec_ctor (void *array_address,
|
||||
/* destruct array */
|
||||
extern "C++" void
|
||||
__cxa_vec_dtor (void *array_address,
|
||||
size_t element_count,
|
||||
size_t element_size,
|
||||
__SIZE_TYPE__ element_count,
|
||||
__SIZE_TYPE__ element_size,
|
||||
void (*destructor) (void *))
|
||||
{
|
||||
if (destructor)
|
||||
{
|
||||
char *ptr = static_cast <char *> (array_address);
|
||||
size_t ix = element_count;
|
||||
__SIZE_TYPE__ ix = element_count;
|
||||
bool unwinding = std::uncaught_exception ();
|
||||
|
||||
ptr += element_count * element_size;
|
||||
@ -133,15 +133,15 @@ __cxa_vec_dtor (void *array_address,
|
||||
/* destruct and release array */
|
||||
extern "C++" void
|
||||
__cxa_vec_delete (void *array_address,
|
||||
size_t element_size,
|
||||
size_t padding_size,
|
||||
__SIZE_TYPE__ element_size,
|
||||
__SIZE_TYPE__ padding_size,
|
||||
void (*destructor) (void *))
|
||||
{
|
||||
char *base = static_cast <char *> (array_address);
|
||||
|
||||
if (padding_size)
|
||||
{
|
||||
size_t element_count = reinterpret_cast <size_t *> (base)[-1];
|
||||
__SIZE_TYPE__ element_count = reinterpret_cast <__SIZE_TYPE__ *> (base)[-1];
|
||||
base -= padding_size;
|
||||
try
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user