cp-tree.h (saved_scope): Remove old_binding_level and function_decl.
authorMark Mitchell <mark@codesourcery.com>
Thu, 9 Sep 1999 01:47:02 +0000 (01:47 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 9 Sep 1999 01:47:02 +0000 (01:47 +0000)
* cp-tree.h (saved_scope): Remove old_binding_level and
function_decl.  Tidy up.
* decl.c (mark_saved_scope): Don't set them.
(maybe_push_to_top_level): Clear memory.

From-SVN: r29221

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c

index ddd0c68e10c57b8a2e52c8a8c03a1440d6919f52..a15b3bb28208d9588cfd331cf00ecf28b91206c5 100644 (file)
@@ -1,5 +1,10 @@
 1999-09-08  Mark Mitchell  <mark@codesourcery.com>
 
+       * cp-tree.h (saved_scope): Remove old_binding_level and 
+       function_decl.  Tidy up.
+       * decl.c (mark_saved_scope): Don't set them.
+       (maybe_push_to_top_level): Clear memory.
+
        * decl.c (layout_var_decl): Change prototype.  Don't complete
        types for external objects.
        (check_initializer): Likewise.  Tidy.
index bba4076b856faf762d945150936eed8fad37e810..6da2463350d009750faacc5e0c95ed661b643715 100644 (file)
@@ -520,25 +520,28 @@ extern tree cp_global_trees[CPTI_MAX];
 /* Global state.  */
 
 struct saved_scope {
-  struct binding_level *old_binding_level;
   tree old_bindings;
   tree old_namespace;
-  struct saved_scope *prev;
-  tree class_name, class_type;
+  tree class_name;
+  tree class_type;
   tree access_specifier;
-  tree function_decl;
-  struct binding_level *class_bindings;
   varray_type lang_base;
   tree *lang_stack;
   tree lang_name;
   tree x_function_parms;
   tree template_parms;
-  HOST_WIDE_INT x_processing_template_decl;
   tree x_previous_class_type;
   tree x_previous_class_values;
+
+  HOST_WIDE_INT x_processing_template_decl;
   int x_processing_specialization;
   int x_processing_explicit_instantiation;
+
   char *firstobj;
+
+  struct binding_level *class_bindings;
+
+  struct saved_scope *prev;
 };
 
 /* The current open namespace.  */
index c75cddcd1c1182c29215d47271d60074aaa638ca..dc2850e24481f0f17bef6bb1d40385287b27f4f8 100644 (file)
@@ -2382,14 +2382,12 @@ mark_saved_scope (arg)
   struct saved_scope *t = *(struct saved_scope **)arg;
   while (t)
     {
-      mark_binding_level (&t->old_binding_level);
       mark_binding_level (&t->class_bindings);
       ggc_mark_tree (t->old_bindings);
       ggc_mark_tree (t->old_namespace);
       ggc_mark_tree (t->class_name);
       ggc_mark_tree (t->class_type);
       ggc_mark_tree (t->access_specifier);
-      ggc_mark_tree (t->function_decl);
       if (t->lang_base)
        ggc_mark_tree_varray (t->lang_base);
       ggc_mark_tree (t->lang_name);
@@ -2451,7 +2449,7 @@ maybe_push_to_top_level (pseudo)
      int pseudo;
 {
   struct saved_scope *s
-    = (struct saved_scope *) xmalloc (sizeof (struct saved_scope));
+    = (struct saved_scope *) xcalloc (1, sizeof (struct saved_scope));
   struct binding_level *b;
   tree old_bindings = NULL_TREE;
 
@@ -2485,28 +2483,18 @@ maybe_push_to_top_level (pseudo)
       for (t = b->type_shadowed; t; t = TREE_CHAIN (t))
        SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (t), TREE_VALUE (t));
     }
-  if (scope_chain)
-    *s = *scope_chain;
-  s->old_binding_level = scope_chain ? current_binding_level : 0;
-  s->old_bindings = old_bindings;
-  s->prev = scope_chain;
-  scope_chain = s;
   current_binding_level = b;
 
-  current_class_name = current_class_type = NULL_TREE;
+  s->prev = scope_chain;
+  s->old_bindings = old_bindings;
+
+  scope_chain = s;
   current_function_decl = NULL_TREE;
-  class_binding_level = (struct binding_level *)0;
   VARRAY_TREE_INIT (current_lang_base, 10, "current_lang_base");
   current_lang_stack = &VARRAY_TREE (current_lang_base, 0);
   current_lang_name = lang_name_cplusplus;
   strict_prototype = strict_prototypes_lang_cplusplus;
   named_labels = NULL_TREE;
-  previous_class_type = previous_class_values = NULL_TREE;
-  class_cache_firstobj = 0;
-  processing_specialization = 0;
-  processing_explicit_instantiation = 0;
-  current_template_parms = NULL_TREE;
-  processing_template_decl = 0;
   current_namespace = global_namespace;
 
   push_obstacks (&permanent_obstack, &permanent_obstack);
@@ -7486,6 +7474,8 @@ check_initializer (decl, init)
   if (TREE_CODE (decl) == FIELD_DECL)
     return init;
 
+  type = TREE_TYPE (decl);
+
   /* If `start_decl' didn't like having an initialization, ignore it now.  */
   if (init != NULL_TREE && DECL_INITIAL (decl) == NULL_TREE)
     init = NULL_TREE;