tree-inline.c (copy_body_r): Use explicit cast when converting from void *.

* tree-inline.c (copy_body_r): Use explicit cast when
          converting
        from void *.
        (copy_bb): Likewise.
        (copy_edges_for_bb): Likewise.
        (remap_decl_1): Likewise.
        (estimate_num_insns_1): Likewise.
        * cgraph.c (hash_node): Use explicit cast when converting from
        void *.
        (eq_node): Likewise.
        (cgraph_create_node): Use GGC_CNEW.
        (cgraph_create_edge): Use GGC_NEW.
        (cgraph_remove_node): Use explicit cast when converting from
          void *.
        (hash_varpool_node): Likewise.
        (eq_varpool_node): Likewise.
        (cgraph_varpool_node): Use GGC_CNEW.
        * lambda.h (lambda_vector_new): Use GGC_CNEWVEC.
        * tree-scalar-evolution.c (new_scev_info_str): Use XNEW.
        (eq_scev_info): Use explicit cast when converting from void *.
        (find_var_scev_info): Likewise.
        (set_instantiated_value): Likewise.
        (gather_stats_on_scev_database_1): Likewise.
        * cfgloop.h (simple_loop_desc): Use explicit cast when
          converting
        from void *.
        * c-pch.c (c_common_write_pch): Use XNEWVEC.
        (c_common_read_pch): Likewise.
        * prefix.c (save_string): Use XNEWVEC.
        (translate_name): Use explicit cast when converting from void
          *.
        * c-ppoutput.c (print_line): Use explicit cast when converting
        from void *.
        (pp_dir_change): Likewise.
        * c-cppbuiltin.c (builtin_define_std): Likewise.
        (builtin_define_with_value): Likewise.
        (builtin_define_with_value_n): Likewise.
        (builtin_define_with_int_value): Likewise.
        (builtin_define_type_max): Likewise.
        * c-incpath.c (add_env_var_paths): Use XNEWVEC.
        (add_path): Use XNEW.
        * c-format.c (check_format_info_main): Use GGC_NEW.
        (format_type_warning): Use explicit cast when converting from
          void *.
        * c-typeck.c (alloc_tagged_tu_seen_cache): Use XNEW instead of
        xmalloc. 
        (start_init): Likewise.
        * tree-flow-inline.h (first_referenced_var): Use explicit cast
        when converting from void *.
        (next_referenced_var): Likewise.
        * c-pragma.c (push_alignment): Use GGC_NEW instead of
          ggc_alloc.
        * gensupport.c (lookup_predicate): Use explicit cast to
          convert
        from void *.
        (init_predicate_table): Use XCNEW instead of xcalloc.
        * genpreds.c (process_define_predicate): Likewise.

From-SVN: r108723
This commit is contained in:
Gabriel Dos Reis 2005-12-17 20:45:46 +00:00 committed by Gabriel Dos Reis
parent ef98c52a44
commit cceb18855e
17 changed files with 110 additions and 49 deletions

View File

@ -1,3 +1,56 @@
2005-12-17 Gabriel Dos Reis <gdr@integrable-solutions.net>
* tree-inline.c (copy_body_r): Use explicit cast when converting
from void *.
(copy_bb): Likewise.
(copy_edges_for_bb): Likewise.
(remap_decl_1): Likewise.
(estimate_num_insns_1): Likewise.
* cgraph.c (hash_node): Use explicit cast when converting from
void *.
(eq_node): Likewise.
(cgraph_create_node): Use GGC_CNEW.
(cgraph_create_edge): Use GGC_NEW.
(cgraph_remove_node): Use explicit cast when converting from void *.
(hash_varpool_node): Likewise.
(eq_varpool_node): Likewise.
(cgraph_varpool_node): Use GGC_CNEW.
* lambda.h (lambda_vector_new): Use GGC_CNEWVEC.
* tree-scalar-evolution.c (new_scev_info_str): Use XNEW.
(eq_scev_info): Use explicit cast when converting from void *.
(find_var_scev_info): Likewise.
(set_instantiated_value): Likewise.
(gather_stats_on_scev_database_1): Likewise.
* cfgloop.h (simple_loop_desc): Use explicit cast when converting
from void *.
* c-pch.c (c_common_write_pch): Use XNEWVEC.
(c_common_read_pch): Likewise.
* prefix.c (save_string): Use XNEWVEC.
(translate_name): Use explicit cast when converting from void *.
* c-ppoutput.c (print_line): Use explicit cast when converting
from void *.
(pp_dir_change): Likewise.
* c-cppbuiltin.c (builtin_define_std): Likewise.
(builtin_define_with_value): Likewise.
(builtin_define_with_value_n): Likewise.
(builtin_define_with_int_value): Likewise.
(builtin_define_type_max): Likewise.
* c-incpath.c (add_env_var_paths): Use XNEWVEC.
(add_path): Use XNEW.
* c-format.c (check_format_info_main): Use GGC_NEW.
(format_type_warning): Use explicit cast when converting from void *.
* c-typeck.c (alloc_tagged_tu_seen_cache): Use XNEW instead of
xmalloc.
(start_init): Likewise.
* tree-flow-inline.h (first_referenced_var): Use explicit cast
when converting from void *.
(next_referenced_var): Likewise.
* c-pragma.c (push_alignment): Use GGC_NEW instead of ggc_alloc.
* gensupport.c (lookup_predicate): Use explicit cast to convert
from void *.
(init_predicate_table): Use XCNEW instead of xcalloc.
* genpreds.c (process_define_predicate): Likewise.
2005-12-17 Danny Berlin <dberlin@dberlin.org>
Kenneth Zadeck <zadeck@naturalbridge.com>

View File

@ -577,7 +577,7 @@ void
builtin_define_std (const char *macro)
{
size_t len = strlen (macro);
char *buff = alloca (len + 5);
char *buff = (char *) alloca (len + 5);
char *p = buff + 2;
char *q = p + len;
@ -623,7 +623,7 @@ builtin_define_with_value (const char *macro, const char *expansion, int is_str)
if (is_str)
extra += 2; /* space for two quote marks */
buf = alloca (mlen + elen + extra);
buf = (char *) alloca (mlen + elen + extra);
if (is_str)
sprintf (buf, "%s=\"%s\"", macro, expansion);
else
@ -641,7 +641,7 @@ builtin_define_with_value_n (const char *macro, const char *expansion, size_t el
size_t mlen = strlen (macro);
/* Space for an = and a NUL. */
buf = alloca (mlen + elen + 2);
buf = (char *) alloca (mlen + elen + 2);
memcpy (buf, macro, mlen);
buf[mlen] = '=';
memcpy (buf + mlen + 1, expansion, elen);
@ -659,7 +659,7 @@ builtin_define_with_int_value (const char *macro, HOST_WIDE_INT value)
size_t vlen = 18;
size_t extra = 2; /* space for = and NUL. */
buf = alloca (mlen + vlen + extra);
buf = (char *) alloca (mlen + vlen + extra);
memcpy (buf, macro, mlen);
buf[mlen] = '=';
sprintf (buf + mlen + 1, HOST_WIDE_INT_PRINT_DEC, value);
@ -736,7 +736,8 @@ builtin_define_type_max (const char *macro, tree type, int is_long)
value = values[idx + TYPE_UNSIGNED (type)];
suffix = suffixes[is_long * 2 + TYPE_UNSIGNED (type)];
buf = alloca (strlen (macro) + 1 + strlen (value) + strlen (suffix) + 1);
buf = (char *) alloca (strlen (macro) + 1 + strlen (value)
+ strlen (suffix) + 1);
sprintf (buf, "%s=%s%s", macro, value, suffix);
cpp_define (parse_in, buf);

View File

@ -2077,7 +2077,7 @@ check_format_info_main (format_check_results *res,
fci = fci->chain;
if (fci)
{
wanted_type_ptr = ggc_alloc (sizeof (main_wanted_type));
wanted_type_ptr = GGC_NEW (format_wanted_type);
arg_num++;
wanted_type = *fci->types[length_chars_val].type;
wanted_type_name = fci->types[length_chars_val].name;
@ -2286,7 +2286,7 @@ format_type_warning (const char *descr, const char *format_start,
this is adequate, but formats taking pointers to functions or
arrays would require the full type to be built up in order to
print it with %T. */
p = alloca (pointer_count + 2);
p = (char *) alloca (pointer_count + 2);
if (pointer_count == 0)
p[0] = 0;
else if (c_dialect_cxx ())

View File

@ -109,7 +109,7 @@ add_env_var_paths (const char *env_var, int chain)
path = xstrdup (".");
else
{
path = xmalloc (q - p + 1);
path = XNEWVEC (char, q - p + 1);
memcpy (path, p, q - p);
path[q - p] = '\0';
}
@ -340,7 +340,7 @@ add_path (char *path, int chain, int cxx_aware, bool user_supplied_p)
if (*c == '\\') *c = '/';
#endif
p = xmalloc (sizeof (cpp_dir));
p = XNEW (cpp_dir);
p->next = NULL;
p->name = path;
if (chain == SYSTEM || chain == AFTER)

View File

@ -187,7 +187,7 @@ c_common_write_pch (void)
if (fwrite (&h, sizeof (h), 1, pch_outfile) != 1)
fatal_error ("can%'t write %s: %m", pch_file);
buf = xmalloc (16384);
buf = XNEWVEC (char, 16384);
if (fseek (asm_out_file, asm_file_startpos, SEEK_SET) != 0)
fatal_error ("can%'t seek in %s: %m", asm_file_name);
@ -385,7 +385,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
if (!flag_preprocess_only)
{
unsigned long written;
char * buf = xmalloc (16384);
char * buf = XNEWVEC (char, 16384);
for (written = 0; written < h.asm_size; )
{

View File

@ -246,7 +246,8 @@ print_line (source_location src_loc, const char *special_flags)
const struct line_map *map = linemap_lookup (&line_table, src_loc);
size_t to_file_len = strlen (map->to_file);
unsigned char *to_file_quoted = alloca (to_file_len * 4 + 1);
unsigned char *to_file_quoted =
(unsigned char *) alloca (to_file_len * 4 + 1);
unsigned char *p;
print.src_line = SOURCE_LINE (map, src_loc);
@ -368,7 +369,8 @@ void
pp_dir_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const char *dir)
{
size_t to_file_len = strlen (dir);
unsigned char *to_file_quoted = alloca (to_file_len * 4 + 1);
unsigned char *to_file_quoted =
(unsigned char *) alloca (to_file_len * 4 + 1);
unsigned char *p;
/* cpp_quote_string does not nul-terminate, so we have to do it ourselves. */

View File

@ -74,7 +74,7 @@ push_alignment (int alignment, tree id)
{
align_stack * entry;
entry = ggc_alloc (sizeof (* entry));
entry = GGC_NEW (align_stack);
entry->alignment = alignment;
entry->id = id;

View File

@ -934,7 +934,7 @@ same_translation_unit_p (tree t1, tree t2)
static struct tagged_tu_seen_cache *
alloc_tagged_tu_seen_cache (tree t1, tree t2)
{
struct tagged_tu_seen_cache *tu = xmalloc (sizeof (struct tagged_tu_seen_cache));
struct tagged_tu_seen_cache *tu = XNEW (struct tagged_tu_seen_cache);
tu->next = tagged_tu_seen_base;
tu->t1 = t1;
tu->t2 = t2;
@ -4882,7 +4882,7 @@ void
start_init (tree decl, tree asmspec_tree ATTRIBUTE_UNUSED, int top_level)
{
const char *locus;
struct initializer_stack *p = xmalloc (sizeof (struct initializer_stack));
struct initializer_stack *p = XNEW (struct initializer_stack);
p->decl = constructor_decl;
p->require_constant_value = require_constant_value;

View File

@ -417,7 +417,7 @@ extern void free_simple_loop_desc (struct loop *loop);
static inline struct niter_desc *
simple_loop_desc (struct loop *loop)
{
return loop->aux;
return (struct niter_desc *) loop->aux;
}
/* The properties of the target. */

View File

@ -146,7 +146,7 @@ static int eq_node (const void *, const void *);
static hashval_t
hash_node (const void *p)
{
const struct cgraph_node *n = p;
const struct cgraph_node *n = (const struct cgraph_node *) p;
return (hashval_t) DECL_UID (n->decl);
}
@ -155,7 +155,8 @@ hash_node (const void *p)
static int
eq_node (const void *p1, const void *p2)
{
const struct cgraph_node *n1 = p1, *n2 = p2;
const struct cgraph_node *n1 = (const struct cgraph_node *) p1;
const struct cgraph_node *n2 = (const struct cgraph_node *) p2;
return DECL_UID (n1->decl) == DECL_UID (n2->decl);
}
@ -165,7 +166,7 @@ cgraph_create_node (void)
{
struct cgraph_node *node;
node = ggc_alloc_cleared (sizeof (*node));
node = GGC_CNEW (struct cgraph_node);
node->next = cgraph_nodes;
node->uid = cgraph_max_uid++;
if (cgraph_nodes)
@ -286,7 +287,7 @@ struct cgraph_edge *
cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee,
tree call_stmt, gcov_type count, int nest)
{
struct cgraph_edge *edge = ggc_alloc (sizeof (struct cgraph_edge));
struct cgraph_edge *edge = GGC_NEW (struct cgraph_edge);
#ifdef ENABLE_CHECKING
struct cgraph_edge *e;
@ -472,7 +473,7 @@ cgraph_remove_node (struct cgraph_node *node)
*/
if (!kill_body && *slot)
{
struct cgraph_node *n = *slot;
struct cgraph_node *n = (struct cgraph_node *) *slot;
if (!n->next_clone && !n->global.inlined_to
&& (cgraph_global_info_ready
&& (TREE_ASM_WRITTEN (n->decl) || DECL_EXTERNAL (n->decl))))
@ -697,7 +698,7 @@ dump_varpool (FILE *f)
static hashval_t
hash_varpool_node (const void *p)
{
const struct cgraph_varpool_node *n = p;
const struct cgraph_varpool_node *n = (const struct cgraph_varpool_node *) p;
return (hashval_t) DECL_UID (n->decl);
}
@ -706,7 +707,10 @@ hash_varpool_node (const void *p)
static int
eq_varpool_node (const void *p1, const void *p2)
{
const struct cgraph_varpool_node *n1 = p1, *n2 = p2;
const struct cgraph_varpool_node *n1 =
(const struct cgraph_varpool_node *) p1;
const struct cgraph_varpool_node *n2 =
(const struct cgraph_varpool_node *) p2;
return DECL_UID (n1->decl) == DECL_UID (n2->decl);
}
@ -726,7 +730,7 @@ cgraph_varpool_node (tree decl)
htab_find_slot (cgraph_varpool_hash, &key, INSERT);
if (*slot)
return *slot;
node = ggc_alloc_cleared (sizeof (*node));
node = GGC_CNEW (struct cgraph_varpool_node);
node->decl = decl;
node->next = cgraph_varpool_nodes;
cgraph_varpool_nodes = node;

View File

@ -43,7 +43,7 @@ process_define_predicate (rtx defn)
return;
}
pred = xcalloc (sizeof (struct pred_data), 1);
pred = XCNEW (struct pred_data);
pred->name = XSTR (defn, 0);
pred->exp = XEXP (defn, 1);
pred->c_block = XSTR (defn, 2);

View File

@ -1200,7 +1200,7 @@ lookup_predicate (const char *name)
{
struct pred_data key;
key.name = name;
return htab_find (predicate_table, &key);
return (struct pred_data *) htab_find (predicate_table, &key);
}
void
@ -1268,7 +1268,7 @@ init_predicate_table (void)
for (i = 0; i < NUM_KNOWN_STD_PREDS; i++)
{
pred = xcalloc (sizeof (struct pred_data), 1);
pred = XCNEW (struct pred_data);
pred->name = std_preds[i].name;
pred->special = std_preds[i].special;

View File

@ -226,7 +226,7 @@ static inline void print_lambda_vector (FILE *, lambda_vector, int);
static inline lambda_vector
lambda_vector_new (int size)
{
return ggc_alloc_cleared (size * sizeof(int));
return GGC_CNEWVEC (int, size);
}

View File

@ -115,7 +115,7 @@ get_key_value (char *key)
static char *
save_string (const char *s, int len)
{
char *result = xmalloc (len + 1);
char *result = XNEWVEC (char, len + 1);
memcpy (result, s, len);
result[len] = 0;
@ -201,7 +201,7 @@ translate_name (char *name)
keylen++)
;
key = alloca (keylen + 1);
key = (char *) alloca (keylen + 1);
strncpy (key, &name[1], keylen);
key[keylen] = 0;

View File

@ -78,7 +78,8 @@ static inline tree
first_referenced_var (referenced_var_iterator *iter)
{
struct int_tree_map *itm;
itm = first_htab_element (&iter->hti, referenced_vars);
itm = (struct int_tree_map *) first_htab_element (&iter->hti,
referenced_vars);
if (!itm)
return NULL;
return itm->to;
@ -100,7 +101,7 @@ static inline tree
next_referenced_var (referenced_var_iterator *iter)
{
struct int_tree_map *itm;
itm = next_htab_element (&iter->hti);
itm = (struct int_tree_map *) next_htab_element (&iter->hti);
if (!itm)
return NULL;
return itm->to;

View File

@ -544,7 +544,7 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
else /* Else the RETURN_EXPR returns no value. */
{
*tp = NULL;
return (void *)1;
return (tree) (void *)1;
}
}
@ -724,7 +724,8 @@ copy_bb (inline_data *id, basic_block bb, int frequency_scale, int count_scale)
/* create_basic_block() will append every new block to
basic_block_info automatically. */
copy_basic_block = create_basic_block (NULL, (void *) 0, bb->prev_bb->aux);
copy_basic_block = create_basic_block (NULL, (void *) 0,
(basic_block) bb->prev_bb->aux);
copy_basic_block->count = bb->count * count_scale / REG_BR_PROB_BASE;
copy_basic_block->frequency = (bb->frequency
* frequency_scale / REG_BR_PROB_BASE);
@ -827,7 +828,7 @@ copy_bb (inline_data *id, basic_block bb, int frequency_scale, int count_scale)
static void
copy_edges_for_bb (basic_block bb, int count_scale)
{
basic_block new_bb = bb->aux;
basic_block new_bb = (basic_block) bb->aux;
edge_iterator ei;
edge old_edge;
block_stmt_iterator bsi;
@ -846,7 +847,7 @@ copy_edges_for_bb (basic_block bb, int count_scale)
if (old_edge->dest->index == EXIT_BLOCK && !old_edge->flags
&& old_edge->dest->aux != EXIT_BLOCK_PTR)
flags |= EDGE_FALLTHRU;
new = make_edge (new_bb, old_edge->dest->aux, flags);
new = make_edge (new_bb, (basic_block) old_edge->dest->aux, flags);
new->count = old_edge->count * count_scale / REG_BR_PROB_BASE;
new->probability = old_edge->probability;
}
@ -895,7 +896,7 @@ copy_edges_for_bb (basic_block bb, int count_scale)
static tree
remap_decl_1 (tree decl, void *data)
{
return remap_decl (decl, data);
return remap_decl (decl, (inline_data *) data);
}
/* Make a copy of the body of FN so that it can be inserted inline in
@ -1614,7 +1615,7 @@ estimate_move_cost (tree type)
static tree
estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
{
int *count = data;
int *count = (int *) data;
tree x = *tp;
if (IS_TYPE_OR_DECL_P (x))

View File

@ -296,7 +296,7 @@ new_scev_info_str (tree var)
{
struct scev_info_str *res;
res = xmalloc (sizeof (struct scev_info_str));
res = XNEW (struct scev_info_str);
res->var = var;
res->chrec = chrec_not_analyzed_yet;
@ -316,8 +316,8 @@ hash_scev_info (const void *elt)
static int
eq_scev_info (const void *e1, const void *e2)
{
const struct scev_info_str *elt1 = e1;
const struct scev_info_str *elt2 = e2;
const struct scev_info_str *elt1 = (const struct scev_info_str *) e1;
const struct scev_info_str *elt2 = (const struct scev_info_str *) e2;
return elt1->var == elt2->var;
}
@ -346,7 +346,7 @@ find_var_scev_info (tree var)
if (!*slot)
*slot = new_scev_info_str (var);
res = *slot;
res = (struct scev_info_str *) *slot;
return &res->chrec;
}
@ -1886,10 +1886,9 @@ set_instantiated_value (htab_t cache, tree version, tree val)
pattern.var = version;
slot = htab_find_slot (cache, &pattern, INSERT);
if (*slot)
info = *slot;
else
info = *slot = new_scev_info_str (version);
if (!*slot)
*slot = new_scev_info_str (version);
info = (struct scev_info_str *) *slot;
info->chrec = val;
}
@ -2479,9 +2478,9 @@ analyze_scalar_evolution_for_all_loop_phi_nodes (VEC(tree,heap) **exit_condition
static int
gather_stats_on_scev_database_1 (void **slot, void *stats)
{
struct scev_info_str *entry = *slot;
struct scev_info_str *entry = (struct scev_info_str *) *slot;
gather_chrec_stats (entry->chrec, stats);
gather_chrec_stats (entry->chrec, (struct chrec_stats *) stats);
return 1;
}