From fc0e7bf5d137416b780ce3172ebde7a16870378d Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Thu, 9 Sep 1999 01:47:02 +0000 Subject: [PATCH] cp-tree.h (saved_scope): Remove old_binding_level and function_decl. * 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 | 5 +++++ gcc/cp/cp-tree.h | 15 +++++++++------ gcc/cp/decl.c | 24 +++++++----------------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ddd0c68e10c..a15b3bb2820 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 1999-09-08 Mark Mitchell + * 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. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index bba4076b856..6da2463350d 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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. */ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index c75cddcd1c1..dc2850e2448 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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; -- 2.30.2