[C++ PATCH]: new-abi runtime classes
Nathan Sidwell
nathan@codesourcery.com
Thu May 25 04:51:00 GMT 2000
Hi,
I've installed the attached which updates the new-abi's type_info
classes with the newly spec'd pbase_type_info class.
no change in functionality, booted & tested on i686-pc-linux-gnu
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-05-08 Nathan Sidwell <nathan@codesourcery.com>
* inc/cxxabi.h (__pbase_type_info): Define, based on
__pointer_type_info.
(__pointer_type_info): Derive from __pbase_type_info. Adjust.
(__pointer_to_member_type_info): Likewise.
* tinfo2.cc (__pbase_type_info::~__pbase_type_info): Implement.
(__pointer_to_member_type_info::__is_pointer_p): Remove.
(__pointer_type_info::__do_catch): Rename to ...
(__pbase_type_info::__do_catch): ... here. Adjust.
(__pbase_type_info::__pointer_catch): Implement.
(__pointer_type_info::__pointer_catch): Adjust.
(__pointer_to_member_type_info::__pointer_catch): Adjust.
Index: cp/inc/cxxabi.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/inc/cxxabi.h,v
retrieving revision 1.12
diff -c -3 -p -r1.12 cxxabi.h
*** cxxabi.h 2000/05/08 20:52:32 1.12
--- cxxabi.h 2000/05/08 22:30:27
*************** public:
*** 73,120 ****
{ }
};
- /* type information for pointer to data or function, but not pointer to member */
- class __pointer_type_info
- : public std::type_info
- {
- /* abi defined member variables */
- public:
- int quals; /* qualification of the target object */
- const std::type_info *type; /* type of pointed to object */
-
- /* abi defined member functions */
- public:
- virtual ~__pointer_type_info ();
- public:
- explicit __pointer_type_info (const char *__n,
- int __quals,
- const std::type_info *__type)
- : std::type_info (__n), quals (__quals), type (__type)
- { }
-
- /* implementation defined types */
- public:
- enum quals_masks {
- const_mask = 0x1,
- volatile_mask = 0x2,
- restrict_mask = 0x4,
- incomplete_mask = 0x8,
- incomplete_class_mask = 0x10
- };
-
- /* implementation defined member functions */
- protected:
- virtual bool __is_pointer_p () const;
- protected:
- virtual bool __do_catch (const std::type_info *__thr_type,
- void **__thr_obj,
- unsigned __outer) const;
- protected:
- virtual bool __pointer_catch (const __pointer_type_info *__thr_type,
- void **__thr_obj,
- unsigned __outer) const;
- };
-
/* type information for array objects */
class __array_type_info
: public std::type_info
--- 73,78 ----
*************** public:
*** 157,166 ****
: std::type_info (__n)
{ }
};
! /* type information for a pointer to member variable (not function) */
class __pointer_to_member_type_info
! : public __pointer_type_info
{
/* abi defined member variables */
public:
--- 115,188 ----
: std::type_info (__n)
{ }
};
+
+ /* common type information for simple pointers and pointers to member */
+ class __pbase_type_info
+ : public std::type_info
+ {
+ /* abi defined member variables */
+ public:
+ int quals; /* qualification of the target object */
+ const std::type_info *type; /* type of pointed to object */
! /* abi defined member functions */
! public:
! virtual ~__pbase_type_info ();
! public:
! explicit __pbase_type_info (const char *__n,
! int __quals,
! const std::type_info *__type)
! : std::type_info (__n), quals (__quals), type (__type)
! { }
!
! /* implementation defined types */
! public:
! enum quals_masks {
! const_mask = 0x1,
! volatile_mask = 0x2,
! restrict_mask = 0x4,
! incomplete_mask = 0x8,
! incomplete_class_mask = 0x10
! };
!
! /* implementation defined member functions */
! protected:
! virtual bool __do_catch (const std::type_info *__thr_type,
! void **__thr_obj,
! unsigned __outer) const;
! protected:
! inline virtual bool __pointer_catch (const __pbase_type_info *__thr_type,
! void **__thr_obj,
! unsigned __outer) const;
! };
!
! /* type information for simple pointers */
! class __pointer_type_info
! : public __pbase_type_info
! {
! /* abi defined member functions */
! public:
! virtual ~__pointer_type_info ();
! public:
! explicit __pointer_type_info (const char *__n,
! int __quals,
! const std::type_info *__type)
! : __pbase_type_info (__n, __quals, __type)
! { }
!
! /* implementation defined member functions */
! protected:
! virtual bool __is_pointer_p () const;
!
! protected:
! virtual bool __pointer_catch (const __pbase_type_info *__thr_type,
! void **__thr_obj,
! unsigned __outer) const;
! };
!
! /* type information for a pointer to member variable */
class __pointer_to_member_type_info
! : public __pbase_type_info
{
/* abi defined member variables */
public:
*************** public:
*** 174,187 ****
int __quals,
const std::type_info *__type,
const __class_type_info *__klass)
! : __pointer_type_info (__n, __quals, __type), klass (__klass)
{ }
/* implementation defined member functions */
- protected:
- virtual bool __is_pointer_p () const;
protected:
! virtual bool __pointer_catch (const __pointer_type_info *__thr_type,
void **__thr_obj,
unsigned __outer) const;
};
--- 196,207 ----
int __quals,
const std::type_info *__type,
const __class_type_info *__klass)
! : __pbase_type_info (__n, __quals, __type), klass (__klass)
{ }
/* implementation defined member functions */
protected:
! virtual bool __pointer_catch (const __pbase_type_info *__thr_type,
void **__thr_obj,
unsigned __outer) const;
};
Index: cp/tinfo2.cc
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/tinfo2.cc,v
retrieving revision 1.23
diff -c -3 -p -r1.23 tinfo2.cc
*** tinfo2.cc 2000/05/02 01:25:15 1.23
--- tinfo2.cc 2000/05/08 22:30:27
*************** __fundamental_type_info::
*** 108,117 ****
~__fundamental_type_info ()
{}
- __pointer_type_info::
- ~__pointer_type_info ()
- {}
-
__array_type_info::
~__array_type_info ()
{}
--- 108,113 ----
*************** __enum_type_info::
*** 124,129 ****
--- 120,133 ----
~__enum_type_info ()
{}
+ __pbase_type_info::
+ ~__pbase_type_info ()
+ {}
+
+ __pointer_type_info::
+ ~__pointer_type_info ()
+ {}
+
__pointer_to_member_type_info::
~__pointer_to_member_type_info ()
{}
*************** __is_function_p () const
*** 140,153 ****
return true;
}
! bool __pointer_to_member_type_info::
! __is_pointer_p () const
! {
! return false;
! }
!
!
! bool __pointer_type_info::
__do_catch (const type_info *thr_type,
void **thr_obj,
unsigned outer) const
--- 144,150 ----
return true;
}
! bool __pbase_type_info::
__do_catch (const type_info *thr_type,
void **thr_obj,
unsigned outer) const
*************** __do_catch (const type_info *thr_type,
*** 163,170 ****
// But for that to be valid, our outer pointers must be const qualified.
return false;
! const __pointer_type_info *thrown_type =
! static_cast <const __pointer_type_info *> (thr_type);
if (thrown_type->quals & ~quals)
// We're less qualified.
--- 160,167 ----
// But for that to be valid, our outer pointers must be const qualified.
return false;
! const __pbase_type_info *thrown_type =
! static_cast <const __pbase_type_info *> (thr_type);
if (thrown_type->quals & ~quals)
// We're less qualified.
*************** __do_catch (const type_info *thr_type,
*** 176,183 ****
return __pointer_catch (thrown_type, thr_obj, outer);
}
bool __pointer_type_info::
! __pointer_catch (const __pointer_type_info *thrown_type,
void **thr_obj,
unsigned outer) const
{
--- 173,188 ----
return __pointer_catch (thrown_type, thr_obj, outer);
}
+ inline bool __pbase_type_info::
+ __pointer_catch (const __pbase_type_info *thrown_type,
+ void **thr_obj,
+ unsigned outer) const
+ {
+ return type->__do_catch (thrown_type->type, thr_obj, outer + 2);
+ }
+
bool __pointer_type_info::
! __pointer_catch (const __pbase_type_info *thrown_type,
void **thr_obj,
unsigned outer) const
{
*************** __pointer_catch (const __pointer_type_in
*** 187,197 ****
return !thrown_type->type->__is_function_p ();
}
! return type->__do_catch (thrown_type->type, thr_obj, outer + 2);
}
bool __pointer_to_member_type_info::
! __pointer_catch (const __pointer_type_info *thr_type,
void **thr_obj,
unsigned outer) const
{
--- 192,202 ----
return !thrown_type->type->__is_function_p ();
}
! return __pbase_type_info::__pointer_catch (thrown_type, thr_obj, outer);
}
bool __pointer_to_member_type_info::
! __pointer_catch (const __pbase_type_info *thr_type,
void **thr_obj,
unsigned outer) const
{
*************** __pointer_catch (const __pointer_type_in
*** 203,209 ****
if (*klass != *thrown_type->klass)
return false; // not pointers to member of same class
! return type->__do_catch (thrown_type->type, thr_obj, outer + 2);
}
} // namespace std
--- 208,214 ----
if (*klass != *thrown_type->klass)
return false; // not pointers to member of same class
! return __pbase_type_info::__pointer_catch (thrown_type, thr_obj, outer);
}
} // namespace std
More information about the Gcc-patches
mailing list