This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[C++ patch] new abi vmi member names


Hi,
Mark pointed out that when the flags moved from __class_type_info into
__vmi_class_type_info, the member names of the latter became specified.
This patch makes us conform to those names. no change to old-abi.

booted and 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-04-07  Nathan Sidwell  <nathan@codesourcery.com>

	Rename abi::__vmi_class_type_info members.
	* inc/cxxabi.h (__vmi_class_type_info): Rename details, n_bases,
	base_list, detail_masks members to vmi_flags, vmi_base_count,
	vmi_bases and vmi_flags_masks respectively.
	(__vmi_class_type_info::vmi_flags_masks): Rename
	details_unknown_mask to flags_unknown_mask.
	* tinfo.cc (__class_type_info::do_upcast): Adjust.
	(__vmi_class_type_info::do_find_public_src): Adjust.
	(__vmi_class_type_info::do_dyncast): Adjust.
	(__vmi_class_type_info::do_upcast): Adjust.
	
Index: cp/tinfo.cc
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/tinfo.cc,v
retrieving revision 1.23
diff -c -3 -p -r1.23 tinfo.cc
*** tinfo.cc	2000/04/07 09:07:24	1.23
--- tinfo.cc	2000/04/07 09:15:51
*************** do_catch (const type_info *thr_type, voi
*** 667,673 ****
  bool __class_type_info::
  do_upcast (const __class_type_info *dst_type, void **obj_ptr) const
  {
!   upcast_result result (__vmi_class_type_info::details_unknown_mask);
    
    if (do_upcast (contained_public, dst_type, *obj_ptr, result))
      return false;
--- 667,673 ----
  bool __class_type_info::
  do_upcast (const __class_type_info *dst_type, void **obj_ptr) const
  {
!   upcast_result result (__vmi_class_type_info::flags_unknown_mask);
    
    if (do_upcast (contained_public, dst_type, *obj_ptr, result))
      return false;
*************** do_find_public_src (ptrdiff_t src2dst,
*** 721,734 ****
    if (obj_ptr == src_ptr && *this == *src_type)
      return contained_public;
    
!   for (size_t i = n_bases; i--;)
      {
!       if (!base_list[i].is_public_p ())
          continue; // Not public, can't be here.
        
        const void *base = obj_ptr;
!       ptrdiff_t offset = base_list[i].offset ();
!       bool is_virtual = base_list[i].is_virtual_p ();
        
        if (is_virtual)
          {
--- 721,734 ----
    if (obj_ptr == src_ptr && *this == *src_type)
      return contained_public;
    
!   for (size_t 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 ();
!       bool is_virtual = vmi_bases[i].is_virtual_p ();
        
        if (is_virtual)
          {
*************** do_find_public_src (ptrdiff_t src2dst,
*** 737,743 ****
          }
        base = convert_to_base (base, is_virtual, offset);
        
!       sub_kind base_kind = base_list[i].base->do_find_public_src
                                (src2dst, base, src_type, src_ptr);
        if (contained_p (base_kind))
          {
--- 737,743 ----
          }
        base = convert_to_base (base, is_virtual, offset);
        
!       sub_kind base_kind = vmi_bases[i].base->do_find_public_src
                                (src2dst, base, src_type, src_ptr);
        if (contained_p (base_kind))
          {
*************** do_dyncast (ptrdiff_t src2dst,
*** 844,866 ****
        return false;
      }
    bool result_ambig = false;
!   for (size_t i = n_bases; i--;)
      {
        dyncast_result result2;
        void const *base = obj_ptr;
        sub_kind base_access = access_path;
!       ptrdiff_t offset = base_list[i].offset ();
!       bool is_virtual = base_list[i].is_virtual_p ();
        
        if (is_virtual)
          base_access = sub_kind (base_access | contained_virtual_mask);
        base = convert_to_base (base, is_virtual, offset);
  
!       if (!base_list[i].is_public_p ())
          base_access = sub_kind (base_access & ~contained_public_mask);
        
        bool result2_ambig
!           = base_list[i].base->do_dyncast (src2dst, base_access,
                                             dst_type, base,
                                             src_type, src_ptr, result2);
        result.whole2src = sub_kind (result.whole2src | result2.whole2src);
--- 844,866 ----
        return false;
      }
    bool result_ambig = false;
!   for (size_t 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 ();
!       bool is_virtual = vmi_bases[i].is_virtual_p ();
        
        if (is_virtual)
          base_access = sub_kind (base_access | contained_virtual_mask);
        base = convert_to_base (base, is_virtual, offset);
  
!       if (!vmi_bases[i].is_public_p ())
          base_access = sub_kind (base_access & ~contained_public_mask);
        
        bool result2_ambig
!           = vmi_bases[i].base->do_dyncast (src2dst, base_access,
                                             dst_type, base,
                                             src_type, src_ptr, result2);
        result.whole2src = sub_kind (result.whole2src | result2.whole2src);
*************** do_upcast (sub_kind access_path,
*** 1028,1045 ****
      }
    
    int src_details = result.src_details;
!   if (src_details & details_unknown_mask)
!     src_details = details;
    
!   for (size_t i = n_bases; i--;)
      {
        upcast_result result2 (src_details);
        const void *base = obj_ptr;
        sub_kind sub_access = access_path;
!       ptrdiff_t offset = base_list[i].offset ();
!       bool is_virtual = base_list[i].is_virtual_p ();
        
!       if (!base_list[i].is_public_p ())
          {
            if (!(src_details & non_diamond_repeat_mask))
              // original cannot have an ambiguous base
--- 1028,1045 ----
      }
    
    int src_details = result.src_details;
!   if (src_details & flags_unknown_mask)
!     src_details = vmi_flags;
    
!   for (size_t 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 ();
!       bool is_virtual = vmi_bases[i].is_virtual_p ();
        
!       if (!vmi_bases[i].is_public_p ())
          {
            if (!(src_details & non_diamond_repeat_mask))
              // original cannot have an ambiguous base
*************** do_upcast (sub_kind access_path,
*** 1051,1066 ****
        if (base)
          base = convert_to_base (base, is_virtual, offset);
        
!       if (base_list[i].base->do_upcast (sub_access, dst, base, result2))
          return true; // must fail
        if (result2.base_type)
          {
            if (result2.base_type == nonvirtual_base_type && is_virtual)
!             result2.base_type = base_list[i].base;
            if (!result.base_type)
              {
                result = result2;
!               if (!(details & non_diamond_repeat_mask))
                  // cannot have an ambiguous other base
                  return false;
              }
--- 1051,1066 ----
        if (base)
          base = convert_to_base (base, is_virtual, offset);
        
!       if (vmi_bases[i].base->do_upcast (sub_access, dst, base, result2))
          return true; // must fail
        if (result2.base_type)
          {
            if (result2.base_type == nonvirtual_base_type && is_virtual)
!             result2.base_type = vmi_bases[i].base;
            if (!result.base_type)
              {
                result = result2;
!               if (!(vmi_flags & non_diamond_repeat_mask))
                  // cannot have an ambiguous other base
                  return false;
              }
Index: cp/inc/cxxabi.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/inc/cxxabi.h,v
retrieving revision 1.3
diff -c -3 -p -r1.3 cxxabi.h
*** cxxabi.h	2000/04/06 11:53:30	1.3
--- cxxabi.h	2000/04/07 09:15:51
*************** protected:
*** 331,339 ****
  class __vmi_class_type_info : public __class_type_info {
  /* abi defined member variables */
  public:
!   int details;      /* details about the class heirarchy */
!   int n_bases;      /* number of direct bases */
!   __base_class_info base_list[1]; /* array of bases */
    /* The array of bases uses the trailing array struct hack
       so this class is not constructable with a normal constructor. It is
       internally generated by the compiler. */
--- 331,339 ----
  class __vmi_class_type_info : public __class_type_info {
  /* abi defined member variables */
  public:
!   int vmi_flags;                  /* details about the class heirarchy */
!   int vmi_base_count;             /* number of direct bases */
!   __base_class_info vmi_bases[1]; /* array of bases */
    /* The array of bases uses the trailing array struct hack
       so this class is not constructable with a normal constructor. It is
       internally generated by the compiler. */
*************** public:
*** 343,361 ****
    virtual ~__vmi_class_type_info ();
  public:
    explicit __vmi_class_type_info (const char *n_,
!                                   int details_)
!     : __class_type_info (n_), details (details_), n_bases (0)
      { }
  
  /* implementation defined types */
  public:
!   enum detail_masks {
      non_diamond_repeat_mask = 0x1,   /* distinct instance of repeated base */
      diamond_shaped_mask = 0x2,       /* diamond shaped multiple inheritance */
      non_public_base_mask = 0x4,      /* has non-public direct or indirect base */
      public_base_mask = 0x8,          /* has public base (direct) */
      
!     details_unknown_mask = 0x10
    };
  
  /* implementation defined member functions */
--- 343,361 ----
    virtual ~__vmi_class_type_info ();
  public:
    explicit __vmi_class_type_info (const char *n_,
!                                   int flags_)
!     : __class_type_info (n_), vmi_flags (flags_), vmi_base_count (0)
      { }
  
  /* implementation defined types */
  public:
!   enum vmi_flags_masks {
      non_diamond_repeat_mask = 0x1,   /* distinct instance of repeated base */
      diamond_shaped_mask = 0x2,       /* diamond shaped multiple inheritance */
      non_public_base_mask = 0x4,      /* has non-public direct or indirect base */
      public_base_mask = 0x8,          /* has public base (direct) */
      
!     flags_unknown_mask = 0x10
    };
  
  /* implementation defined member functions */
2000-04-07  Nathan Sidwell  <nathan@codesourcery.com>

	* g++.old-deja/g++.abi/vmihint.C: Adjust __vmi_class_type_info
	member name.

Index: testsuite/g++.old-deja/g++.abi/vmihint.C
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/g++.old-deja/g++.abi/vmihint.C,v
retrieving revision 1.1
diff -c -3 -p -r1.1 vmihint.C
*** vmihint.C	2000/04/06 14:12:34	1.1
--- vmihint.C	2000/04/07 16:58:23
*************** int expect (int flags, type_info const &
*** 36,42 ****
        dynamic_cast <__vmi_class_type_info const *> (&info);
    if (!ptr)
      return 0;
!   if (ptr->details != flags)
      return 0;
    return 1;
  }
--- 36,42 ----
        dynamic_cast <__vmi_class_type_info const *> (&info);
    if (!ptr)
      return 0;
!   if (ptr->vmi_flags != flags)
      return 0;
    return 1;
  }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]