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 pointer to member


Hi,
I've installed the attached which fixes a bug in emission of
typeinfo for pointer to member function. It also renames the
ptmd_* things (pointer to member data) to ptm_*, because
they do functions too (unlike the old-abi which separates them).

no change in 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-05-25  Nathan Sidwell  <nathan@codesourcery.com>

	* cp-tree.h (CPTI_PTMD_DESC_TYPE): Rename to ...
	(CPTI_PTMD_DESC_TYPE): ... here.
	(ptmd_desc_type_node): Rename to ...
	(ptm_desc_type_node): ... here.
	* decl.c: Likewise.
	* rtti.c (ptmd_initializer): Rename to ...
	(ptm_initializer): ... here.
	(sythesize_tinfo_var): Adjust. Deal with pointer to member
	function.
	(create_tinfo_types): Adjust.

Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.460
diff -c -3 -p -r1.460 cp-tree.h
*** cp-tree.h	2000/05/24 22:56:53	1.460
--- cp-tree.h	2000/05/25 16:48:58
*************** enum cp_tree_index
*** 540,546 ****
      CPTI_CLASS_DESC_TYPE,
      CPTI_SI_CLASS_DESC_TYPE,
      CPTI_VMI_CLASS_DESC_TYPE,
!     CPTI_PTMD_DESC_TYPE,
      CPTI_BASE_DESC_TYPE,
      
      CPTI_CLASS_TYPE,
--- 540,546 ----
      CPTI_CLASS_DESC_TYPE,
      CPTI_SI_CLASS_DESC_TYPE,
      CPTI_VMI_CLASS_DESC_TYPE,
!     CPTI_PTM_DESC_TYPE,
      CPTI_BASE_DESC_TYPE,
      
      CPTI_CLASS_TYPE,
*************** extern tree cp_global_trees[CPTI_MAX];
*** 632,638 ****
  #define class_desc_type_node		cp_global_trees[CPTI_CLASS_DESC_TYPE]
  #define si_class_desc_type_node		cp_global_trees[CPTI_SI_CLASS_DESC_TYPE]
  #define vmi_class_desc_type_node	cp_global_trees[CPTI_VMI_CLASS_DESC_TYPE]
! #define ptmd_desc_type_node		cp_global_trees[CPTI_PTMD_DESC_TYPE]
  #define base_desc_type_node		cp_global_trees[CPTI_BASE_DESC_TYPE]
  
  #define class_type_node			cp_global_trees[CPTI_CLASS_TYPE]
--- 632,638 ----
  #define class_desc_type_node		cp_global_trees[CPTI_CLASS_DESC_TYPE]
  #define si_class_desc_type_node		cp_global_trees[CPTI_SI_CLASS_DESC_TYPE]
  #define vmi_class_desc_type_node	cp_global_trees[CPTI_VMI_CLASS_DESC_TYPE]
! #define ptm_desc_type_node		cp_global_trees[CPTI_PTM_DESC_TYPE]
  #define base_desc_type_node		cp_global_trees[CPTI_BASE_DESC_TYPE]
  
  #define class_type_node			cp_global_trees[CPTI_CLASS_TYPE]
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.611
diff -c -3 -p -r1.611 decl.c
*** decl.c	2000/05/24 22:56:53	1.611
--- decl.c	2000/05/25 16:49:03
*************** tree error_mark_list;
*** 210,216 ****
  	tree bltn_desc_type_node, ptr_desc_type_node;
  	tree ary_desc_type_node, func_desc_type_node, enum_desc_type_node;
  	tree class_desc_type_node, si_class_desc_type_node, vmi_class_desc_type_node;
! 	tree ptmd_desc_type_node;
  	tree base_desc_type_node;
  #if 0
     Not needed yet?  May be needed one day?
--- 210,216 ----
  	tree bltn_desc_type_node, ptr_desc_type_node;
  	tree ary_desc_type_node, func_desc_type_node, enum_desc_type_node;
  	tree class_desc_type_node, si_class_desc_type_node, vmi_class_desc_type_node;
! 	tree ptm_desc_type_node;
  	tree base_desc_type_node;
  #if 0
     Not needed yet?  May be needed one day?
Index: cp/rtti.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/rtti.c,v
retrieving revision 1.90
diff -c -3 -p -r1.90 rtti.c
*** rtti.c	2000/05/24 06:15:04	1.90
--- rtti.c	2000/05/25 16:49:03
*************** static int target_incomplete_p PARAMS((t
*** 66,72 ****
  static tree tinfo_base_init PARAMS((tree, tree));
  static tree generic_initializer PARAMS((tree, tree));
  static tree ptr_initializer PARAMS((tree, tree, int *));
! static tree ptmd_initializer PARAMS((tree, tree, int *));
  static tree dfs_class_hint_mark PARAMS ((tree, void *));
  static tree dfs_class_hint_unmark PARAMS ((tree, void *));
  static int class_hint_flags PARAMS((tree));
--- 66,72 ----
  static tree tinfo_base_init PARAMS((tree, tree));
  static tree generic_initializer PARAMS((tree, tree));
  static tree ptr_initializer PARAMS((tree, tree, int *));
! static tree ptm_initializer PARAMS((tree, tree, int *));
  static tree dfs_class_hint_mark PARAMS ((tree, void *));
  static tree dfs_class_hint_unmark PARAMS ((tree, void *));
  static int class_hint_flags PARAMS((tree));
*************** ptr_initializer (desc, target, non_publi
*** 1385,1391 ****
     base.  */
  
  static tree
! ptmd_initializer (desc, target, non_public_ptr)
       tree desc;
       tree target;
       int *non_public_ptr;
--- 1385,1391 ----
     base.  */
  
  static tree
! ptm_initializer (desc, target, non_public_ptr)
       tree desc;
       tree target;
       int *non_public_ptr;
*************** synthesize_tinfo_var (target_type, real_
*** 1528,1535 ****
      case POINTER_TYPE:
        if (TYPE_PTRMEM_P (target_type))
          {
!           var_type = ptmd_desc_type_node;
!           var_init = ptmd_initializer (var_type, target_type, &non_public);
          }
        else
          {
--- 1528,1535 ----
      case POINTER_TYPE:
        if (TYPE_PTRMEM_P (target_type))
          {
!           var_type = ptm_desc_type_node;
!           var_init = ptm_initializer (var_type, target_type, &non_public);
          }
        else
          {
*************** synthesize_tinfo_var (target_type, real_
*** 1561,1568 ****
        break;
      case UNION_TYPE:
      case RECORD_TYPE:
!       if (!COMPLETE_TYPE_P (target_type))
          {
            /* Emit a non-public class_type_info.  */
            non_public = 1;
            var_type = class_desc_type_node;
--- 1561,1573 ----
        break;
      case UNION_TYPE:
      case RECORD_TYPE:
!       if (TYPE_PTRMEMFUNC_P (target_type))
          {
+           var_type = ptm_desc_type_node;
+           var_init = ptm_initializer (var_type, target_type, &non_public);
+         }
+       else if (!COMPLETE_TYPE_P (target_type))
+         {
            /* Emit a non-public class_type_info.  */
            non_public = 1;
            var_type = class_desc_type_node;
*************** create_tinfo_types ()
*** 1853,1866 ****
        ("__fundamental_type_info", 0,
         NULL);
  
-   /* Pointer type_info. Adds two fields, qualification mask
-      and pointer to the pointed to type.  */
-   ptr_desc_type_node = create_pseudo_type_info
-       ("__pointer_type_info", 0,
-        build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
-        build_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
-        NULL);
- 
    /* Array, function and enum type_info. No additional fields. */
    ary_desc_type_node = create_pseudo_type_info
        ("__array_type_info", 0,
--- 1858,1863 ----
*************** create_tinfo_types ()
*** 1900,1909 ****
    /* General heirarchy is created as necessary in this vector. */
    vmi_class_desc_type_node = make_tree_vec (10);
    
    /* Pointer to member data type_info.  Add qualifications flags,
       pointer to the member's type info and pointer to the class.
!      This is really a descendant of __pointer_type_info.  */
!   ptmd_desc_type_node = create_pseudo_type_info
         ("__pointer_to_member_type_info", 0,
          build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
          build_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
--- 1897,1915 ----
    /* General heirarchy is created as necessary in this vector. */
    vmi_class_desc_type_node = make_tree_vec (10);
    
+   /* Pointer type_info. Adds two fields, qualification mask
+      and pointer to the pointed to type.  This is really a descendant of
+      __pbase_type_info. */
+   ptr_desc_type_node = create_pseudo_type_info
+       ("__pointer_type_info", 0,
+        build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
+        build_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
+        NULL);
+ 
    /* Pointer to member data type_info.  Add qualifications flags,
       pointer to the member's type info and pointer to the class.
!      This is really a descendant of __pbase_type_info.  */
!   ptm_desc_type_node = create_pseudo_type_info
         ("__pointer_to_member_type_info", 0,
          build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
          build_decl (FIELD_DECL, NULL_TREE, ptr_type_info),

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