class.c (maybe_fixup_vptrs, [...]): Lose.
authorJason Merrill <jason@yorick.cygnus.com>
Sat, 3 Apr 1999 01:23:24 +0000 (01:23 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 3 Apr 1999 01:23:24 +0000 (20:23 -0500)
* class.c (maybe_fixup_vptrs, build_class_init_list): Lose.
(finish_struct_1): Don't call build_class_init_list.

From-SVN: r26147

gcc/cp/ChangeLog
gcc/cp/class.c

index 186a1e5..813cc21 100644 (file)
@@ -1,3 +1,8 @@
+1999-04-03  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * class.c (maybe_fixup_vptrs, build_class_init_list): Lose.
+       (finish_struct_1): Don't call build_class_init_list.
+
 1999-04-02  Mark Mitchell  <mark@codesourcery.com>
 
        * tinfo.h (__class_type_info): Fix illegal declaration.
index 7fd1eeb..6997d01 100644 (file)
@@ -1540,150 +1540,6 @@ handle_using_decl (using_decl, t, method_vec, fields)
   else
     alter_access (t, binfo, fdecl, access);
 }
-
-/* If FOR_TYPE needs to reinitialize virtual function table pointers
-   for TYPE's sub-objects, add such reinitializations to BASE_INIT_LIST.
-   Returns BASE_INIT_LIST appropriately modified.  */
-
-static tree
-maybe_fixup_vptrs (for_type, binfo, base_init_list)
-     tree for_type, binfo, base_init_list;
-{
-  /* Now reinitialize any slots that don't fall under our virtual
-     function table pointer.  */
-  tree vfields = CLASSTYPE_VFIELDS (BINFO_TYPE (binfo));
-  while (vfields)
-    {
-      tree basetype = VF_NORMAL_VALUE (vfields)
-       ? TYPE_MAIN_VARIANT (VF_NORMAL_VALUE (vfields))
-         : VF_BASETYPE_VALUE (vfields);
-
-      tree base_binfo = get_binfo (basetype, for_type, 0);
-      /* Punt until this is implemented.  */
-      if (1 /* BINFO_MODIFIED (base_binfo) */)
-       {
-         tree base_offset = get_vfield_offset (base_binfo);
-         if (! tree_int_cst_equal (base_offset, get_vfield_offset (TYPE_BINFO (for_type)))
-             && ! tree_int_cst_equal (base_offset, get_vfield_offset (binfo)))
-           base_init_list = tree_cons (error_mark_node, base_binfo,
-                                       base_init_list);
-       }
-      vfields = TREE_CHAIN (vfields);
-    }
-  return base_init_list;
-}
-
-/* If TYPE does not have a constructor, then the compiler must
-   manually deal with all of the initialization this type requires.
-
-   If a base initializer exists only to fill in the virtual function
-   table pointer, then we mark that fact with the TREE_VIRTUAL bit.
-   This way, we avoid multiple initializations of the same field by
-   each virtual function table up the class hierarchy.
-
-   Virtual base class pointers are not initialized here.  They are
-   initialized only at the "top level" of object creation.  If we
-   initialized them here, we would have to skip a lot of work.  */
-
-static void
-build_class_init_list (type)
-     tree type;
-{
-  tree base_init_list = NULL_TREE;
-  tree member_init_list = NULL_TREE;
-
-  /* Since we build member_init_list and base_init_list using
-     tree_cons, backwards fields the all through work.  */
-  tree x;
-  tree binfos = BINFO_BASETYPES (TYPE_BINFO (type));
-  int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
-  for (x = TYPE_FIELDS (type); x; x = TREE_CHAIN (x))
-    {
-      if (TREE_CODE (x) != FIELD_DECL)
-       continue;
-
-      if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (x))
-         || DECL_INITIAL (x) != NULL_TREE)
-       member_init_list = tree_cons (x, type, member_init_list);
-    }
-  member_init_list = nreverse (member_init_list);
-
-  /* We will end up doing this last.  Need special marker
-     to avoid infinite regress.  */
-  if (TYPE_VIRTUAL_P (type))
-    {
-      base_init_list = build_tree_list (error_mark_node, TYPE_BINFO (type));
-      if (CLASSTYPE_NEEDS_VIRTUAL_REINIT (type) == 0)
-       TREE_VALUE (base_init_list) = NULL_TREE;
-      TREE_ADDRESSABLE (base_init_list) = 1;
-    }
-
-  /* Each base class which needs to have initialization
-     of some kind gets to make such requests known here.  */
-  for (i = n_baseclasses-1; i >= 0; i--)
-    {
-      tree base_binfo = TREE_VEC_ELT (binfos, i);
-      tree blist;
-
-      /* Don't initialize virtual baseclasses this way.  */
-      if (TREE_VIA_VIRTUAL (base_binfo))
-       continue;
-
-      if (TYPE_HAS_CONSTRUCTOR (BINFO_TYPE (base_binfo)))
-       {
-         /* ...and the last shall come first...  */
-         base_init_list = maybe_fixup_vptrs (type, base_binfo, base_init_list);
-         base_init_list = tree_cons (NULL_TREE, base_binfo, base_init_list);
-         continue;
-       }
-
-      /* ...ditto...  */
-      base_init_list = maybe_fixup_vptrs (type, base_binfo, base_init_list);
-
-      /* This is normally true for single inheritance.
-        The win is we can shrink the chain of initializations
-        to be done by only converting to the actual type
-        we are interested in.  */
-      if (TREE_VALUE (blist)
-         && TREE_CODE (TREE_VALUE (blist)) == TREE_VEC
-         && tree_int_cst_equal (BINFO_OFFSET (base_binfo),
-                                BINFO_OFFSET (TREE_VALUE (blist))))
-       {
-         if (base_init_list)
-           {
-             /* Does it do more than just fill in a
-                virtual function table pointer?  */
-             if (! TREE_ADDRESSABLE (blist))
-               base_init_list = build_tree_list (blist, base_init_list);
-             /* Can we get by just with the virtual function table
-                pointer that it fills in?  */
-             else if (TREE_ADDRESSABLE (base_init_list)
-                      && TREE_VALUE (base_init_list) == 0)
-               base_init_list = blist;
-             /* Maybe, but it is not obvious as the previous case.  */
-             else if (! CLASSTYPE_NEEDS_VIRTUAL_REINIT (type))
-               {
-                 tree last = tree_last (base_init_list);
-                 while (TREE_VALUE (last)
-                        && TREE_CODE (TREE_VALUE (last)) == TREE_LIST)
-                   last = tree_last (TREE_VALUE (last));
-                 if (TREE_VALUE (last) == 0)
-                   base_init_list = build_tree_list (blist, base_init_list);
-               }
-           }
-         else
-           base_init_list = blist;
-       }
-      else
-       {
-         /* The function expand_aggr_init knows how to do the
-            initialization of `basetype' without getting
-            an explicit `blist'.  */
-         base_init_list = tree_cons (NULL_TREE, base_binfo, base_init_list);
-       }
-    }
-}
 \f
 struct base_info
 {
@@ -4136,11 +3992,7 @@ finish_struct_1 (t, warn_anon)
            TREE_ADDRESSABLE (vfields) = 1;
          vfields = TREE_CHAIN (vfields);
        }
-      if (any_default_members != 0)
-       build_class_init_list (t);
     }
-  else if (TYPE_NEEDS_CONSTRUCTING (t))
-    build_class_init_list (t);
 
   /* Write out inline function definitions.  */
   do_inline_function_hair (t, CLASSTYPE_INLINE_FRIENDS (t));