From: gdr Date: Sun, 25 Jul 2004 17:19:39 +0000 (+0000) Subject: * cp-tree.h (TYPE_SET_PTRMEMFUNC_TYPE): Use GGC_CNEW. X-Git-Tag: upstream/4.9.2~69244 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a33db04ad9bdc78f643d7ccdb2803a1176e34c7e;p=platform%2Fupstream%2Flinaro-gcc.git * cp-tree.h (TYPE_SET_PTRMEMFUNC_TYPE): Use GGC_CNEW. * typeck2.c (abstract_virtuals_error): Use GGC_NEW. * name-lookup.c (binding_entry_make): Use GGC_NEW. (binding_table_construct): Use GGC_CNEWVEC. (binding_table_new): Use GGC_NEW. (cxx_binding_make): Likewise. (begin_scope): Likewise. (push_to_top_level): Use GCC_CNEW. * parser.c (cp_token_cache_new): Likewise. (cp_token_cache_push_token): Likewise. (cp_lexer_new_main): Likewise. (cp_lexer_new_from_tokens): Likewise. (cp_parser_context_new): Likewise. (cp_parser_new): Likewise. (cp_lexer_new_from_tokens): Use GGC_NEWVEC. * lex.c (cxx_make_type): Use GGC_CNEW. (retrofit_lang_decl): Use GGC_NEWVAR. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. * decl.c (use_label): Use GGC_NEW instead of ggc_alloc. (save_function_data): Likewise. (lookup_label): Use GGC_CNEW instead of ggc_alloc_cleared. (cxx_push_function_context): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85150 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6512f4e..5fed734 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,29 @@ +2004-07-25 Gabriel Dos Reis + + * cp-tree.h (TYPE_SET_PTRMEMFUNC_TYPE): Use GGC_CNEW. + * typeck2.c (abstract_virtuals_error): Use GGC_NEW. + * name-lookup.c (binding_entry_make): Use GGC_NEW. + (binding_table_construct): Use GGC_CNEWVEC. + (binding_table_new): Use GGC_NEW. + (cxx_binding_make): Likewise. + (begin_scope): Likewise. + (push_to_top_level): Use GCC_CNEW. + * parser.c (cp_token_cache_new): Likewise. + (cp_token_cache_push_token): Likewise. + (cp_lexer_new_main): Likewise. + (cp_lexer_new_from_tokens): Likewise. + (cp_parser_context_new): Likewise. + (cp_parser_new): Likewise. + (cp_lexer_new_from_tokens): Use GGC_NEWVEC. + * lex.c (cxx_make_type): Use GGC_CNEW. + (retrofit_lang_decl): Use GGC_NEWVAR. + (cxx_dup_lang_specific_decl): Likewise. + (copy_lang_type): Likewise. + * decl.c (use_label): Use GGC_NEW instead of ggc_alloc. + (save_function_data): Likewise. + (lookup_label): Use GGC_CNEW instead of ggc_alloc_cleared. + (cxx_push_function_context): Likewise. + 2004-07-25 Richard Henderson * decl.c (start_preparsed_function): Set DECL_ARTIFICIAL and diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 0274ca9..6c0988c 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5014,8 +5014,9 @@ finish_struct_1 (tree t) n_fields = count_fields (TYPE_FIELDS (t)); if (n_fields > 7) { - struct sorted_fields_type *field_vec = ggc_alloc (sizeof (struct sorted_fields_type) - + n_fields * sizeof (tree)); + struct sorted_fields_type *field_vec = GGC_NEWVAR + (struct sorted_fields_type, + sizeof (struct sorted_fields_type) + n_fields * sizeof (tree)); field_vec->len = n_fields; add_fields_to_record_type (TYPE_FIELDS (t), field_vec, 0); qsort (field_vec->elts, n_fields, sizeof (tree), diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index df395eb..28aed6a 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2448,8 +2448,8 @@ struct lang_decl GTY(()) do { \ if (TYPE_LANG_SPECIFIC (NODE) == NULL) \ { \ - TYPE_LANG_SPECIFIC (NODE) = \ - ggc_alloc_cleared (sizeof (struct lang_type_ptrmem)); \ + TYPE_LANG_SPECIFIC (NODE) = GGC_CNEWVAR \ + (struct lang_type, sizeof (struct lang_type_ptrmem)); \ TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.h.is_lang_type_class = 0; \ } \ TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.record = (VALUE); \ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 64217cf..427d5c5 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2073,7 +2073,7 @@ use_label (tree decl) || named_label_uses->label_decl != decl) { struct named_label_use_list *new_ent; - new_ent = ggc_alloc (sizeof (struct named_label_use_list)); + new_ent = GGC_NEW (struct named_label_use_list); new_ent->label_decl = decl; new_ent->names_in_scope = current_binding_level->names; new_ent->binding_level = current_binding_level; @@ -2109,7 +2109,7 @@ lookup_label (tree id) /* Record this label on the list of labels used in this function. We do this before calling make_label_decl so that we get the IDENTIFIER_LABEL_VALUE before the new label is declared. */ - ent = ggc_alloc_cleared (sizeof (struct named_label_list)); + ent = GGC_CNEW (struct named_label_list); ent->old_value = IDENTIFIER_LABEL_VALUE (id); ent->next = named_labels; named_labels = ent; @@ -10025,7 +10025,7 @@ save_function_data (tree decl) 19990908); /* Make a copy. */ - f = ggc_alloc (sizeof (struct language_function)); + f = GGC_NEW (struct language_function); memcpy (f, cp_function_chain, sizeof (struct language_function)); DECL_SAVED_FUNCTION_DATA (decl) = f; @@ -10672,8 +10672,7 @@ revert_static_member_fn (tree decl) void cxx_push_function_context (struct function * f) { - struct language_function *p - = ggc_alloc_cleared (sizeof (struct language_function)); + struct language_function *p = GGC_CNEW (struct language_function); f->language = p; /* Whenever we start a new function, we destroy temporaries in the diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 6c2eef9..c5b1446 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -654,7 +654,7 @@ retrofit_lang_decl (tree t) else size = sizeof (struct lang_decl_flags); - ld = ggc_alloc_cleared (size); + ld = GGC_CNEWVAR (struct lang_decl, size); ld->decl_flags.can_be_full = CAN_HAVE_FULL_LANG_DECL_P (t) ? 1 : 0; ld->decl_flags.u1sel = TREE_CODE (t) == NAMESPACE_DECL ? 1 : 0; @@ -691,7 +691,7 @@ cxx_dup_lang_specific_decl (tree node) size = sizeof (struct lang_decl_flags); else size = sizeof (struct lang_decl); - ld = ggc_alloc (size); + ld = GGC_NEWVAR (struct lang_decl, size); memcpy (ld, DECL_LANG_SPECIFIC (node), size); DECL_LANG_SPECIFIC (node) = ld; @@ -728,7 +728,7 @@ copy_lang_type (tree node) size = sizeof (struct lang_type); else size = sizeof (struct lang_type_ptrmem); - lt = ggc_alloc (size); + lt = GGC_NEWVAR (struct lang_type, size); memcpy (lt, TYPE_LANG_SPECIFIC (node), size); TYPE_LANG_SPECIFIC (node) = lt; @@ -759,9 +759,7 @@ cxx_make_type (enum tree_code code) if (IS_AGGR_TYPE_CODE (code) || code == BOUND_TEMPLATE_TEMPLATE_PARM) { - struct lang_type *pi; - - pi = ggc_alloc_cleared (sizeof (struct lang_type)); + struct lang_type *pi = GGC_CNEW (struct lang_type); TYPE_LANG_SPECIFIC (t) = pi; pi->u.c.h.is_lang_type_class = 1; diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index ffb03ea..8c36fe8 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -85,7 +85,7 @@ binding_entry_make (tree name, tree type) free_binding_entry = entry->chain; } else - entry = ggc_alloc (sizeof (struct binding_entry_s)); + entry = GGC_NEW (struct binding_entry_s); entry->name = name; entry->type = type; @@ -127,8 +127,7 @@ binding_table_construct (binding_table table, size_t chain_count) { table->chain_count = chain_count; table->entry_count = 0; - table->chain = ggc_alloc_cleared - (table->chain_count * sizeof (binding_entry)); + table->chain = GGC_CNEWVEC (binding_entry, table->chain_count); } /* Make TABLE's entries ready for reuse. */ @@ -161,7 +160,7 @@ binding_table_free (binding_table table) static inline binding_table binding_table_new (size_t chain_count) { - binding_table table = ggc_alloc (sizeof (struct binding_table_s)); + binding_table table = GGC_NEW (struct binding_table_s); table->chain = NULL; binding_table_construct (table, chain_count); return table; @@ -351,7 +350,7 @@ cxx_binding_make (tree value, tree type) free_bindings = binding->previous; } else - binding = ggc_alloc (sizeof (cxx_binding)); + binding = GGC_NEW (cxx_binding); cxx_binding_init (binding, value, type); @@ -1309,7 +1308,7 @@ begin_scope (scope_kind kind, tree entity) free_binding_level = scope->level_chain; } else - scope = ggc_alloc (sizeof (cxx_scope)); + scope = GGC_NEW (cxx_scope); memset (scope, 0, sizeof (cxx_scope)); scope->this_entity = entity; @@ -4941,7 +4940,7 @@ push_to_top_level (void) int need_pop; timevar_push (TV_NAME_LOOKUP); - s = ggc_alloc_cleared (sizeof (struct saved_scope)); + s = GGC_CNEW (struct saved_scope); b = scope_chain ? current_binding_level : 0; diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index fde2c79..f19ab25 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -131,7 +131,7 @@ static void cp_token_cache_push_token static cp_token_cache * cp_token_cache_new (void) { - return ggc_alloc_cleared (sizeof (cp_token_cache)); + return GGC_CNEW (cp_token_cache); } /* Add *TOKEN to *CACHE. */ @@ -145,7 +145,7 @@ cp_token_cache_push_token (cp_token_cache *cache, /* See if we need to allocate a new token block. */ if (!b || b->num_tokens == CP_TOKEN_BLOCK_NUM_TOKENS) { - b = ggc_alloc_cleared (sizeof (cp_token_block)); + b = GGC_CNEW (cp_token_block); b->prev = cache->last; if (cache->last) { @@ -311,7 +311,7 @@ cp_lexer_new_main (void) c_common_no_more_pch (); /* Allocate the memory. */ - lexer = ggc_alloc_cleared (sizeof (cp_lexer)); + lexer = GGC_CNEW (cp_lexer); /* Create the circular buffer. */ lexer->buffer = ggc_calloc (CP_TOKEN_BUFFER_SIZE, sizeof (cp_token)); @@ -350,13 +350,13 @@ cp_lexer_new_from_tokens (cp_token_cache *tokens) ptrdiff_t num_tokens; /* Allocate the memory. */ - lexer = ggc_alloc_cleared (sizeof (cp_lexer)); + lexer = GGC_CNEW (cp_lexer); /* Create a new buffer, appropriately sized. */ num_tokens = 0; for (block = tokens->first; block != NULL; block = block->next) num_tokens += block->num_tokens; - lexer->buffer = ggc_alloc (num_tokens * sizeof (cp_token)); + lexer->buffer = GGC_NEWVEC (cp_token, num_tokens); lexer->buffer_end = lexer->buffer + num_tokens; /* Install the tokens. */ @@ -1348,7 +1348,7 @@ cp_parser_context_new (cp_parser_context* next) memset (context, 0, sizeof (*context)); } else - context = ggc_alloc_cleared (sizeof (cp_parser_context)); + context = GGC_CNEW (cp_parser_context); /* No errors have occurred yet in this context. */ context->status = CP_PARSER_STATUS_KIND_NO_ERROR; /* If this is not the bottomost context, copy information that we @@ -2539,7 +2539,7 @@ cp_parser_new (void) cp_lexer_new_main might load a PCH file. */ lexer = cp_lexer_new_main (); - parser = ggc_alloc_cleared (sizeof (cp_parser)); + parser = GGC_CNEW (cp_parser); parser->lexer = lexer; parser->context = cp_parser_context_new (NULL); diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 53a5c18..3c01828 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -263,7 +263,7 @@ abstract_virtuals_error (tree decl, tree type) slot = htab_find_slot_with_hash (abstract_pending_vars, type, (hashval_t)TYPE_UID (type), INSERT); - pat = ggc_alloc (sizeof (struct pending_abstract_type)); + pat = GGC_NEW (struct pending_abstract_type); pat->type = type; pat->decl = decl; pat->locus = ((decl && DECL_P (decl))