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 for name-lookup



Here's a patch that fixes the problem with libio not compiling over
the last couple of days on certain systems.

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com

1999-03-15  Mark Mitchell  <mark@markmitchell.com>

	* decl.c (xref_basetypes): Set CLASSTYPE_VBASECLASSES here.
	* tree.c (layout_basetypes): Not here.
	* search.c (dfs_search): Remove; no longer used.
	
Index: testsuite/g++.old-deja/g++.other/lookup9.C
===================================================================
RCS file: lookup9.C
diff -N lookup9.C
*** /dev/null	Sat Dec  5 20:30:03 1998
--- lookup9.C	Mon Mar 15 13:03:52 1999
***************
*** 0 ****
--- 1,9 ----
+ // Build don't link:
+ 
+ struct S {
+   typedef long I;
+ };
+ 
+ struct D : virtual public S {
+   I i;
+ };
Index: cp/decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.320
diff -c -p -r1.320 decl.c
*** decl.c	1999/03/09 23:02:32	1.320
--- decl.c	1999/03/15 21:04:03
*************** xref_basetypes (code_type_node, name, re
*** 12533,12538 ****
--- 12533,12542 ----
      CLEAR_CLASSTYPE_MARKED (BINFO_TYPE (TREE_VEC_ELT (binfos, i)));
    CLEAR_CLASSTYPE_MARKED (ref);
  
+   /* Now that we know all the base-classes, set up the list of virtual
+      bases.  */
+   CLASSTYPE_VBASECLASSES (ref) = get_vbase_types (ref);
+ 
    pop_obstacks ();
  }
    
Index: cp/search.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/search.c,v
retrieving revision 1.86
diff -c -p -r1.86 search.c
*** search.c	1999/03/12 17:16:52	1.86
--- search.c	1999/03/15 21:04:08
*************** convert_pointer_to_single_level (to_type
*** 2073,2113 ****
  			   last, 1);
  }
  
- /* Like dfs_walk, but only walk until fn returns something, and return
-    that.  We also use the real vbase binfos instead of the placeholders
-    in the normal binfo hierarchy.  START is the most-derived type for this
-    hierarchy, so that we can find the vbase binfos.  */
- 
- static tree
- dfs_search (binfo, fn, start)
-      tree binfo, start;
-      tree (*fn) PROTO((tree));
- {
-   tree binfos = BINFO_BASETYPES (binfo);
-   int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-   tree retval;
- 
-   for (i = 0; i < n_baselinks; i++)
-     {
-       tree base_binfo = TREE_VEC_ELT (binfos, i);
- 
-       if (TREE_CODE (BINFO_TYPE (base_binfo)) == TEMPLATE_TYPE_PARM
- 	  || TREE_CODE (BINFO_TYPE (base_binfo)) == TEMPLATE_TEMPLATE_PARM)
- 	/* Pass */;
-       else
- 	{
- 	  if (TREE_VIA_VIRTUAL (base_binfo) && start)
- 	    base_binfo = binfo_member (BINFO_TYPE (base_binfo),
- 				       CLASSTYPE_VBASECLASSES (start));
- 	  retval = dfs_search (base_binfo, fn, start);
- 	  if (retval)
- 	    return retval;
- 	}
-     }
- 
-   return fn (binfo);
- }
- 
  tree markedp (binfo, data) 
       tree binfo;
       void *data ATTRIBUTE_UNUSED;
--- 2073,2078 ----
*************** dfs_bfv_queue_p (binfo, data)
*** 3436,3443 ****
    return binfo;
  }
  
! /* Passed to dfs_search by binfo_for_vtable; determine if bvtable comes
!    from BINFO.  */
  
  static tree
  dfs_bfv_helper (binfo, data)
--- 3401,3408 ----
    return binfo;
  }
  
! /* Passed to dfs_walk_real by binfo_for_vtable; determine if bvtable
!    comes from BINFO.  */
  
  static tree
  dfs_bfv_helper (binfo, data)
Index: cp/tree.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/tree.c,v
retrieving revision 1.98
diff -c -p -r1.98 tree.c
*** tree.c	1999/03/06 17:41:36	1.98
--- tree.c	1999/03/15 21:04:09
*************** layout_basetypes (rec, max)
*** 640,646 ****
       TREE_VALUE slot holds the virtual baseclass type.  Note that
       get_vbase_types makes copies of the virtual base BINFOs, so that
       the vbase_types are unshared.  */
!   CLASSTYPE_VBASECLASSES (rec) = vbase_types = get_vbase_types (rec);
  
    my_friendly_assert (TREE_CODE (TYPE_SIZE (rec)) == INTEGER_CST, 19970302);
    const_size = TREE_INT_CST_LOW (TYPE_SIZE (rec));
--- 640,646 ----
       TREE_VALUE slot holds the virtual baseclass type.  Note that
       get_vbase_types makes copies of the virtual base BINFOs, so that
       the vbase_types are unshared.  */
!   vbase_types = CLASSTYPE_VBASECLASSES (rec);
  
    my_friendly_assert (TREE_CODE (TYPE_SIZE (rec)) == INTEGER_CST, 19970302);
    const_size = TREE_INT_CST_LOW (TYPE_SIZE (rec));


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