From 703ad42b4be14b9b1e84816dede360721361ed86 Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Sat, 19 Jul 2003 14:47:15 +0000 Subject: [PATCH] alias.c [...]: Remove unnecessary casts. * alias.c alloc-pool.c bitmap.c bitmap.h bt-load.c builtins.c c-common.c c-decl.c c-incpath.c c-lex.c c-opts.c c-parse.in c-pragma.c c-typeck.c calls.c cfg.c cfganal.c cfgloop.c cfgrtl.c collect2.c combine.c conflict.c coverage.c cppexp.c cppfiles.c cpphash.c cppinit.c cpplex.c cpplib.c cppmacro.c cppspec.c cpptrad.c cse.c cselib.c dbxout.c defaults.h df.c dominance.c dwarf2out.c dwarfout.c emit-rtl.c except.c expmed.c expr.c final.c fix-header.c flow.c fold-const.c function.c gcc.c gccspec.c gcov.c gcse.c genattr.c genattrtab.c genautomata.c genconditions.c genemit.c genextract.c genoutput.c genrecog.c gensupport.c ggc-page.c ggc-simple.c global.c graph.c haifa-sched.c hashtable.c integrate.c jump.c langhooks.c lcm.c line-map.c local-alloc.c loop.c mips-tdump.c mips-tfile.c mkdeps.c optabs.c params.c postreload.c prefix.c print-tree.c protoize.c ra-build.c ra-colorize.c ra-rewrite.c ra.c recog.c reg-stack.c regclass.c regmove.c regrename.c reload.c reload1.c reorg.c resource.c sbitmap.c sched-deps.c sched-rgn.c sched-vis.c sdbout.c simplify-rtx.c ssa-ccp.c ssa.c stmt.c stor-layout.c timevar.c tlink.c toplev.c tree-dump.c tree.c unroll.c unwind-dw2-fde.c varasm.c varray.c vmsdbgout.c xcoffout.c: Remove unnecessary casts. From-SVN: r69587 --- gcc/ChangeLog | 24 ++++++++ gcc/alias.c | 20 +++---- gcc/alloc-pool.c | 4 +- gcc/bitmap.c | 3 +- gcc/bitmap.h | 4 +- gcc/bt-load.c | 21 +++---- gcc/builtins.c | 2 +- gcc/c-common.c | 13 ++--- gcc/c-decl.c | 22 +++----- gcc/c-incpath.c | 2 +- gcc/c-lex.c | 2 +- gcc/c-opts.c | 3 +- gcc/c-parse.in | 12 ++-- gcc/c-pragma.c | 2 +- gcc/c-typeck.c | 45 +++++++-------- gcc/calls.c | 19 +++---- gcc/cfg.c | 13 ++--- gcc/cfganal.c | 30 +++++----- gcc/cfgloop.c | 14 ++--- gcc/cfgrtl.c | 11 ++-- gcc/collect2.c | 22 ++++---- gcc/combine.c | 49 ++++++++--------- gcc/conflict.c | 9 +-- gcc/coverage.c | 4 +- gcc/cppexp.c | 3 +- gcc/cppfiles.c | 18 +++--- gcc/cpphash.c | 3 +- gcc/cppinit.c | 2 +- gcc/cpplex.c | 4 +- gcc/cpplib.c | 4 +- gcc/cppmacro.c | 13 ++--- gcc/cppspec.c | 2 +- gcc/cpptrad.c | 3 +- gcc/cse.c | 21 +++---- gcc/cselib.c | 6 +- gcc/dbxout.c | 13 ++--- gcc/defaults.h | 2 +- gcc/df.c | 6 +- gcc/dominance.c | 6 +- gcc/dwarf2out.c | 80 +++++++++++++-------------- gcc/dwarfout.c | 25 ++++----- gcc/emit-rtl.c | 16 +++--- gcc/except.c | 23 ++++---- gcc/expmed.c | 4 +- gcc/expr.c | 10 ++-- gcc/final.c | 24 ++++---- gcc/fix-header.c | 5 +- gcc/flow.c | 10 ++-- gcc/fold-const.c | 8 +-- gcc/function.c | 29 +++++----- gcc/gcc.c | 127 ++++++++++++++++++------------------------- gcc/gccspec.c | 2 +- gcc/gcov.c | 17 +++--- gcc/gcse.c | 121 +++++++++++++++++++---------------------- gcc/genattr.c | 3 +- gcc/genattrtab.c | 63 ++++++++++----------- gcc/genautomata.c | 15 +++-- gcc/genconditions.c | 2 +- gcc/genemit.c | 5 +- gcc/genextract.c | 18 +++--- gcc/genoutput.c | 8 +-- gcc/genrecog.c | 10 ++-- gcc/gensupport.c | 9 ++- gcc/ggc-page.c | 33 ++++++----- gcc/ggc-simple.c | 2 +- gcc/global.c | 27 +++++---- gcc/graph.c | 13 ++--- gcc/haifa-sched.c | 25 ++++----- gcc/hashtable.c | 6 +- gcc/integrate.c | 32 +++++------ gcc/jump.c | 2 +- gcc/langhooks.c | 2 +- gcc/lcm.c | 18 +++--- gcc/line-map.c | 3 +- gcc/local-alloc.c | 26 ++++----- gcc/loop.c | 56 ++++++++----------- gcc/mips-tdump.c | 88 +++++++++++------------------- gcc/mips-tfile.c | 52 +++++++++--------- gcc/mkdeps.c | 11 ++-- gcc/optabs.c | 2 +- gcc/params.c | 6 +- gcc/postreload.c | 14 ++--- gcc/prefix.c | 6 +- gcc/print-tree.c | 4 +- gcc/protoize.c | 79 +++++++++++++-------------- gcc/ra-build.c | 68 ++++++++++------------- gcc/ra-colorize.c | 17 +++--- gcc/ra-rewrite.c | 9 ++- gcc/ra.c | 5 +- gcc/recog.c | 8 +-- gcc/reg-stack.c | 14 ++--- gcc/regclass.c | 36 ++++++------ gcc/regmove.c | 6 +- gcc/regrename.c | 9 ++- gcc/reload.c | 4 +- gcc/reload1.c | 61 +++++++++------------ gcc/reorg.c | 14 ++--- gcc/resource.c | 7 +-- gcc/sbitmap.c | 6 +- gcc/sched-deps.c | 3 +- gcc/sched-rgn.c | 43 +++++++-------- gcc/sched-vis.c | 2 +- gcc/sdbout.c | 6 +- gcc/simplify-rtx.c | 2 +- gcc/ssa-ccp.c | 4 +- gcc/ssa.c | 17 +++--- gcc/stmt.c | 33 +++++------ gcc/stor-layout.c | 3 +- gcc/timevar.c | 5 +- gcc/tlink.c | 4 +- gcc/toplev.c | 8 +-- gcc/tree-dump.c | 4 +- gcc/tree.c | 11 ++-- gcc/unroll.c | 31 +++++------ gcc/unwind-dw2-fde.c | 8 +-- gcc/varasm.c | 26 ++++----- gcc/varray.c | 8 +-- gcc/vmsdbgout.c | 26 ++++----- gcc/xcoffout.c | 2 +- 119 files changed, 957 insertions(+), 1150 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 769f7f010c83..6bb655ae09f4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,27 @@ +2003-07-19 Kaveh R. Ghazi + + * alias.c alloc-pool.c bitmap.c bitmap.h bt-load.c builtins.c + c-common.c c-decl.c c-incpath.c c-lex.c c-opts.c c-parse.in + c-pragma.c c-typeck.c calls.c cfg.c cfganal.c cfgloop.c cfgrtl.c + collect2.c combine.c conflict.c coverage.c cppexp.c cppfiles.c + cpphash.c cppinit.c cpplex.c cpplib.c cppmacro.c cppspec.c + cpptrad.c cse.c cselib.c dbxout.c defaults.h df.c dominance.c + dwarf2out.c dwarfout.c emit-rtl.c except.c expmed.c expr.c final.c + fix-header.c flow.c fold-const.c function.c gcc.c gccspec.c gcov.c + gcse.c genattr.c genattrtab.c genautomata.c genconditions.c + genemit.c genextract.c genoutput.c genrecog.c gensupport.c + ggc-page.c ggc-simple.c global.c graph.c haifa-sched.c hashtable.c + integrate.c jump.c langhooks.c lcm.c line-map.c local-alloc.c + loop.c mips-tdump.c mips-tfile.c mkdeps.c optabs.c params.c + postreload.c prefix.c print-tree.c protoize.c ra-build.c + ra-colorize.c ra-rewrite.c ra.c recog.c reg-stack.c regclass.c + regmove.c regrename.c reload.c reload1.c reorg.c resource.c + sbitmap.c sched-deps.c sched-rgn.c sched-vis.c sdbout.c + simplify-rtx.c ssa-ccp.c ssa.c stmt.c stor-layout.c timevar.c + tlink.c toplev.c tree-dump.c tree.c unroll.c unwind-dw2-fde.c + varasm.c varray.c vmsdbgout.c xcoffout.c: Remove unnecessary + casts. + 2003-07-19 Gabriel Dos Reis * c-pragma.c (apply_pragma_weak): Don't use warning_with_decl. diff --git a/gcc/alias.c b/gcc/alias.c index 2617c8b5e710..edd8a3deb3f7 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -632,8 +632,7 @@ record_alias_subset (HOST_WIDE_INT superset, HOST_WIDE_INT subset) { /* Create an entry for the SUPERSET, so that we have a place to attach the SUBSET. */ - superset_entry - = (alias_set_entry) xmalloc (sizeof (struct alias_set_entry)); + superset_entry = xmalloc (sizeof (struct alias_set_entry)); superset_entry->alias_set = superset; superset_entry->children = splay_tree_new (splay_tree_compare_ints, 0, 0); @@ -2717,17 +2716,16 @@ init_alias_analysis (void) optimization. Loop unrolling can create a large number of registers. */ reg_base_value_size = maxreg * 2; - reg_base_value = (rtx *) ggc_alloc_cleared (reg_base_value_size - * sizeof (rtx)); + reg_base_value = ggc_alloc_cleared (reg_base_value_size * sizeof (rtx)); - new_reg_base_value = (rtx *) xmalloc (reg_base_value_size * sizeof (rtx)); - reg_seen = (char *) xmalloc (reg_base_value_size); + new_reg_base_value = xmalloc (reg_base_value_size * sizeof (rtx)); + reg_seen = xmalloc (reg_base_value_size); if (! reload_completed && flag_old_unroll_loops) { /* ??? Why are we realloc'ing if we're just going to zero it? */ - alias_invariant = (rtx *)xrealloc (alias_invariant, - reg_base_value_size * sizeof (rtx)); - memset ((char *)alias_invariant, 0, reg_base_value_size * sizeof (rtx)); + alias_invariant = xrealloc (alias_invariant, + reg_base_value_size * sizeof (rtx)); + memset (alias_invariant, 0, reg_base_value_size * sizeof (rtx)); } /* The basic idea is that each pass through this loop will use the @@ -2764,10 +2762,10 @@ init_alias_analysis (void) copying_arguments = true; /* Wipe the potential alias information clean for this pass. */ - memset ((char *) new_reg_base_value, 0, reg_base_value_size * sizeof (rtx)); + memset (new_reg_base_value, 0, reg_base_value_size * sizeof (rtx)); /* Wipe the reg_seen array clean. */ - memset ((char *) reg_seen, 0, reg_base_value_size); + memset (reg_seen, 0, reg_base_value_size); /* Mark all hard registers which may contain an address. The stack, frame and argument pointers may contain an address. diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c index 9cb56cd48b6b..d275cd86cff0 100644 --- a/gcc/alloc-pool.c +++ b/gcc/alloc-pool.c @@ -105,7 +105,7 @@ create_alloc_pool (const char *name, size_t size, size_t num) pool_size = sizeof (struct alloc_pool_def); /* and allocate that much memory. */ - pool = (alloc_pool) xmalloc (pool_size); + pool = xmalloc (pool_size); /* Now init the various pieces of our pool structure. */ pool->name = xstrdup (name); @@ -176,7 +176,7 @@ pool_alloc (alloc_pool pool) alloc_pool_list block_header; /* Make the block. */ - block = (char *) xmalloc (pool->block_size); + block = xmalloc (pool->block_size); block_header = (alloc_pool_list) block; block += align_eight (sizeof (struct alloc_pool_list_def)); diff --git a/gcc/bitmap.c b/gcc/bitmap.c index 9b6c47ce4908..84d4be2ec38c 100644 --- a/gcc/bitmap.c +++ b/gcc/bitmap.c @@ -131,8 +131,7 @@ bitmap_element_allocate (bitmap head) obstack_chunk_free); } - element = (bitmap_element *) obstack_alloc (&bitmap_obstack, - sizeof (bitmap_element)); + element = obstack_alloc (&bitmap_obstack, sizeof (bitmap_element)); } } else diff --git a/gcc/bitmap.h b/gcc/bitmap.h index 401506a2a7e8..d72200348804 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -128,7 +128,7 @@ extern int bitmap_last_set_bit (bitmap); /* Allocate a bitmap with oballoc. */ #define BITMAP_OBSTACK_ALLOC(OBSTACK) \ - bitmap_initialize ((bitmap) obstack_alloc (OBSTACK, sizeof (bitmap_head)), 1) + bitmap_initialize (obstack_alloc (OBSTACK, sizeof (bitmap_head)), 1) /* Allocate a bitmap with ggc_alloc. */ #define BITMAP_GGC_ALLOC() \ @@ -136,7 +136,7 @@ extern int bitmap_last_set_bit (bitmap); /* Allocate a bitmap with xmalloc. */ #define BITMAP_XMALLOC() \ - bitmap_initialize ((bitmap) xmalloc (sizeof (bitmap_head)), 1) + bitmap_initialize (xmalloc (sizeof (bitmap_head)), 1) /* Do any cleanup needed on a bitmap when it is no longer used. */ #define BITMAP_FREE(BITMAP) \ diff --git a/gcc/bt-load.c b/gcc/bt-load.c index 4bcf76c3f224..b3ba22b83eec 100644 --- a/gcc/bt-load.c +++ b/gcc/bt-load.c @@ -277,9 +277,8 @@ find_btr_def_group (btr_def_group *all_btr_def_groups, btr_def def) if (!this_group) { - this_group = (btr_def_group) - obstack_alloc (&migrate_btrl_obstack, - sizeof (struct btr_def_group_s)); + this_group = obstack_alloc (&migrate_btrl_obstack, + sizeof (struct btr_def_group_s)); this_group->src = def_src; this_group->members = NULL; this_group->next = *all_btr_def_groups; @@ -301,8 +300,8 @@ add_btr_def (fibheap_t all_btr_defs, basic_block bb, int insn_luid, rtx insn, unsigned int dest_reg, int other_btr_uses_before_def, btr_def_group *all_btr_def_groups) { - btr_def this = (btr_def) - obstack_alloc (&migrate_btrl_obstack, sizeof (struct btr_def_s)); + btr_def this + = obstack_alloc (&migrate_btrl_obstack, sizeof (struct btr_def_s)); this->bb = bb; this->luid = insn_luid; this->insn = insn; @@ -353,8 +352,7 @@ new_btr_user (basic_block bb, int insn_luid, rtx insn) usep = NULL; } use = usep ? *usep : NULL_RTX; - user = (btr_user) - obstack_alloc (&migrate_btrl_obstack, sizeof (struct btr_user_s)); + user = obstack_alloc (&migrate_btrl_obstack, sizeof (struct btr_user_s)); user->bb = bb; user->luid = insn_luid; user->insn = insn; @@ -736,8 +734,7 @@ build_btr_def_use_webs (fibheap_t all_btr_defs) sbitmap *btr_defset = sbitmap_vector_alloc ( (last_btr - first_btr) + 1, max_uid); sbitmap *bb_gen = sbitmap_vector_alloc (n_basic_blocks, max_uid); - HARD_REG_SET *btrs_written = (HARD_REG_SET *) xcalloc ( - n_basic_blocks, sizeof (HARD_REG_SET)); + HARD_REG_SET *btrs_written = xcalloc (n_basic_blocks, sizeof (HARD_REG_SET)); sbitmap *bb_kill; sbitmap *bb_out; @@ -841,8 +838,7 @@ augment_live_range (bitmap live_range, HARD_REG_SET *btrs_live_in_range, { basic_block *worklist, *tos; - tos = worklist = - (basic_block *) xmalloc (sizeof (basic_block) * (n_basic_blocks + 1)); + tos = worklist = xmalloc (sizeof (basic_block) * (n_basic_blocks + 1)); if (dominated_by_p (dom, new_bb, head_bb)) *tos++ = new_bb; @@ -1318,8 +1314,7 @@ migrate_btr_defs (enum reg_class btr_class, int allow_callee_save) first_btr = reg; } - btrs_live = - (HARD_REG_SET *) xcalloc (n_basic_blocks, sizeof (HARD_REG_SET)); + btrs_live = xcalloc (n_basic_blocks, sizeof (HARD_REG_SET)); build_btr_def_use_webs (all_btr_defs); diff --git a/gcc/builtins.c b/gcc/builtins.c index 90cd6acd1655..0a44edf064d9 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -1082,7 +1082,7 @@ result_vector (int savep, rtx result) int regno, size, align, nelts; enum machine_mode mode; rtx reg, mem; - rtx *savevec = (rtx *) alloca (FIRST_PSEUDO_REGISTER * sizeof (rtx)); + rtx *savevec = alloca (FIRST_PSEUDO_REGISTER * sizeof (rtx)); size = nelts = 0; for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) diff --git a/gcc/c-common.c b/gcc/c-common.c index c88356f40386..ed2c989d0580 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -875,12 +875,12 @@ c_expand_start_cond (tree cond, int compstmt_count, tree if_stmt) if (if_stack_space == 0) { if_stack_space = 10; - if_stack = (if_elt *) xmalloc (10 * sizeof (if_elt)); + if_stack = xmalloc (10 * sizeof (if_elt)); } else if (if_stack_space == if_stack_pointer) { if_stack_space += 10; - if_stack = (if_elt *) xrealloc (if_stack, if_stack_space * sizeof (if_elt)); + if_stack = xrealloc (if_stack, if_stack_space * sizeof (if_elt)); } IF_COND (if_stmt) = cond; @@ -1354,7 +1354,7 @@ static struct tlist * new_tlist (struct tlist *next, tree t, tree writer) { struct tlist *l; - l = (struct tlist *) obstack_alloc (&tlist_obstack, sizeof *l); + l = obstack_alloc (&tlist_obstack, sizeof *l); l->next = next; l->expr = t; l->writer = writer; @@ -1624,8 +1624,7 @@ verify_tree (tree x, struct tlist **pbefore_sp, struct tlist **pno_sp, if (! t) { - t = (struct tlist_cache *) obstack_alloc (&tlist_obstack, - sizeof *t); + t = obstack_alloc (&tlist_obstack, sizeof *t); t->next = save_expr_cache; t->expr = x; save_expr_cache = t; @@ -4313,7 +4312,7 @@ c_expand_builtin_printf (tree arglist, rtx target, enum machine_mode tmode, /* Create a NULL-terminated string that's one char shorter than the original, stripping off the trailing '\n'. */ const int newlen = TREE_STRING_LENGTH (stripped_string) - 1; - char *newstr = (char *) alloca (newlen); + char *newstr = alloca (newlen); memcpy (newstr, TREE_STRING_POINTER (stripped_string), newlen - 1); newstr[newlen - 1] = 0; @@ -4877,7 +4876,7 @@ handle_mode_attribute (tree *node, tree name, tree args ATTRIBUTE_UNUSED, if (len > 4 && p[0] == '_' && p[1] == '_' && p[len - 1] == '_' && p[len - 2] == '_') { - char *newp = (char *) alloca (len - 1); + char *newp = alloca (len - 1); strcpy (newp, &p[2]); newp[len - 4] = '\0'; diff --git a/gcc/c-decl.c b/gcc/c-decl.c index d6dfcb7d9a95..bd3b76140cbc 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -360,8 +360,7 @@ make_binding_level (void) memset (result, 0, sizeof(struct binding_level)); } else - result = (struct binding_level *) - ggc_alloc_cleared (sizeof (struct binding_level)); + result = ggc_alloc_cleared (sizeof (struct binding_level)); return result; } @@ -1732,8 +1731,7 @@ pushdecl (tree x) /* Functions need the lang_decl data. */ if (TREE_CODE (x) == FUNCTION_DECL && ! DECL_LANG_SPECIFIC (x)) - DECL_LANG_SPECIFIC (x) = (struct lang_decl *) - ggc_alloc_cleared (sizeof (struct lang_decl)); + DECL_LANG_SPECIFIC (x) = ggc_alloc_cleared (sizeof (struct lang_decl)); /* A local extern declaration for a function doesn't constitute nesting. A local auto declaration does, since it's a forward decl @@ -4375,8 +4373,8 @@ grokdeclarator (tree declarator, tree declspecs, decl = build_decl (FUNCTION_DECL, declarator, type); decl = build_decl_attribute_variant (decl, decl_attr); - DECL_LANG_SPECIFIC (decl) = (struct lang_decl *) - ggc_alloc_cleared (sizeof (struct lang_decl)); + DECL_LANG_SPECIFIC (decl) + = ggc_alloc_cleared (sizeof (struct lang_decl)); if (pedantic && type_quals && ! DECL_IN_SYSTEM_HEADER (decl)) pedwarn ("ISO C forbids qualified function types"); @@ -6630,8 +6628,7 @@ void c_push_function_context (struct function *f) { struct language_function *p; - p = ((struct language_function *) - ggc_alloc (sizeof (struct language_function))); + p = ggc_alloc (sizeof (struct language_function)); f->language = p; p->base.x_stmt_tree = c_stmt_tree; @@ -6694,9 +6691,8 @@ c_dup_lang_specific_decl (tree decl) if (!DECL_LANG_SPECIFIC (decl)) return; - ld = (struct lang_decl *) ggc_alloc (sizeof (struct lang_decl)); - memcpy ((char *) ld, (char *) DECL_LANG_SPECIFIC (decl), - sizeof (struct lang_decl)); + ld = ggc_alloc (sizeof (struct lang_decl)); + memcpy (ld, DECL_LANG_SPECIFIC (decl), sizeof (struct lang_decl)); DECL_LANG_SPECIFIC (decl) = ld; } @@ -6943,7 +6939,7 @@ merge_translation_unit_decls (void) if (TREE_PUBLIC (decl) && DECL_EXTERNAL (decl)) { tree global_decl; - global_decl = (tree) htab_find (link_hash_table, decl); + global_decl = htab_find (link_hash_table, decl); if (! global_decl) continue; @@ -6967,7 +6963,7 @@ c_write_global_declarations(void) { tree globals = BLOCK_VARS (DECL_INITIAL (link)); int len = list_length (globals); - tree *vec = (tree *) xmalloc (sizeof (tree) * len); + tree *vec = xmalloc (sizeof (tree) * len); int i; tree decl; diff --git a/gcc/c-incpath.c b/gcc/c-incpath.c index efcd19b5ea5b..6ec42cc0bfdb 100644 --- a/gcc/c-incpath.c +++ b/gcc/c-incpath.c @@ -306,7 +306,7 @@ add_path (char *path, int chain, int cxx_aware) { struct cpp_path *p; - p = (struct cpp_path *) xmalloc (sizeof (struct cpp_path)); + p = xmalloc (sizeof (struct cpp_path)); p->next = NULL; p->name = path; if (chain == SYSTEM || chain == AFTER) diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 034b3b608c82..b6720da2b5bb 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -123,7 +123,7 @@ get_fileinfo (const char *name) if (n) return (struct c_fileinfo *) n->value; - fi = (struct c_fileinfo *) xmalloc (sizeof (struct c_fileinfo)); + fi = xmalloc (sizeof (struct c_fileinfo)); fi->time = 0; fi->interface_only = 0; fi->interface_unknown = 1; diff --git a/gcc/c-opts.c b/gcc/c-opts.c index 9fa6ddac104c..44b6c1abf197 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -220,8 +220,7 @@ c_common_init_options (unsigned int argc, const char **argv ATTRIBUTE_UNUSED) flag_exceptions = c_dialect_cxx (); warn_pointer_arith = c_dialect_cxx (); - deferred_opts = (struct deferred_opt *) - xmalloc (argc * sizeof (struct deferred_opt)); + deferred_opts = xmalloc (argc * sizeof (struct deferred_opt)); result = lang_flags[c_language]; diff --git a/gcc/c-parse.in b/gcc/c-parse.in index 8ec1fa70df61..a009895951ed 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -75,15 +75,13 @@ do { \ newsize = *(YYSSZ) *= 2; \ if (malloced_yyss) \ { \ - newss = (short *) \ - really_call_realloc (*(SS), newsize * sizeof (short)); \ - newvs = (YYSTYPE *) \ - really_call_realloc (*(VS), newsize * sizeof (YYSTYPE)); \ + newss = really_call_realloc (*(SS), newsize * sizeof (short)); \ + newvs = really_call_realloc (*(VS), newsize * sizeof (YYSTYPE)); \ } \ else \ { \ - newss = (short *) really_call_malloc (newsize * sizeof (short)); \ - newvs = (YYSTYPE *) really_call_malloc (newsize * sizeof (YYSTYPE)); \ + newss = really_call_malloc (newsize * sizeof (short)); \ + newvs = really_call_malloc (newsize * sizeof (YYSTYPE)); \ if (newss) \ memcpy (newss, *(SS), (SSSIZE)); \ if (newvs) \ @@ -3524,7 +3522,7 @@ init_reswords (void) if (!c_dialect_objc ()) mask |= D_OBJC; - ridpointers = (tree *) ggc_calloc ((int) RID_MAX, sizeof (tree)); + ridpointers = ggc_calloc ((int) RID_MAX, sizeof (tree)); for (i = 0; i < N_reswords; i++) { /* If a keyword is disabled, do not enter it into the table diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c index d74e6ff1f843..dc9573397ec7 100644 --- a/gcc/c-pragma.c +++ b/gcc/c-pragma.c @@ -74,7 +74,7 @@ push_alignment (int alignment, tree id) { align_stack * entry; - entry = (align_stack *) ggc_alloc (sizeof (* entry)); + entry = ggc_alloc (sizeof (* entry)); entry->alignment = alignment; entry->num_pushes = 1; diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index a0ec52f9b94c..1fea1c534597 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -3617,9 +3617,8 @@ warn_for_assignment (const char *msgid, const char *opname, tree function, { /* Function name is known; supply it. */ const char *const argstring = _("passing arg of `%s'"); - new_opname = (char *) alloca (IDENTIFIER_LENGTH (function) - + strlen (argstring) + 1 - + 1); + new_opname = alloca (IDENTIFIER_LENGTH (function) + + strlen (argstring) + 1 + 1); sprintf (new_opname, argstring, IDENTIFIER_POINTER (function)); } @@ -3627,7 +3626,7 @@ warn_for_assignment (const char *msgid, const char *opname, tree function, { /* Function name unknown (call through ptr). */ const char *const argnofun = _("passing arg of pointer to function"); - new_opname = (char *) alloca (strlen (argnofun) + 1 + 1); + new_opname = alloca (strlen (argnofun) + 1 + 1); sprintf (new_opname, argnofun); } } @@ -3635,9 +3634,8 @@ warn_for_assignment (const char *msgid, const char *opname, tree function, { /* Function name is known; supply it. */ const char *const argstring = _("passing arg %d of `%s'"); - new_opname = (char *) alloca (IDENTIFIER_LENGTH (function) - + strlen (argstring) + 1 + 25 - /*%d*/ + 1); + new_opname = alloca (IDENTIFIER_LENGTH (function) + + strlen (argstring) + 1 + 25 /*%d*/ + 1); sprintf (new_opname, argstring, argnum, IDENTIFIER_POINTER (function)); } @@ -3645,7 +3643,7 @@ warn_for_assignment (const char *msgid, const char *opname, tree function, { /* Function name unknown (call through ptr); just give arg number. */ const char *const argnofun = _("passing arg %d of pointer to function"); - new_opname = (char *) alloca (strlen (argnofun) + 1 + 25 /*%d*/ + 1); + new_opname = alloca (strlen (argnofun) + 1 + 25 /*%d*/ + 1); sprintf (new_opname, argnofun, argnum); } opname = new_opname; @@ -3777,12 +3775,10 @@ static int spelling_size; /* Size of the spelling stack. */ { \ spelling_size += 10; \ if (spelling_base == 0) \ - spelling_base \ - = (struct spelling *) xmalloc (spelling_size * sizeof (struct spelling)); \ + spelling_base = xmalloc (spelling_size * sizeof (struct spelling)); \ else \ - spelling_base \ - = (struct spelling *) xrealloc (spelling_base, \ - spelling_size * sizeof (struct spelling)); \ + spelling_base = xrealloc (spelling_base, \ + spelling_size * sizeof (struct spelling)); \ RESTORE_SPELLING_DEPTH (depth); \ } \ \ @@ -3872,7 +3868,7 @@ error_init (const char *msgid) char *ofwhat; error ("%s", _(msgid)); - ofwhat = print_spelling ((char *) alloca (spelling_length () + 1)); + ofwhat = print_spelling (alloca (spelling_length () + 1)); if (*ofwhat) error ("(near initialization for `%s')", ofwhat); } @@ -3887,7 +3883,7 @@ pedwarn_init (const char *msgid) char *ofwhat; pedwarn ("%s", _(msgid)); - ofwhat = print_spelling ((char *) alloca (spelling_length () + 1)); + ofwhat = print_spelling (alloca (spelling_length () + 1)); if (*ofwhat) pedwarn ("(near initialization for `%s')", ofwhat); } @@ -3902,7 +3898,7 @@ warning_init (const char *msgid) char *ofwhat; warning ("%s", _(msgid)); - ofwhat = print_spelling ((char *) alloca (spelling_length () + 1)); + ofwhat = print_spelling (alloca (spelling_length () + 1)); if (*ofwhat) warning ("(near initialization for `%s')", ofwhat); } @@ -4286,8 +4282,7 @@ void start_init (tree decl, tree asmspec_tree, int top_level) { const char *locus; - struct initializer_stack *p - = (struct initializer_stack *) xmalloc (sizeof (struct initializer_stack)); + struct initializer_stack *p = xmalloc (sizeof (struct initializer_stack)); const char *asmspec = 0; if (asmspec_tree) @@ -4387,8 +4382,7 @@ finish_init (void) void really_start_incremental_init (tree type) { - struct constructor_stack *p - = (struct constructor_stack *) xmalloc (sizeof (struct constructor_stack)); + struct constructor_stack *p = xmalloc (sizeof (struct constructor_stack)); if (type == 0) type = TREE_TYPE (constructor_decl); @@ -4524,7 +4518,7 @@ push_init_level (int implicit) value = find_init_member (constructor_index); } - p = (struct constructor_stack *) xmalloc (sizeof (struct constructor_stack)); + p = xmalloc (sizeof (struct constructor_stack)); p->type = constructor_type; p->fields = constructor_fields; p->index = constructor_index; @@ -4908,8 +4902,7 @@ push_range_stack (tree range_end) { struct constructor_range_stack *p; - p = (struct constructor_range_stack *) - ggc_alloc (sizeof (struct constructor_range_stack)); + p = ggc_alloc (sizeof (struct constructor_range_stack)); p->prev = constructor_range_stack; p->next = 0; p->fields = constructor_fields; @@ -5081,7 +5074,7 @@ add_pending_init (tree purpose, tree value) } } - r = (struct init_node *) ggc_alloc (sizeof (struct init_node)); + r = ggc_alloc (sizeof (struct init_node)); r->purpose = purpose; r->value = value; @@ -6183,7 +6176,7 @@ c_expand_asm_operands (tree string, tree outputs, tree inputs, int noutputs = list_length (outputs); int i; /* o[I] is the place that output number I should be written. */ - tree *o = (tree *) alloca (noutputs * sizeof (tree)); + tree *o = alloca (noutputs * sizeof (tree)); tree tail; /* Record the contents of OUTPUTS before it is modified. */ @@ -6381,7 +6374,7 @@ c_start_case (tree exp) } /* Add this new SWITCH_STMT to the stack. */ - cs = (struct c_switch *) xmalloc (sizeof (*cs)); + cs = xmalloc (sizeof (*cs)); cs->switch_stmt = build_stmt (SWITCH_STMT, exp, NULL_TREE, orig_type); cs->cases = splay_tree_new (case_compare, NULL, NULL); cs->next = switch_stack; diff --git a/gcc/calls.c b/gcc/calls.c index 845934e2cb54..7add542656f3 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -942,8 +942,7 @@ store_unaligned_arguments_into_pseudos (struct arg_data *args, int num_actuals) int endian_correction = 0; args[i].n_aligned_regs = args[i].partial ? args[i].partial : nregs; - args[i].aligned_regs = (rtx *) xmalloc (sizeof (rtx) - * args[i].n_aligned_regs); + args[i].aligned_regs = xmalloc (sizeof (rtx) * args[i].n_aligned_regs); /* Structures smaller than a word are normally aligned to the least significant byte. On a BYTES_BIG_ENDIAN machine, @@ -2367,8 +2366,8 @@ expand_call (tree exp, rtx target, int ignore) INIT_CUMULATIVE_ARGS (args_so_far, funtype, NULL_RTX, fndecl); /* Make a vector to hold all the information about each arg. */ - args = (struct arg_data *) alloca (num_actuals * sizeof (struct arg_data)); - memset ((char *) args, 0, num_actuals * sizeof (struct arg_data)); + args = alloca (num_actuals * sizeof (struct arg_data)); + memset (args, 0, num_actuals * sizeof (struct arg_data)); /* Build up entries in the ARGS array, compute the size of the arguments into ARGS_SIZE, etc. */ @@ -2758,8 +2757,7 @@ expand_call (tree exp, rtx target, int ignore) highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use, needed); #endif - stack_usage_map - = (char *) alloca (highest_outgoing_arg_in_use); + stack_usage_map = alloca (highest_outgoing_arg_in_use); if (initial_highest_arg_in_use) memcpy (stack_usage_map, initial_stack_usage_map, @@ -2864,8 +2862,7 @@ expand_call (tree exp, rtx target, int ignore) = stack_arg_under_construction; stack_arg_under_construction = 0; /* Make a new map for the new argument list. */ - stack_usage_map = (char *) - alloca (highest_outgoing_arg_in_use); + stack_usage_map = alloca (highest_outgoing_arg_in_use); memset (stack_usage_map, 0, highest_outgoing_arg_in_use); highest_outgoing_arg_in_use = 0; } @@ -3659,8 +3656,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, of the full argument passing conventions to limit complexity here since library functions shouldn't have many args. */ - argvec = (struct arg *) alloca ((nargs + 1) * sizeof (struct arg)); - memset ((char *) argvec, 0, (nargs + 1) * sizeof (struct arg)); + argvec = alloca ((nargs + 1) * sizeof (struct arg)); + memset (argvec, 0, (nargs + 1) * sizeof (struct arg)); #ifdef INIT_CUMULATIVE_LIBCALL_ARGS INIT_CUMULATIVE_LIBCALL_ARGS (args_so_far, outmode, fun); @@ -3895,7 +3892,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use, needed); #endif - stack_usage_map = (char *) alloca (highest_outgoing_arg_in_use); + stack_usage_map = alloca (highest_outgoing_arg_in_use); if (initial_highest_arg_in_use) memcpy (stack_usage_map, initial_stack_usage_map, diff --git a/gcc/cfg.c b/gcc/cfg.c index ba4dd812a64b..779bc4fb79a5 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -155,7 +155,7 @@ init_flow (void) if (!initialized) { gcc_obstack_init (&flow_obstack); - flow_firstobj = (char *) obstack_alloc (&flow_obstack, 0); + flow_firstobj = obstack_alloc (&flow_obstack, 0); initialized = 1; } else @@ -163,7 +163,7 @@ init_flow (void) free_alloc_pool (bb_pool); free_alloc_pool (edge_pool); obstack_free (&flow_obstack, flow_firstobj); - flow_firstobj = (char *) obstack_alloc (&flow_obstack, 0); + flow_firstobj = obstack_alloc (&flow_obstack, 0); } bb_pool = create_alloc_pool ("Basic block pool", sizeof (struct basic_block_def), 100); @@ -697,7 +697,7 @@ alloc_aux_for_blocks (int size) /* Check whether AUX data are still allocated. */ else if (first_block_aux_obj) abort (); - first_block_aux_obj = (char *) obstack_alloc (&block_aux_obstack, 0); + first_block_aux_obj = obstack_alloc (&block_aux_obstack, 0); if (size) { basic_block bb; @@ -763,7 +763,7 @@ alloc_aux_for_edges (int size) else if (first_edge_aux_obj) abort (); - first_edge_aux_obj = (char *) obstack_alloc (&edge_aux_obstack, 0); + first_edge_aux_obj = obstack_alloc (&edge_aux_obstack, 0); if (size) { basic_block bb; @@ -819,9 +819,8 @@ verify_flow_info (void) basic_block bb, last_bb_seen; basic_block *last_visited; - last_visited = (basic_block *) xcalloc (last_basic_block + 2, - sizeof (basic_block)); - edge_checksum = (size_t *) xcalloc (last_basic_block + 2, sizeof (size_t)); + last_visited = xcalloc (last_basic_block + 2, sizeof (basic_block)); + edge_checksum = xcalloc (last_basic_block + 2, sizeof (size_t)); /* Check bb chain & numbers. */ last_bb_seen = ENTRY_BLOCK_PTR; diff --git a/gcc/cfganal.c b/gcc/cfganal.c index d3383c0646d2..e45b48465e2c 100644 --- a/gcc/cfganal.c +++ b/gcc/cfganal.c @@ -139,11 +139,11 @@ mark_dfs_back_edges (void) bool found = false; /* Allocate the preorder and postorder number arrays. */ - pre = (int *) xcalloc (last_basic_block, sizeof (int)); - post = (int *) xcalloc (last_basic_block, sizeof (int)); + pre = xcalloc (last_basic_block, sizeof (int)); + post = xcalloc (last_basic_block, sizeof (int)); /* Allocate stack for back-tracking up CFG. */ - stack = (edge *) xmalloc ((n_basic_blocks + 1) * sizeof (edge)); + stack = xmalloc ((n_basic_blocks + 1) * sizeof (edge)); sp = 0; /* Allocate bitmap to track nodes that have been visited. */ @@ -402,8 +402,7 @@ find_unreachable_blocks (void) edge e; basic_block *tos, *worklist, bb; - tos = worklist = - (basic_block *) xmalloc (sizeof (basic_block) * n_basic_blocks); + tos = worklist = xmalloc (sizeof (basic_block) * n_basic_blocks); /* Clear all the reachability flags. */ @@ -473,10 +472,10 @@ create_edge_list (void) num_edges++; } - elist = (struct edge_list *) xmalloc (sizeof (struct edge_list)); + elist = xmalloc (sizeof (struct edge_list)); elist->num_blocks = block_count; elist->num_edges = num_edges; - elist->index_to_edge = (edge *) xmalloc (sizeof (edge) * num_edges); + elist->index_to_edge = xmalloc (sizeof (edge) * num_edges); num_edges = 0; @@ -735,7 +734,7 @@ flow_reverse_top_sort_order_compute (int *rts_order) sbitmap visited; /* Allocate stack for back-tracking up CFG. */ - stack = (edge *) xmalloc ((n_basic_blocks + 1) * sizeof (edge)); + stack = xmalloc ((n_basic_blocks + 1) * sizeof (edge)); sp = 0; /* Allocate bitmap to track nodes that have been visited. */ @@ -804,7 +803,7 @@ flow_depth_first_order_compute (int *dfs_order, int *rc_order) sbitmap visited; /* Allocate stack for back-tracking up CFG. */ - stack = (edge *) xmalloc ((n_basic_blocks + 1) * sizeof (edge)); + stack = xmalloc ((n_basic_blocks + 1) * sizeof (edge)); sp = 0; /* Allocate bitmap to track nodes that have been visited. */ @@ -909,12 +908,11 @@ flow_preorder_transversal_compute (int *pot_order) basic_block bb; /* Allocate stack for back-tracking up CFG. */ - stack = (edge *) xmalloc ((n_basic_blocks + 1) * sizeof (edge)); + stack = xmalloc ((n_basic_blocks + 1) * sizeof (edge)); sp = 0; /* Allocate the tree. */ - dfst = (struct dfst_node *) xcalloc (last_basic_block, - sizeof (struct dfst_node)); + dfst = xcalloc (last_basic_block, sizeof (struct dfst_node)); FOR_EACH_BB (bb) { @@ -924,9 +922,7 @@ flow_preorder_transversal_compute (int *pot_order) dfst[bb->index].node = (max_successors - ? (struct dfst_node **) xcalloc (max_successors, - sizeof (struct dfst_node *)) - : NULL); + ? xcalloc (max_successors, sizeof (struct dfst_node *)) : NULL); } /* Allocate bitmap to track nodes that have been visited. */ @@ -1038,8 +1034,8 @@ static void flow_dfs_compute_reverse_init (depth_first_search_ds data) { /* Allocate stack for back-tracking up CFG. */ - data->stack = (basic_block *) xmalloc ((n_basic_blocks - (INVALID_BLOCK + 1)) - * sizeof (basic_block)); + data->stack = xmalloc ((n_basic_blocks - (INVALID_BLOCK + 1)) + * sizeof (basic_block)); data->sp = 0; /* Allocate bitmap to track nodes that have been visited. */ diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index fac614ff28b9..2f3ff3e4513d 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -241,7 +241,7 @@ flow_loop_entry_edges_find (struct loop *loop) if (! num_entries) abort (); - loop->entry_edges = (edge *) xmalloc (num_entries * sizeof (edge *)); + loop->entry_edges = xmalloc (num_entries * sizeof (edge *)); num_entries = 0; for (e = loop->header->pred; e; e = e->pred_next) @@ -288,7 +288,7 @@ flow_loop_exit_edges_find (struct loop *loop) return; } - loop->exit_edges = (edge *) xmalloc (num_exits * sizeof (edge *)); + loop->exit_edges = xmalloc (num_exits * sizeof (edge *)); /* Store all exiting edges into an array. */ num_exits = 0; @@ -322,7 +322,7 @@ flow_loop_nodes_find (basic_block header, struct loop *loop) if (loop->latch->loop_father != loop) { - stack = (basic_block *) xmalloc (n_basic_blocks * sizeof (basic_block)); + stack = xmalloc (n_basic_blocks * sizeof (basic_block)); sp = 0; num_nodes++; stack[sp++] = loop->latch; @@ -380,7 +380,7 @@ flow_loop_pre_header_scan (struct loop *loop) num++) ebb = ebb->pred->src; - loop->pre_header_edges = (edge *) xmalloc (num * sizeof (edge)); + loop->pre_header_edges = xmalloc (num * sizeof (edge)); loop->num_pre_header_edges = num; /* Store edges in order that they are followed. The source of the first edge @@ -817,7 +817,7 @@ flow_loops_find (struct loops *loops, int flags) } /* Allocate loop structures. */ - loops->parray = (struct loop **) xcalloc (num_loops + 1, sizeof (struct loop *)); + loops->parray = xcalloc (num_loops + 1, sizeof (struct loop *)); /* Dummy loop containing whole function. */ loops->parray[0] = xcalloc (1, sizeof (struct loop)); @@ -844,8 +844,8 @@ flow_loops_find (struct loops *loops, int flags) { /* Compute depth first search order of the CFG so that outer natural loops will be found before inner natural loops. */ - dfs_order = (int *) xmalloc (n_basic_blocks * sizeof (int)); - rc_order = (int *) xmalloc (n_basic_blocks * sizeof (int)); + dfs_order = xmalloc (n_basic_blocks * sizeof (int)); + rc_order = xmalloc (n_basic_blocks * sizeof (int)); flow_depth_first_order_compute (dfs_order, rc_order); /* Save CFG derived information to avoid recomputing it. */ diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index da629cb4e46c..45ca18987ca8 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -1721,12 +1721,9 @@ print_rtl_with_bb (FILE *outf, rtx rtx_first) { enum bb_state { NOT_IN_BB, IN_ONE_BB, IN_MULTIPLE_BB }; int max_uid = get_max_uid (); - basic_block *start - = (basic_block *) xcalloc (max_uid, sizeof (basic_block)); - basic_block *end - = (basic_block *) xcalloc (max_uid, sizeof (basic_block)); - enum bb_state *in_bb_p - = (enum bb_state *) xcalloc (max_uid, sizeof (enum bb_state)); + basic_block *start = xcalloc (max_uid, sizeof (basic_block)); + basic_block *end = xcalloc (max_uid, sizeof (basic_block)); + enum bb_state *in_bb_p = xcalloc (max_uid, sizeof (enum bb_state)); basic_block bb; @@ -1832,7 +1829,7 @@ rtl_verify_flow_info_1 (void) int err = 0; basic_block bb, last_bb_seen; - bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block)); + bb_info = xcalloc (max_uid, sizeof (basic_block)); /* Check bb chain & numbers. */ last_bb_seen = ENTRY_BLOCK_PTR; diff --git a/gcc/collect2.c b/gcc/collect2.c index 866b0c1aa611..356eda96f6b5 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -689,7 +689,7 @@ add_prefix (struct path_prefix *pprefix, const char *prefix) if (len > pprefix->max_len) pprefix->max_len = len; - pl = (struct prefix_list *) xmalloc (sizeof (struct prefix_list)); + pl = xmalloc (sizeof (struct prefix_list)); pl->prefix = xstrdup (prefix); if (*prev) @@ -716,7 +716,7 @@ static void prefix_from_string (const char *p, struct path_prefix *pprefix) { const char *startp, *endp; - char *nstore = (char *) xmalloc (strlen (p) + 3); + char *nstore = xmalloc (strlen (p) + 3); if (debug) fprintf (stderr, "Convert string '%s' into prefixes, separator = '%c'\n", p, PATH_SEPARATOR); @@ -838,9 +838,9 @@ main (int argc, char **argv) /* Do not invoke xcalloc before this point, since locale needs to be set first, in case a diagnostic is issued. */ - ld1 = (const char **)(ld1_argv = (char **) xcalloc(sizeof (char *), argc+3)); - ld2 = (const char **)(ld2_argv = (char **) xcalloc(sizeof (char *), argc+10)); - object = (const char **)(object_lst = (char **) xcalloc(sizeof (char *), argc)); + ld1 = (const char **)(ld1_argv = xcalloc(sizeof (char *), argc+3)); + ld2 = (const char **)(ld2_argv = xcalloc(sizeof (char *), argc+10)); + object = (const char **)(object_lst = xcalloc(sizeof (char *), argc)); #ifdef DEBUG debug = 1; @@ -865,7 +865,7 @@ main (int argc, char **argv) #endif obstack_begin (&temporary_obstack, 0); - temporary_firstobj = (char *) obstack_alloc (&temporary_obstack, 0); + temporary_firstobj = obstack_alloc (&temporary_obstack, 0); current_demangling_style = auto_demangling; p = getenv ("COLLECT_GCC_OPTIONS"); @@ -880,8 +880,7 @@ main (int argc, char **argv) /* -fno-exceptions -w */ num_c_args += 2; - c_ptr = (const char **) - (c_argv = (char **) xcalloc (sizeof (char *), num_c_args)); + c_ptr = (const char **) (c_argv = xcalloc (sizeof (char *), num_c_args)); if (argc < 2) fatal ("no arguments"); @@ -1337,7 +1336,7 @@ main (int argc, char **argv) /* Strip now if it was requested on the command line. */ if (strip_flag) { - char **real_strip_argv = (char **) xcalloc (sizeof (char *), 3); + char **real_strip_argv = xcalloc (sizeof (char *), 3); const char ** strip_argv = (const char **) real_strip_argv; strip_argv[0] = strip_file_name; @@ -1579,8 +1578,7 @@ static long sequence_number = 0; static void add_to_list (struct head *head_ptr, const char *name) { - struct id *newid - = (struct id *) xcalloc (sizeof (struct id) + strlen (name), 1); + struct id *newid = xcalloc (sizeof (struct id) + strlen (name), 1); struct id *p; strcpy (newid->name, name); @@ -2278,7 +2276,7 @@ locatelib (const char *name) cnt++; q = xstrdup (p); } - l = (const char **) xmalloc ((cnt + 3) * sizeof (char *)); + l = xmalloc ((cnt + 3) * sizeof (char *)); pp = l; if (ldr) { diff --git a/gcc/combine.c b/gcc/combine.c index 30dd97aff3d6..bf356e9be39a 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -456,7 +456,7 @@ do_SUBST (rtx *into, rtx newval) if (undobuf.frees) buf = undobuf.frees, undobuf.frees = buf->next; else - buf = (struct undo *) xmalloc (sizeof (struct undo)); + buf = xmalloc (sizeof (struct undo)); buf->is_int = 0; buf->where.r = into; @@ -484,7 +484,7 @@ do_SUBST_INT (int *into, int newval) if (undobuf.frees) buf = undobuf.frees, undobuf.frees = buf->next; else - buf = (struct undo *) xmalloc (sizeof (struct undo)); + buf = xmalloc (sizeof (struct undo)); buf->is_int = 1; buf->where.i = into; @@ -520,23 +520,18 @@ combine_instructions (rtx f, unsigned int nregs) combine_max_regno = nregs; - reg_nonzero_bits = ((unsigned HOST_WIDE_INT *) - xcalloc (nregs, sizeof (unsigned HOST_WIDE_INT))); - reg_sign_bit_copies - = (unsigned char *) xcalloc (nregs, sizeof (unsigned char)); - - reg_last_death = (rtx *) xmalloc (nregs * sizeof (rtx)); - reg_last_set = (rtx *) xmalloc (nregs * sizeof (rtx)); - reg_last_set_value = (rtx *) xmalloc (nregs * sizeof (rtx)); - reg_last_set_table_tick = (int *) xmalloc (nregs * sizeof (int)); - reg_last_set_label = (int *) xmalloc (nregs * sizeof (int)); - reg_last_set_invalid = (char *) xmalloc (nregs * sizeof (char)); - reg_last_set_mode - = (enum machine_mode *) xmalloc (nregs * sizeof (enum machine_mode)); - reg_last_set_nonzero_bits - = (unsigned HOST_WIDE_INT *) xmalloc (nregs * sizeof (HOST_WIDE_INT)); - reg_last_set_sign_bit_copies - = (char *) xmalloc (nregs * sizeof (char)); + reg_nonzero_bits = xcalloc (nregs, sizeof (unsigned HOST_WIDE_INT)); + reg_sign_bit_copies = xcalloc (nregs, sizeof (unsigned char)); + + reg_last_death = xmalloc (nregs * sizeof (rtx)); + reg_last_set = xmalloc (nregs * sizeof (rtx)); + reg_last_set_value = xmalloc (nregs * sizeof (rtx)); + reg_last_set_table_tick = xmalloc (nregs * sizeof (int)); + reg_last_set_label = xmalloc (nregs * sizeof (int)); + reg_last_set_invalid = xmalloc (nregs * sizeof (char)); + reg_last_set_mode = xmalloc (nregs * sizeof (enum machine_mode)); + reg_last_set_nonzero_bits = xmalloc (nregs * sizeof (HOST_WIDE_INT)); + reg_last_set_sign_bit_copies = xmalloc (nregs * sizeof (char)); init_reg_last_arrays (); @@ -548,7 +543,7 @@ combine_instructions (rtx f, unsigned int nregs) if (INSN_UID (insn) > i) i = INSN_UID (insn); - uid_cuid = (int *) xmalloc ((i + 1) * sizeof (int)); + uid_cuid = xmalloc ((i + 1) * sizeof (int)); max_uid_cuid = i; nonzero_bits_mode = mode_for_size (HOST_BITS_PER_WIDE_INT, MODE_INT, 0); @@ -788,14 +783,14 @@ init_reg_last_arrays (void) { unsigned int nregs = combine_max_regno; - memset ((char *) reg_last_death, 0, nregs * sizeof (rtx)); - memset ((char *) reg_last_set, 0, nregs * sizeof (rtx)); - memset ((char *) reg_last_set_value, 0, nregs * sizeof (rtx)); - memset ((char *) reg_last_set_table_tick, 0, nregs * sizeof (int)); - memset ((char *) reg_last_set_label, 0, nregs * sizeof (int)); + memset (reg_last_death, 0, nregs * sizeof (rtx)); + memset (reg_last_set, 0, nregs * sizeof (rtx)); + memset (reg_last_set_value, 0, nregs * sizeof (rtx)); + memset (reg_last_set_table_tick, 0, nregs * sizeof (int)); + memset (reg_last_set_label, 0, nregs * sizeof (int)); memset (reg_last_set_invalid, 0, nregs * sizeof (char)); - memset ((char *) reg_last_set_mode, 0, nregs * sizeof (enum machine_mode)); - memset ((char *) reg_last_set_nonzero_bits, 0, nregs * sizeof (HOST_WIDE_INT)); + memset (reg_last_set_mode, 0, nregs * sizeof (enum machine_mode)); + memset (reg_last_set_nonzero_bits, 0, nregs * sizeof (HOST_WIDE_INT)); memset (reg_last_set_sign_bit_copies, 0, nregs * sizeof (char)); } diff --git a/gcc/conflict.c b/gcc/conflict.c index 0aec9273b0eb..9b6377374118 100644 --- a/gcc/conflict.c +++ b/gcc/conflict.c @@ -148,8 +148,7 @@ arc_eq (const void *arcp1, const void *arcp2) conflict_graph conflict_graph_new (int num_regs) { - conflict_graph graph - = (conflict_graph) xmalloc (sizeof (struct conflict_graph_def)); + conflict_graph graph = xmalloc (sizeof (struct conflict_graph_def)); graph->num_regs = num_regs; /* Set up the hash table. No delete action is specified; memory @@ -161,8 +160,7 @@ conflict_graph_new (int num_regs) obstack_init (&graph->arc_obstack); /* Create and zero the lookup table by register number. */ - graph->neighbor_heads - = (conflict_graph_arc *) xmalloc (num_regs * sizeof (conflict_graph_arc)); + graph->neighbor_heads = xmalloc (num_regs * sizeof (conflict_graph_arc)); memset (graph->neighbor_heads, 0, num_regs * sizeof (conflict_graph_arc)); return graph; @@ -206,8 +204,7 @@ conflict_graph_add (conflict_graph graph, int reg1, int reg2) /* Allocate an arc. */ arc - = (conflict_graph_arc) - obstack_alloc (&graph->arc_obstack, + = obstack_alloc (&graph->arc_obstack, sizeof (struct conflict_graph_arc_def)); /* Record the reg numbers. */ diff --git a/gcc/coverage.c b/gcc/coverage.c index 3335237a717f..6facdce39f69 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -888,12 +888,12 @@ coverage_init (const char *filename) int len = strlen (filename); /* Name of da file. */ - da_file_name = (char *) xmalloc (len + strlen (GCOV_DATA_SUFFIX) + 1); + da_file_name = xmalloc (len + strlen (GCOV_DATA_SUFFIX) + 1); strcpy (da_file_name, filename); strcat (da_file_name, GCOV_DATA_SUFFIX); /* Name of bbg file. */ - bbg_file_name = (char *) xmalloc (len + strlen (GCOV_NOTE_SUFFIX) + 1); + bbg_file_name = xmalloc (len + strlen (GCOV_NOTE_SUFFIX) + 1); strcpy (bbg_file_name, filename); strcat (bbg_file_name, GCOV_NOTE_SUFFIX); diff --git a/gcc/cppexp.c b/gcc/cppexp.c index b558b3e8b8aa..ef2c1ea07124 100644 --- a/gcc/cppexp.c +++ b/gcc/cppexp.c @@ -966,8 +966,7 @@ _cpp_expand_op_stack (cpp_reader *pfile) size_t old_size = (size_t) (pfile->op_limit - pfile->op_stack); size_t new_size = old_size * 2 + 20; - pfile->op_stack = (struct op *) xrealloc (pfile->op_stack, - new_size * sizeof (struct op)); + pfile->op_stack = xrealloc (pfile->op_stack, new_size * sizeof (struct op)); pfile->op_limit = pfile->op_stack + new_size; return pfile->op_stack + old_size; diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index 742e5f110efe..55eaed3d8c14 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -459,7 +459,7 @@ read_include_file (cpp_reader *pfile, struct include_file *inc) size = inc->st.st_size; { - buf = (uchar *) xmalloc (size + 1); + buf = xmalloc (size + 1); offset = 0; while (offset < size) { @@ -494,7 +494,7 @@ read_include_file (cpp_reader *pfile, struct include_file *inc) bigger than the majority of C source files. */ size = 8 * 1024; - buf = (uchar *) xmalloc (size + 1); + buf = xmalloc (size + 1); offset = 0; while ((count = read (inc->fd, buf + offset, size - offset)) > 0) { @@ -553,7 +553,7 @@ cpp_included (cpp_reader *pfile, const char *fname) } /* Search directory path for the file. */ - name = (char *) alloca (strlen (fname) + pfile->max_include_len + 2); + name = alloca (strlen (fname) + pfile->max_include_len + 2); for (path = pfile->quote_include; path; path = path->next) { memcpy (name, path->name, path->len); @@ -611,7 +611,7 @@ find_include_file (cpp_reader *pfile, const char *fname, int angle_brackets, } /* Search directory path for the file. */ - name = (char *) alloca (strlen (fname) + pfile->max_include_len + 2); + name = alloca (strlen (fname) + pfile->max_include_len + 2); for (; path; path = path->next) { int len = path->len; @@ -924,14 +924,13 @@ read_name_map (cpp_reader *pfile, const char *dirname) if (! strcmp (map_list_ptr->map_list_name, dirname)) return map_list_ptr->map_list_map; - map_list_ptr = ((struct file_name_map_list *) - xmalloc (sizeof (struct file_name_map_list))); + map_list_ptr = xmalloc (sizeof (struct file_name_map_list)); map_list_ptr->map_list_name = xstrdup (dirname); /* The end of the list ends in NULL. */ map_list_ptr->map_list_map = NULL; - name = (char *) alloca (strlen (dirname) + strlen (FILE_NAME_MAP_FILE) + 2); + name = alloca (strlen (dirname) + strlen (FILE_NAME_MAP_FILE) + 2); strcpy (name, dirname); if (*dirname) strcat (name, "/"); @@ -955,8 +954,7 @@ read_name_map (cpp_reader *pfile, const char *dirname) ; to = read_filename_string (ch, f); - ptr = ((struct file_name_map *) - xmalloc (sizeof (struct file_name_map))); + ptr = xmalloc (sizeof (struct file_name_map)); ptr->map_from = from; /* Make the real filename absolute. */ @@ -1025,7 +1023,7 @@ remap_filename (cpp_reader *pfile, char *name, struct cpp_path *loc) if (p == name) cpp_error (pfile, DL_ICE, "absolute file name in remap_filename"); - dir = (char *) alloca (p - name + 1); + dir = alloca (p - name + 1); memcpy (dir, name, p - name); dir[p - name] = '\0'; from = p + 1; diff --git a/gcc/cpphash.c b/gcc/cpphash.c index 8016189bc5d2..1e07f41f7ac3 100644 --- a/gcc/cpphash.c +++ b/gcc/cpphash.c @@ -37,8 +37,7 @@ alloc_node (hash_table *table) { cpp_hashnode *node; - node = (cpp_hashnode *) obstack_alloc (&table->pfile->hash_ob, - sizeof (cpp_hashnode)); + node = obstack_alloc (&table->pfile->hash_ob, sizeof (cpp_hashnode)); memset (node, 0, sizeof (cpp_hashnode)); return node; } diff --git a/gcc/cppinit.c b/gcc/cppinit.c index 0c107b77e988..d019ee83ed04 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -130,7 +130,7 @@ cpp_create_reader (enum c_lang lang, hash_table *table) /* Initialize this instance of the library if it hasn't been already. */ init_library (); - pfile = (cpp_reader *) xcalloc (1, sizeof (cpp_reader)); + pfile = xcalloc (1, sizeof (cpp_reader)); cpp_set_lang (pfile, lang); CPP_OPTION (pfile, warn_import) = 1; diff --git a/gcc/cpplex.c b/gcc/cpplex.c index a7f13e79eae0..025d72986fb1 100644 --- a/gcc/cpplex.c +++ b/gcc/cpplex.c @@ -88,8 +88,8 @@ add_line_note (cpp_buffer *buffer, const uchar *pos, unsigned int type) if (buffer->notes_used == buffer->notes_cap) { buffer->notes_cap = buffer->notes_cap * 2 + 200; - buffer->notes = (_cpp_line_note *) - xrealloc (buffer->notes, buffer->notes_cap * sizeof (_cpp_line_note)); + buffer->notes = xrealloc (buffer->notes, + buffer->notes_cap * sizeof (_cpp_line_note)); } buffer->notes[buffer->notes_used].pos = pos; diff --git a/gcc/cpplib.c b/gcc/cpplib.c index 3169f363569a..69a1169c8e2f 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -1805,7 +1805,7 @@ cpp_define (cpp_reader *pfile, const char *str) tack " 1" on the end. */ count = strlen (str); - buf = (char *) alloca (count + 3); + buf = alloca (count + 3); memcpy (buf, str, count); p = strchr (str, '='); @@ -1866,7 +1866,7 @@ handle_assertion (cpp_reader *pfile, const char *str, int type) /* Copy the entire option so we can modify it. Change the first "=" in the string to a '(', and tack a ')' on the end. */ - char *buf = (char *) alloca (count + 2); + char *buf = alloca (count + 2); memcpy (buf, str, count); if (p) diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c index 87ad5927754e..1cf55efa0029 100644 --- a/gcc/cppmacro.c +++ b/gcc/cppmacro.c @@ -414,7 +414,7 @@ paste_tokens (cpp_reader *pfile, const cpp_token **plhs, const cpp_token *rhs) lhs = *plhs; len = cpp_token_len (lhs) + cpp_token_len (rhs) + 1; - buf = (unsigned char *) alloca (len); + buf = alloca (len); end = cpp_spell_token (pfile, lhs, buf); /* Avoid comment headers, since they are still processed in stage 3. @@ -991,8 +991,7 @@ expand_arg (cpp_reader *pfile, macro_arg *arg) /* Loop, reading in the arguments. */ capacity = 256; - arg->expanded = (const cpp_token **) - xmalloc (capacity * sizeof (cpp_token *)); + arg->expanded = xmalloc (capacity * sizeof (cpp_token *)); push_ptoken_context (pfile, NULL, NULL, arg->first, arg->count + 1); for (;;) @@ -1002,8 +1001,8 @@ expand_arg (cpp_reader *pfile, macro_arg *arg) if (arg->expanded_count + 1 >= capacity) { capacity *= 2; - arg->expanded = (const cpp_token **) - xrealloc (arg->expanded, capacity * sizeof (cpp_token *)); + arg->expanded = xrealloc (arg->expanded, + capacity * sizeof (cpp_token *)); } token = cpp_get_token (pfile); @@ -1257,7 +1256,7 @@ _cpp_save_parameter (cpp_reader *pfile, cpp_macro *macro, cpp_hashnode *node) len = macro->paramc * sizeof (union _cpp_hashnode_value); if (len > pfile->macro_buffer_len) { - pfile->macro_buffer = (uchar *) xrealloc (pfile->macro_buffer, len); + pfile->macro_buffer = xrealloc (pfile->macro_buffer, len); pfile->macro_buffer_len = len; } ((union _cpp_hashnode_value *) pfile->macro_buffer)[macro->paramc - 1] @@ -1648,7 +1647,7 @@ cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node) if (len > pfile->macro_buffer_len) { - pfile->macro_buffer = (uchar *) xrealloc (pfile->macro_buffer, len); + pfile->macro_buffer = xrealloc (pfile->macro_buffer, len); pfile->macro_buffer_len = len; } diff --git a/gcc/cppspec.c b/gcc/cppspec.c index eb5205fa3239..f53cff2a5c1a 100644 --- a/gcc/cppspec.c +++ b/gcc/cppspec.c @@ -172,7 +172,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv, return; /* One more slot for a terminating null. */ - new_argv = (const char **) xmalloc ((new_argc + 1) * sizeof(char *)); + new_argv = xmalloc ((new_argc + 1) * sizeof(char *)); new_argv[0] = argv[0]; j = 1; diff --git a/gcc/cpptrad.c b/gcc/cpptrad.c index 152bc0fd657f..caeda891253c 100644 --- a/gcc/cpptrad.c +++ b/gcc/cpptrad.c @@ -107,8 +107,7 @@ check_output_buffer (cpp_reader *pfile, size_t n) size_t size = pfile->out.cur - pfile->out.base; size_t new_size = (size + n) * 3 / 2; - pfile->out.base - = (uchar *) xrealloc (pfile->out.base, new_size); + pfile->out.base = xrealloc (pfile->out.base, new_size); pfile->out.limit = pfile->out.base + new_size; pfile->out.cur = pfile->out.base + size; } diff --git a/gcc/cse.c b/gcc/cse.c index 7d0510219369..a311be13171c 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -929,7 +929,7 @@ get_cse_reg_info (unsigned int regno) cse_reg_info_free_list = p->next; } else - p = (struct cse_reg_info *) xmalloc (sizeof (struct cse_reg_info)); + p = xmalloc (sizeof (struct cse_reg_info)); /* Insert into hash table. */ p->hash_next = *hash_head; @@ -967,7 +967,7 @@ new_basic_block (void) /* Clear out hash table state for this pass. */ - memset ((char *) reg_hash, 0, sizeof reg_hash); + memset (reg_hash, 0, sizeof reg_hash); if (cse_reg_info_used_list) { @@ -1540,7 +1540,7 @@ insert (rtx x, struct table_elt *classp, unsigned int hash, enum machine_mode mo else { n_elements_made++; - elt = (struct table_elt *) xmalloc (sizeof (struct table_elt)); + elt = xmalloc (sizeof (struct table_elt)); } elt->exp = x; @@ -4693,7 +4693,7 @@ cse_insn (rtx insn, rtx libcall_insn) if (GET_CODE (x) == SET) { - sets = (struct set *) alloca (sizeof (struct set)); + sets = alloca (sizeof (struct set)); sets[0].rtl = x; /* Ignore SETs that are unconditional jumps. @@ -4728,7 +4728,7 @@ cse_insn (rtx insn, rtx libcall_insn) { int lim = XVECLEN (x, 0); - sets = (struct set *) alloca (lim * sizeof (struct set)); + sets = alloca (lim * sizeof (struct set)); /* Find all regs explicitly clobbered in this insn, and ensure they are not replaced with any other regs @@ -6940,8 +6940,7 @@ cse_main (rtx f, int nregs, int after_loop, FILE *file) max_insn_uid = get_max_uid (); - reg_eqv_table = (struct reg_eqv_elem *) - xmalloc (nregs * sizeof (struct reg_eqv_elem)); + reg_eqv_table = xmalloc (nregs * sizeof (struct reg_eqv_elem)); #ifdef LOAD_EXTEND_OP @@ -6957,7 +6956,7 @@ cse_main (rtx f, int nregs, int after_loop, FILE *file) /* Find the largest uid. */ max_uid = get_max_uid (); - uid_cuid = (int *) xcalloc (max_uid + 1, sizeof (int)); + uid_cuid = xcalloc (max_uid + 1, sizeof (int)); /* Compute the mapping from uids to cuids. CUIDs are numbers assigned to insns, like uids, @@ -7076,9 +7075,7 @@ cse_basic_block (rtx from, rtx to, struct branch_path *next_branch, /* This array is undefined before max_reg, so only allocate the space actually needed and adjust the start. */ - qty_table - = (struct qty_table_elem *) xmalloc ((max_qty - max_reg) - * sizeof (struct qty_table_elem)); + qty_table = xmalloc ((max_qty - max_reg) * sizeof (struct qty_table_elem)); qty_table -= max_reg; new_basic_block (); @@ -7537,7 +7534,7 @@ delete_trivially_dead_insns (rtx insns, int nreg) timevar_push (TV_DELETE_TRIVIALLY_DEAD); /* First count the number of times each register is used. */ - counts = (int *) xcalloc (nreg, sizeof (int)); + counts = xcalloc (nreg, sizeof (int)); for (insn = next_real_insn (insns); insn; insn = next_real_insn (insn)) count_reg_usage (insn, counts, NULL_RTX, 1); diff --git a/gcc/cselib.c b/gcc/cselib.c index 91c63b66b0e8..8cb325d61a5e 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -147,7 +147,7 @@ new_elt_list (struct elt_list *next, cselib_val *elt) if (el) empty_elt_lists = el->next; else - el = (struct elt_list *) ggc_alloc (sizeof (struct elt_list)); + el = ggc_alloc (sizeof (struct elt_list)); el->next = next; el->elt = elt; return el; @@ -164,7 +164,7 @@ new_elt_loc_list (struct elt_loc_list *next, rtx loc) if (el) empty_elt_loc_lists = el->next; else - el = (struct elt_loc_list *) ggc_alloc (sizeof (struct elt_loc_list)); + el = ggc_alloc (sizeof (struct elt_loc_list)); el->next = next; el->loc = loc; el->setting_insn = cselib_current_insn; @@ -704,7 +704,7 @@ new_cselib_val (unsigned int value, enum machine_mode mode) if (e) empty_vals = e->u.next_free; else - e = (cselib_val *) ggc_alloc (sizeof (cselib_val)); + e = ggc_alloc (sizeof (cselib_val)); if (value == 0) abort (); diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 770b0be14c11..2501c947ef1a 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -459,7 +459,7 @@ dbxout_init (const char *input_file_name) asmfile = asm_out_file; typevec_len = 100; - typevec = (struct typeinfo *) ggc_calloc (typevec_len, sizeof typevec[0]); + typevec = ggc_calloc (typevec_len, sizeof typevec[0]); /* Convert Ltext into the appropriate format for local labels in case the system doesn't insert underscores in front of user generated @@ -513,7 +513,7 @@ dbxout_init (const char *input_file_name) next_type_number = 1; #ifdef DBX_USE_BINCL - current_file = (struct dbx_file *) ggc_alloc (sizeof *current_file); + current_file = ggc_alloc (sizeof *current_file); current_file->next = NULL; current_file->file_number = 0; current_file->next_type_number = 1; @@ -626,7 +626,7 @@ dbxout_start_source_file (unsigned int line ATTRIBUTE_UNUSED, const char *filename ATTRIBUTE_UNUSED) { #ifdef DBX_USE_BINCL - struct dbx_file *n = (struct dbx_file *) ggc_alloc (sizeof *n); + struct dbx_file *n = ggc_alloc (sizeof *n); n->next = current_file; n->next_type_number = 1; @@ -1262,11 +1262,8 @@ dbxout_type (tree type, int full) if (next_type_number == typevec_len) { typevec - = (struct typeinfo *) ggc_realloc (typevec, - (typevec_len * 2 - * sizeof typevec[0])); - memset ((char *) (typevec + typevec_len), 0, - typevec_len * sizeof typevec[0]); + = ggc_realloc (typevec, (typevec_len * 2 * sizeof typevec[0])); + memset (typevec + typevec_len, 0, typevec_len * sizeof typevec[0]); typevec_len *= 2; } diff --git a/gcc/defaults.h b/gcc/defaults.h index b968ea645ebd..60e29253510a 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -66,7 +66,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #ifndef ASM_FORMAT_PRIVATE_NAME # define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ do { const char *const name_ = (NAME); \ - char *const output_ = (OUTPUT) = (char *) alloca (strlen (name_) + 32);\ + char *const output_ = (OUTPUT) = alloca (strlen (name_) + 32);\ sprintf (output_, ASM_PN_FORMAT, name_, (unsigned long)(LABELNO)); \ } while (0) #endif diff --git a/gcc/df.c b/gcc/df.c index ae1896aa9b67..ae99d8eb64f5 100644 --- a/gcc/df.c +++ b/gcc/df.c @@ -316,8 +316,7 @@ df_insn_table_realloc (struct df *df, unsigned int size) to enlarge it so often. */ size += df->insn_size / 4; - df->insns = (struct insn_info *) - xrealloc (df->insns, size * sizeof (struct insn_info)); + df->insns = xrealloc (df->insns, size * sizeof (struct insn_info)); memset (df->insns + df->insn_size, 0, (size - df->insn_size) * sizeof (struct insn_info)); @@ -344,8 +343,7 @@ df_reg_table_realloc (struct df *df, int size) if (size < max_reg_num ()) size = max_reg_num (); - df->regs = (struct reg_info *) - xrealloc (df->regs, size * sizeof (struct reg_info)); + df->regs = xrealloc (df->regs, size * sizeof (struct reg_info)); /* Zero the new entries. */ memset (df->regs + df->reg_size, 0, diff --git a/gcc/dominance.c b/gcc/dominance.c index a9411d40431b..944aaf81127e 100644 --- a/gcc/dominance.c +++ b/gcc/dominance.c @@ -133,10 +133,10 @@ void debug_dominance_info (dominance_info); { \ unsigned int i = 1; /* Catch content == i. */ \ if (! (content)) \ - (var) = (type *) xcalloc ((num), sizeof (type)); \ + (var) = xcalloc ((num), sizeof (type)); \ else \ { \ - (var) = (type *) xmalloc ((num) * sizeof (type)); \ + (var) = xmalloc ((num) * sizeof (type)); \ for (i = 0; i < num; i++) \ (var)[i] = (content); \ } \ @@ -212,7 +212,7 @@ calc_dfs_tree_nonrec (struct dom_info *di, basic_block bb, enum cdi_direction re /* Ending block. */ basic_block ex_block; - stack = (edge *) xmalloc ((n_basic_blocks + 3) * sizeof (edge)); + stack = xmalloc ((n_basic_blocks + 3) * sizeof (edge)); sp = 0; /* Initialize our border blocks, and the first edge. */ diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 94269b16c1a0..368927168d22 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -553,7 +553,7 @@ dwarf_cfi_name (unsigned int cfi_opc) static inline dw_cfi_ref new_cfi (void) { - dw_cfi_ref cfi = (dw_cfi_ref) ggc_alloc (sizeof (dw_cfi_node)); + dw_cfi_ref cfi = ggc_alloc (sizeof (dw_cfi_node)); cfi->dw_cfi_next = NULL; cfi->dw_cfi_oprnd1.dw_cfi_reg_num = 0; @@ -2248,8 +2248,7 @@ void dwarf2out_frame_init (void) { /* Allocate the initial hunk of the fde_table. */ - fde_table = (dw_fde_ref) ggc_alloc_cleared (FDE_TABLE_INCREMENT - * sizeof (dw_fde_node)); + fde_table = ggc_alloc_cleared (FDE_TABLE_INCREMENT * sizeof (dw_fde_node)); fde_table_allocated = FDE_TABLE_INCREMENT; fde_table_in_use = 0; @@ -2719,8 +2718,7 @@ static inline dw_loc_descr_ref new_loc_descr (enum dwarf_location_atom op, long unsigned int oprnd1, long unsigned int oprnd2) { - dw_loc_descr_ref descr - = (dw_loc_descr_ref) ggc_alloc_cleared (sizeof (dw_loc_descr_node)); + dw_loc_descr_ref descr = ggc_alloc_cleared (sizeof (dw_loc_descr_node)); descr->dw_loc_opc = op; descr->dw_loc_oprnd1.val_class = dw_val_class_unsigned_const; @@ -4444,7 +4442,7 @@ AT_class (dw_attr_ref a) static inline void add_AT_flag (dw_die_ref die, enum dwarf_attribute attr_kind, unsigned int flag) { - dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr_next = NULL; attr->dw_attr = attr_kind; @@ -4467,7 +4465,7 @@ AT_flag (dw_attr_ref a) static inline void add_AT_int (dw_die_ref die, enum dwarf_attribute attr_kind, long int int_val) { - dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr_next = NULL; attr->dw_attr = attr_kind; @@ -4491,7 +4489,7 @@ static inline void add_AT_unsigned (dw_die_ref die, enum dwarf_attribute attr_kind, long unsigned int unsigned_val) { - dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr_next = NULL; attr->dw_attr = attr_kind; @@ -4515,7 +4513,7 @@ static inline void add_AT_long_long (dw_die_ref die, enum dwarf_attribute attr_kind, long unsigned int val_hi, long unsigned int val_low) { - dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr_next = NULL; attr->dw_attr = attr_kind; @@ -4531,7 +4529,7 @@ static inline void add_AT_float (dw_die_ref die, enum dwarf_attribute attr_kind, unsigned int length, long int *array) { - dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr_next = NULL; attr->dw_attr = attr_kind; @@ -4561,7 +4559,7 @@ debug_str_eq (const void *x1, const void *x2) static inline void add_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind, const char *str) { - dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); struct indirect_string_node *node; void **slot; @@ -4638,7 +4636,7 @@ AT_string_form (dw_attr_ref a) static inline void add_AT_die_ref (dw_die_ref die, enum dwarf_attribute attr_kind, dw_die_ref targ_die) { - dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr_next = NULL; attr->dw_attr = attr_kind; @@ -4680,7 +4678,7 @@ set_AT_ref_external (dw_attr_ref a, int i) static inline void add_AT_fde_ref (dw_die_ref die, enum dwarf_attribute attr_kind, unsigned int targ_fde) { - dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr_next = NULL; attr->dw_attr = attr_kind; @@ -4694,7 +4692,7 @@ add_AT_fde_ref (dw_die_ref die, enum dwarf_attribute attr_kind, unsigned int tar static inline void add_AT_loc (dw_die_ref die, enum dwarf_attribute attr_kind, dw_loc_descr_ref loc) { - dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr_next = NULL; attr->dw_attr = attr_kind; @@ -4715,7 +4713,7 @@ AT_loc (dw_attr_ref a) static inline void add_AT_loc_list (dw_die_ref die, enum dwarf_attribute attr_kind, dw_loc_list_ref loc_list) { - dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr_next = NULL; attr->dw_attr = attr_kind; @@ -4739,7 +4737,7 @@ AT_loc_list (dw_attr_ref a) static inline void add_AT_addr (dw_die_ref die, enum dwarf_attribute attr_kind, rtx addr) { - dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr_next = NULL; attr->dw_attr = attr_kind; @@ -4762,7 +4760,7 @@ AT_addr (dw_attr_ref a) static inline void add_AT_lbl_id (dw_die_ref die, enum dwarf_attribute attr_kind, const char *lbl_id) { - dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr_next = NULL; attr->dw_attr = attr_kind; @@ -4776,7 +4774,7 @@ add_AT_lbl_id (dw_die_ref die, enum dwarf_attribute attr_kind, const char *lbl_i static inline void add_AT_lbl_offset (dw_die_ref die, enum dwarf_attribute attr_kind, const char *label) { - dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr_next = NULL; attr->dw_attr = attr_kind; @@ -4790,7 +4788,7 @@ add_AT_lbl_offset (dw_die_ref die, enum dwarf_attribute attr_kind, const char *l static inline void add_AT_offset (dw_die_ref die, enum dwarf_attribute attr_kind, long unsigned int offset) { - dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr_next = NULL; attr->dw_attr = attr_kind; @@ -4805,7 +4803,7 @@ static void add_AT_range_list (dw_die_ref die, enum dwarf_attribute attr_kind, long unsigned int offset) { - dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr_next = NULL; attr->dw_attr = attr_kind; @@ -5089,7 +5087,7 @@ splice_child_die (dw_die_ref parent, dw_die_ref child) static inline dw_die_ref new_die (enum dwarf_tag tag_value, dw_die_ref parent_die, tree t) { - dw_die_ref die = (dw_die_ref) ggc_alloc_cleared (sizeof (die_node)); + dw_die_ref die = ggc_alloc_cleared (sizeof (die_node)); die->die_tag = tag_value; @@ -5153,7 +5151,7 @@ equate_decl_number_to_die (tree decl, dw_die_ref decl_die) decl_die_table = ggc_realloc (decl_die_table, sizeof (dw_die_ref) * num_allocated); - memset ((char *) &decl_die_table[decl_die_table_allocated], 0, + memset (&decl_die_table[decl_die_table_allocated], 0, (num_allocated - decl_die_table_allocated) * sizeof (dw_die_ref)); decl_die_table_allocated = num_allocated; } @@ -5663,7 +5661,7 @@ compute_section_prefix (dw_die_ref unit_die) { const char *die_name = get_AT_string (unit_die, DW_AT_name); const char *base = die_name ? lbasename (die_name) : "anonymous"; - char *name = (char *) alloca (strlen (base) + 64); + char *name = alloca (strlen (base) + 64); char *p; int i, mark; unsigned char checksum[16]; @@ -6054,7 +6052,7 @@ build_abbrev_table (dw_die_ref die) abbrev_die_table = ggc_realloc (abbrev_die_table, sizeof (dw_die_ref) * n_alloc); - memset ((char *) &abbrev_die_table[abbrev_die_table_allocated], 0, + memset (&abbrev_die_table[abbrev_die_table_allocated], 0, (n_alloc - abbrev_die_table_allocated) * sizeof (dw_die_ref)); abbrev_die_table_allocated = n_alloc; } @@ -6724,7 +6722,7 @@ output_comp_unit (dw_die_ref die, int output_if_empty) oldsym = die->die_symbol; if (oldsym) { - tmp = (char *) alloca (strlen (oldsym) + 24); + tmp = alloca (strlen (oldsym) + 24); sprintf (tmp, ".gnu.linkonce.wi.%s", oldsym); secname = tmp; @@ -6771,9 +6769,8 @@ add_pubname (tree decl, dw_die_ref die) { pubname_table_allocated += PUBNAME_TABLE_INCREMENT; pubname_table - = (pubname_ref) ggc_realloc (pubname_table, - (pubname_table_allocated - * sizeof (pubname_entry))); + = ggc_realloc (pubname_table, + (pubname_table_allocated * sizeof (pubname_entry))); memset (pubname_table + pubname_table_in_use, 0, PUBNAME_TABLE_INCREMENT * sizeof (pubname_entry)); } @@ -6932,9 +6929,9 @@ add_ranges (tree block) if (in_use == ranges_table_allocated) { ranges_table_allocated += RANGES_TABLE_INCREMENT; - ranges_table = (dw_ranges_ref) - ggc_realloc (ranges_table, (ranges_table_allocated - * sizeof (struct dw_ranges_struct))); + ranges_table + = ggc_realloc (ranges_table, (ranges_table_allocated + * sizeof (struct dw_ranges_struct))); memset (ranges_table + ranges_table_in_use, 0, RANGES_TABLE_INCREMENT * sizeof (struct dw_ranges_struct)); } @@ -7084,10 +7081,8 @@ output_file_names (void) } /* Allocate the various arrays we need. */ - files = (struct file_info *) alloca (VARRAY_ACTIVE_SIZE (file_table) - * sizeof (struct file_info)); - dirs = (struct dir_info *) alloca (VARRAY_ACTIVE_SIZE (file_table) - * sizeof (struct dir_info)); + files = alloca (VARRAY_ACTIVE_SIZE (file_table) * sizeof (struct file_info)); + dirs = alloca (VARRAY_ACTIVE_SIZE (file_table) * sizeof (struct dir_info)); /* Sort the file names. */ for (i = 1; i < VARRAY_ACTIVE_SIZE (file_table); i++) @@ -7162,8 +7157,8 @@ output_file_names (void) where we would have to check out every combination of every single possible prefix. Instead we use a heuristic which provides nearly optimal results in most cases and never is much off. */ - saved = (int *) alloca (ndirs * sizeof (int)); - savehere = (int *) alloca (ndirs * sizeof (int)); + saved = alloca (ndirs * sizeof (int)); + savehere = alloca (ndirs * sizeof (int)); memset (saved, '\0', ndirs * sizeof (saved[0])); for (i = 0; i < ndirs; i++) @@ -7220,7 +7215,7 @@ output_file_names (void) /* We have to emit them in the order they appear in the file_table array since the index is used in the debug info generation. To do this efficiently we generate a back-mapping of the indices first. */ - backmap = (int *) alloca (VARRAY_ACTIVE_SIZE (file_table) * sizeof (int)); + backmap = alloca (VARRAY_ACTIVE_SIZE (file_table) * sizeof (int)); for (i = 1; i < VARRAY_ACTIVE_SIZE (file_table); i++) { backmap[files[i].file_idx] = i; @@ -9092,7 +9087,7 @@ add_const_value_attribute (dw_die_ref die, rtx rtl) if (GET_MODE_CLASS (mode) == MODE_FLOAT) { unsigned length = GET_MODE_SIZE (mode) / 4; - long *array = (long *) ggc_alloc (sizeof (long) * length); + long *array = ggc_alloc (sizeof (long) * length); REAL_VALUE_TYPE rv; REAL_VALUE_FROM_CONST_DOUBLE (rv, rtl); @@ -12213,12 +12208,11 @@ dwarf2out_source_line (unsigned int line, const char *filename) { separate_line_info_table_allocated += LINE_INFO_TABLE_INCREMENT; separate_line_info_table - = (dw_separate_line_info_ref) - ggc_realloc (separate_line_info_table, + = ggc_realloc (separate_line_info_table, separate_line_info_table_allocated * sizeof (dw_separate_line_info_entry)); - memset ((separate_line_info_table - + separate_line_info_table_in_use), + memset (separate_line_info_table + + separate_line_info_table_in_use, 0, (LINE_INFO_TABLE_INCREMENT * sizeof (dw_separate_line_info_entry))); diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index caed46066435..ab80df16a0a6 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -3517,8 +3517,8 @@ dienum_push (void) { pending_siblings_allocated += PENDING_SIBLINGS_INCREMENT; pending_sibling_stack - = (unsigned *) xrealloc (pending_sibling_stack, - pending_siblings_allocated * sizeof(unsigned)); + = xrealloc (pending_sibling_stack, + pending_siblings_allocated * sizeof(unsigned)); } pending_siblings++; @@ -4406,8 +4406,8 @@ pend_type (tree type) { pending_types_allocated += PENDING_TYPES_INCREMENT; pending_types_list - = (tree *) xrealloc (pending_types_list, - sizeof (tree) * pending_types_allocated); + = xrealloc (pending_types_list, + sizeof (tree) * pending_types_allocated); } pending_types_list[pending_types++] = type; @@ -4533,8 +4533,8 @@ add_incomplete_type (tree type) { incomplete_types_allocated += INCOMPLETE_TYPES_INCREMENT; incomplete_types_list - = (tree *) xrealloc (incomplete_types_list, - sizeof (tree) * incomplete_types_allocated); + = xrealloc (incomplete_types_list, + sizeof (tree) * incomplete_types_allocated); } incomplete_types_list[incomplete_types++] = type; @@ -5851,8 +5851,7 @@ lookup_filename (const char *file_name) { ft_entries_allocated += FT_ENTRIES_INCREMENT; filename_table - = (filename_entry *) - xrealloc (filename_table, + = xrealloc (filename_table, ft_entries_allocated * sizeof (filename_entry)); } @@ -6035,23 +6034,19 @@ dwarfout_init (const char *main_input_filename) /* Allocate the initial hunk of the pending_sibling_stack. */ pending_sibling_stack - = (unsigned *) - xmalloc (PENDING_SIBLINGS_INCREMENT * sizeof (unsigned)); + = xmalloc (PENDING_SIBLINGS_INCREMENT * sizeof (unsigned)); pending_siblings_allocated = PENDING_SIBLINGS_INCREMENT; pending_siblings = 1; /* Allocate the initial hunk of the filename_table. */ - filename_table - = (filename_entry *) - xmalloc (FT_ENTRIES_INCREMENT * sizeof (filename_entry)); + filename_table = xmalloc (FT_ENTRIES_INCREMENT * sizeof (filename_entry)); ft_entries_allocated = FT_ENTRIES_INCREMENT; ft_entries = 0; /* Allocate the initial hunk of the pending_types_list. */ - pending_types_list - = (tree *) xmalloc (PENDING_TYPES_INCREMENT * sizeof (tree)); + pending_types_list = xmalloc (PENDING_TYPES_INCREMENT * sizeof (tree)); pending_types_allocated = PENDING_TYPES_INCREMENT; pending_types = 0; diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 6a1f7c570927..f88c5bf09030 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -772,7 +772,7 @@ gen_rtvec (int n, ...) if (n == 0) return NULL_RTVEC; /* Don't allocate an empty rtvec... */ - vector = (rtx *) alloca (n * sizeof (rtx)); + vector = alloca (n * sizeof (rtx)); for (i = 0; i < n; i++) vector[i] = va_arg (p, rtx); @@ -845,8 +845,8 @@ gen_reg_rtx (enum machine_mode mode) memset (new + old_size, 0, old_size); f->emit->regno_pointer_align = (unsigned char *) new; - new1 = (rtx *) ggc_realloc (f->emit->x_regno_reg_rtx, - old_size * 2 * sizeof (rtx)); + new1 = ggc_realloc (f->emit->x_regno_reg_rtx, + old_size * 2 * sizeof (rtx)); memset (new1 + old_size, 0, old_size * sizeof (rtx)); regno_reg_rtx = new1; @@ -4874,7 +4874,7 @@ start_sequence (void) free_sequence_stack = tem->next; } else - tem = (struct sequence_stack *) ggc_alloc (sizeof (struct sequence_stack)); + tem = ggc_alloc (sizeof (struct sequence_stack)); tem->next = seq_stack; tem->first = first_insn; @@ -5205,7 +5205,7 @@ init_emit (void) { struct function *f = cfun; - f->emit = (struct emit_status *) ggc_alloc (sizeof (struct emit_status)); + f->emit = ggc_alloc (sizeof (struct emit_status)); first_insn = NULL; last_insn = NULL; seq_rtl_expr = NULL; @@ -5222,11 +5222,11 @@ init_emit (void) f->emit->regno_pointer_align_length = LAST_VIRTUAL_REGISTER + 101; f->emit->regno_pointer_align - = (unsigned char *) ggc_alloc_cleared (f->emit->regno_pointer_align_length - * sizeof (unsigned char)); + = ggc_alloc_cleared (f->emit->regno_pointer_align_length + * sizeof (unsigned char)); regno_reg_rtx - = (rtx *) ggc_alloc (f->emit->regno_pointer_align_length * sizeof (rtx)); + = ggc_alloc (f->emit->regno_pointer_align_length * sizeof (rtx)); /* Put copies of all the hard registers into regno_reg_rtx. */ memcpy (regno_reg_rtx, diff --git a/gcc/except.c b/gcc/except.c index 63a35702b913..c34dcd9b5214 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -458,8 +458,7 @@ init_eh (void) void init_eh_for_function (void) { - cfun->eh = (struct eh_status *) - ggc_alloc_cleared (sizeof (struct eh_status)); + cfun->eh = ggc_alloc_cleared (sizeof (struct eh_status)); } /* Start an exception handling region. All instructions emitted @@ -477,7 +476,7 @@ expand_eh_region_start (void) return; /* Insert a new blank region as a leaf in the tree. */ - new_region = (struct eh_region *) ggc_alloc_cleared (sizeof (*new_region)); + new_region = ggc_alloc_cleared (sizeof (*new_region)); cur_region = cfun->eh->cur_region; new_region->outer = cur_region; if (cur_region) @@ -1158,7 +1157,7 @@ add_ehl_entry (rtx label, struct eh_region *region) LABEL_PRESERVE_P (label) = 1; - entry = (struct ehl_map_entry *) ggc_alloc (sizeof (*entry)); + entry = ggc_alloc (sizeof (*entry)); entry->label = label; entry->region = region; @@ -1237,8 +1236,7 @@ current_function_has_exception_handlers (void) static struct eh_region * duplicate_eh_region_1 (struct eh_region *o, struct inline_remap *map) { - struct eh_region *n - = (struct eh_region *) ggc_alloc_cleared (sizeof (struct eh_region)); + struct eh_region *n = ggc_alloc_cleared (sizeof (struct eh_region)); n->region_number = o->region_number + cfun->eh->last_region_number; n->type = o->type; @@ -1493,7 +1491,7 @@ add_ttypes_entry (htab_t ttypes_hash, tree type) { /* Filter value is a 1 based table index. */ - n = (struct ttypes_filter *) xmalloc (sizeof (*n)); + n = xmalloc (sizeof (*n)); n->t = type; n->filter = VARRAY_ACTIVE_SIZE (cfun->eh->ttype_data) + 1; *slot = n; @@ -1521,7 +1519,7 @@ add_ehspec_entry (htab_t ehspec_hash, htab_t ttypes_hash, tree list) { /* Filter value is a -1 based byte index into a uleb128 buffer. */ - n = (struct ttypes_filter *) xmalloc (sizeof (*n)); + n = xmalloc (sizeof (*n)); n->t = list; n->filter = -(VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data) + 1); *slot = n; @@ -2187,8 +2185,8 @@ sjlj_build_landing_pads (void) { struct sjlj_lp_info *lp_info; - lp_info = (struct sjlj_lp_info *) xcalloc (cfun->eh->last_region_number + 1, - sizeof (struct sjlj_lp_info)); + lp_info = xcalloc (cfun->eh->last_region_number + 1, + sizeof (struct sjlj_lp_info)); if (sjlj_find_directly_reachable_regions (lp_info)) { @@ -3108,7 +3106,7 @@ add_action_record (htab_t ar_hash, int filter, int next) if ((new = *slot) == NULL) { - new = (struct action_record *) xmalloc (sizeof (*new)); + new = xmalloc (sizeof (*new)); new->offset = VARRAY_ACTIVE_SIZE (cfun->eh->action_record_data) + 1; new->filter = filter; new->next = next; @@ -3239,8 +3237,7 @@ add_call_site (rtx landing_pad, int action) if (used >= size) { size = (size ? size * 2 : 64); - data = (struct call_site_record *) - ggc_realloc (data, sizeof (*data) * size); + data = ggc_realloc (data, sizeof (*data) * size); cfun->eh->call_site_data = data; cfun->eh->call_site_data_size = size; } diff --git a/gcc/expmed.c b/gcc/expmed.c index 883eff5b52b4..68163e9ba2b0 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -2096,8 +2096,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t, /* We'll be needing a couple extra algorithm structures now. */ - alg_in = (struct algorithm *)alloca (sizeof (struct algorithm)); - best_alg = (struct algorithm *)alloca (sizeof (struct algorithm)); + alg_in = alloca (sizeof (struct algorithm)); + best_alg = alloca (sizeof (struct algorithm)); /* If we have a group of zero bits at the low-order part of T, try multiplying by the remaining bits and then doing a shift. */ diff --git a/gcc/expr.c b/gcc/expr.c index ee181a83e714..e76e364c891d 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -339,7 +339,7 @@ init_expr_once (void) void init_expr (void) { - cfun->expr = (struct expr_status *) ggc_alloc (sizeof (struct expr_status)); + cfun->expr = ggc_alloc (sizeof (struct expr_status)); pending_chain = 0; pending_stack_adjust = 0; @@ -2224,7 +2224,7 @@ gen_group_rtx (rtx orig) abort (); length = XVECLEN (orig, 0); - tmps = (rtx *) alloca (sizeof (rtx) * length); + tmps = alloca (sizeof (rtx) * length); /* Skip a NULL entry in first slot. */ i = XEXP (XVECEXP (orig, 0, 0), 0) ? 0 : 1; @@ -2264,7 +2264,7 @@ emit_group_load (rtx dst, rtx orig_src, tree type ATTRIBUTE_UNUSED, int ssize) else start = 1; - tmps = (rtx *) alloca (sizeof (rtx) * XVECLEN (dst, 0)); + tmps = alloca (sizeof (rtx) * XVECLEN (dst, 0)); /* Process the pieces. */ for (i = start; i < XVECLEN (dst, 0); i++) @@ -2421,7 +2421,7 @@ emit_group_store (rtx orig_dst, rtx src, tree type ATTRIBUTE_UNUSED, int ssize) else start = 1; - tmps = (rtx *) alloca (sizeof (rtx) * XVECLEN (src, 0)); + tmps = alloca (sizeof (rtx) * XVECLEN (src, 0)); /* Copy the (probable) hard regs into pseudos. */ for (i = start; i < XVECLEN (src, 0); i++) @@ -5388,7 +5388,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) { unsigned int set_word_size = TYPE_ALIGN (TREE_TYPE (exp)); enum machine_mode mode = mode_for_size (set_word_size, MODE_INT, 1); - char *bit_buffer = (char *) alloca (nbits); + char *bit_buffer = alloca (nbits); HOST_WIDE_INT word = 0; unsigned int bit_pos = 0; unsigned int ibit = 0; diff --git a/gcc/final.c b/gcc/final.c index cfc730cf1f78..6f2b5fb55ebb 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -658,8 +658,8 @@ compute_alignments (void) max_labelno = max_label_num (); min_labelno = get_first_label_num (); - label_align = (struct label_alignment *) - xcalloc (max_labelno - min_labelno + 1, sizeof (struct label_alignment)); + label_align = xcalloc (max_labelno - min_labelno + 1, + sizeof (struct label_alignment)); /* If not optimizing or optimizing for size, don't assign any alignments. */ if (! optimize || optimize_size) @@ -766,7 +766,7 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED) /* Compute maximum UID and allocate label_align / uid_shuid. */ max_uid = get_max_uid (); - uid_shuid = (int *) xmalloc (max_uid * sizeof *uid_shuid); + uid_shuid = xmalloc (max_uid * sizeof *uid_shuid); if (max_labelno != max_label_num ()) { @@ -779,8 +779,8 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED) n_labels = max_labelno - min_labelno + 1; n_old_labels = old - min_labelno + 1; - label_align = (struct label_alignment *) xrealloc - (label_align, n_labels * sizeof (struct label_alignment)); + label_align = xrealloc (label_align, + n_labels * sizeof (struct label_alignment)); /* Range of labels grows monotonically in the function. Abort here means that the initialization of array got lost. */ @@ -875,20 +875,20 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED) #ifdef HAVE_ATTR_length /* Allocate the rest of the arrays. */ - insn_lengths = (int *) xmalloc (max_uid * sizeof (*insn_lengths)); + insn_lengths = xmalloc (max_uid * sizeof (*insn_lengths)); insn_lengths_max_uid = max_uid; /* Syntax errors can lead to labels being outside of the main insn stream. Initialize insn_addresses, so that we get reproducible results. */ INSN_ADDRESSES_ALLOC (max_uid); - varying_length = (char *) xcalloc (max_uid, sizeof (char)); + varying_length = xcalloc (max_uid, sizeof (char)); /* Initialize uid_align. We scan instructions from end to start, and keep in align_tab[n] the last seen insn that does an alignment of at least n+1, i.e. the successor in the alignment chain for an insn that does / has a known alignment of n. */ - uid_align = (rtx *) xcalloc (max_uid, sizeof *uid_align); + uid_align = xcalloc (max_uid, sizeof *uid_align); for (i = MAX_CODE_ALIGN; --i >= 0;) align_tab[i] = NULL_RTX; @@ -1566,7 +1566,7 @@ final (rtx first, FILE *file, int optimize, int prescan) max_line = NOTE_LINE_NUMBER (insn); } - line_note_exists = (char *) xcalloc (max_line + 1, sizeof (char)); + line_note_exists = xcalloc (max_line + 1, sizeof (char)); for (insn = first; insn; insn = NEXT_INSN (insn)) { @@ -2055,7 +2055,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED, if (asm_noperands (body) >= 0) { unsigned int noperands = asm_noperands (body); - rtx *ops = (rtx *) alloca (noperands * sizeof (rtx)); + rtx *ops = alloca (noperands * sizeof (rtx)); const char *string; /* There's no telling what that did to the condition codes. */ @@ -3865,8 +3865,8 @@ debug_queue_symbol (tree decl) if (symbol_queue_index >= symbol_queue_size) { symbol_queue_size += 10; - symbol_queue = (tree *) xrealloc (symbol_queue, - symbol_queue_size * sizeof (tree)); + symbol_queue = xrealloc (symbol_queue, + symbol_queue_size * sizeof (tree)); } symbol_queue[symbol_queue_index++] = decl; diff --git a/gcc/fix-header.c b/gcc/fix-header.c index 8f5383983a20..0c55481b4efa 100644 --- a/gcc/fix-header.c +++ b/gcc/fix-header.c @@ -544,8 +544,7 @@ recognized_function (const cpp_token *fname, unsigned int line, int kind, /* We only have a partial function declaration, so remember that we have to add a complete prototype. */ partial_count++; - partial = (struct partial_proto *) - obstack_alloc (&scan_file_obstack, sizeof (struct partial_proto)); + partial = obstack_alloc (&scan_file_obstack, sizeof (struct partial_proto)); partial->line_seen = line; partial->fn = fn; fn->partial = partial; @@ -1169,7 +1168,7 @@ main (int argc, char **argv) exit (FATAL_EXIT_CODE); } inf_size = sbuf.st_size; - inf_buffer = (char *) xmalloc (inf_size + 2); + inf_buffer = xmalloc (inf_size + 2); inf_ptr = inf_buffer; to_read = inf_size; diff --git a/gcc/flow.c b/gcc/flow.c index 4fab7b357df9..4bc33e286027 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -1082,7 +1082,7 @@ calculate_global_regs_live (sbitmap blocks_in, sbitmap blocks_out, int flags) /* Create a worklist. Allocate an extra slot for ENTRY_BLOCK, and one because the `head == tail' style test for an empty queue doesn't work with a full queue. */ - queue = (basic_block *) xmalloc ((n_basic_blocks + 2) * sizeof (*queue)); + queue = xmalloc ((n_basic_blocks + 2) * sizeof (*queue)); qtail = queue; qhead = qend = queue + n_basic_blocks + 2; @@ -1850,7 +1850,7 @@ init_propagate_block_info (basic_block bb, regset live, regset local_set, pbi->flags = flags; if (flags & (PROP_LOG_LINKS | PROP_AUTOINC)) - pbi->reg_next_use = (rtx *) xcalloc (max_reg_num (), sizeof (rtx)); + pbi->reg_next_use = xcalloc (max_reg_num (), sizeof (rtx)); else pbi->reg_next_use = NULL; @@ -1932,7 +1932,7 @@ init_propagate_block_info (basic_block bb, regset live, regset local_set, struct reg_cond_life_info *rcli; rtx cond; - rcli = (struct reg_cond_life_info *) xmalloc (sizeof (*rcli)); + rcli = xmalloc (sizeof (*rcli)); if (REGNO_REG_SET_P (bb_true->global_live_at_start, i)) cond = cond_false; @@ -2867,7 +2867,7 @@ mark_regno_cond_dead (struct propagate_block_info *pbi, int regno, rtx cond) /* The register was unconditionally live previously. Record the current condition as the condition under which it is dead. */ - rcli = (struct reg_cond_life_info *) xmalloc (sizeof (*rcli)); + rcli = xmalloc (sizeof (*rcli)); rcli->condition = cond; rcli->stores = cond; rcli->orig_condition = const0_rtx; @@ -3644,7 +3644,7 @@ mark_used_reg (struct propagate_block_info *pbi, rtx reg, { /* The register was not previously live at all. Record the condition under which it is still dead. */ - rcli = (struct reg_cond_life_info *) xmalloc (sizeof (*rcli)); + rcli = xmalloc (sizeof (*rcli)); rcli->condition = not_reg_cond (cond); rcli->stores = const0_rtx; rcli->orig_condition = const0_rtx; diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 32c145effe13..9fd4f001242b 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -313,7 +313,7 @@ mul_double (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1, encode (arg1, l1, h1); encode (arg2, l2, h2); - memset ((char *) prod, 0, sizeof prod); + memset (prod, 0, sizeof prod); for (i = 0; i < 4; i++) { @@ -591,10 +591,10 @@ div_and_round_double (enum tree_code code, int uns, goto finish_up; } - memset ((char *) quo, 0, sizeof quo); + memset (quo, 0, sizeof quo); - memset ((char *) num, 0, sizeof num); /* to zero 9th element */ - memset ((char *) den, 0, sizeof den); + memset (num, 0, sizeof num); /* to zero 9th element */ + memset (den, 0, sizeof den); encode (num, lnum, hnum); encode (den, lden, hden); diff --git a/gcc/function.c b/gcc/function.c index 612499535739..f8cc5a509ad3 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -692,7 +692,7 @@ assign_stack_temp_for_type (enum machine_mode mode, HOST_WIDE_INT size, int keep if (best_p->size - rounded_size >= alignment) { - p = (struct temp_slot *) ggc_alloc (sizeof (struct temp_slot)); + p = ggc_alloc (sizeof (struct temp_slot)); p->in_use = p->addr_taken = 0; p->size = best_p->size - rounded_size; p->base_offset = best_p->base_offset + rounded_size; @@ -723,7 +723,7 @@ assign_stack_temp_for_type (enum machine_mode mode, HOST_WIDE_INT size, int keep { HOST_WIDE_INT frame_offset_old = frame_offset; - p = (struct temp_slot *) ggc_alloc (sizeof (struct temp_slot)); + p = ggc_alloc (sizeof (struct temp_slot)); /* We are passing an explicit alignment request to assign_stack_local. One side effect of that is assign_stack_local will not round SIZE @@ -1477,8 +1477,7 @@ schedule_fixup_var_refs (struct function *function, rtx reg, tree type, { struct var_refs_queue *temp; - temp - = (struct var_refs_queue *) ggc_alloc (sizeof (struct var_refs_queue)); + temp = ggc_alloc (sizeof (struct var_refs_queue)); temp->modified = reg; temp->promoted_mode = promoted_mode; temp->unsignedp = unsigned_p; @@ -1553,7 +1552,7 @@ find_fixup_replacement (struct fixup_replacement **replacements, rtx x) if (p == 0) { - p = (struct fixup_replacement *) xmalloc (sizeof (struct fixup_replacement)); + p = xmalloc (sizeof (struct fixup_replacement)); p->old = x; p->new = 0; p->next = *replacements; @@ -1627,7 +1626,7 @@ fixup_var_refs_insns_with_hash (htab_t ht, rtx var, enum machine_mode promoted_m rtx insn_list; tmp.key = var; - ime = (struct insns_for_mem_entry *) htab_find (ht, &tmp); + ime = htab_find (ht, &tmp); for (insn_list = ime->insns; insn_list != 0; insn_list = XEXP (insn_list, 1)) if (INSN_P (XEXP (insn_list, 0))) fixup_var_refs_insn (XEXP (insn_list, 0), var, promoted_mode, @@ -3295,7 +3294,7 @@ insns_for_mem_walk (rtx *r, void *data) { struct insns_for_mem_entry *ifme; tmp.key = *r; - ifme = (struct insns_for_mem_entry *) htab_find (ifmwi->ht, &tmp); + ifme = htab_find (ifmwi->ht, &tmp); /* If we have not already recorded this INSN, do so now. Since we process the INSNs in order, we know that if we have @@ -4281,7 +4280,7 @@ assign_parms (tree fndecl) orig_fnargs = fnargs; max_parm_reg = LAST_VIRTUAL_REGISTER + 1; - parm_reg_stack_loc = (rtx *) ggc_alloc_cleared (max_parm_reg * sizeof (rtx)); + parm_reg_stack_loc = ggc_alloc_cleared (max_parm_reg * sizeof (rtx)); if (SPLIT_COMPLEX_ARGS) fnargs = split_complex_args (fnargs); @@ -4944,10 +4943,10 @@ assign_parms (tree fndecl) but it's also rare and we need max_parm_reg to be precisely correct. */ max_parm_reg = regno + 1; - new = (rtx *) ggc_realloc (parm_reg_stack_loc, - max_parm_reg * sizeof (rtx)); - memset ((char *) (new + old_max_parm_reg), 0, - (max_parm_reg - old_max_parm_reg) * sizeof (rtx)); + new = ggc_realloc (parm_reg_stack_loc, + max_parm_reg * sizeof (rtx)); + memset (new + old_max_parm_reg, 0, + (max_parm_reg - old_max_parm_reg) * sizeof (rtx)); parm_reg_stack_loc = new; } @@ -5885,7 +5884,7 @@ identify_blocks (void) /* Fill the BLOCK_VECTOR with all of the BLOCKs in this function, in depth-first order. */ block_vector = get_block_vector (block, &n_blocks); - block_stack = (tree *) xmalloc (n_blocks * sizeof (tree)); + block_stack = xmalloc (n_blocks * sizeof (tree)); last_block_vector = identify_blocks_1 (get_insns (), block_vector + 1, @@ -6189,7 +6188,7 @@ get_block_vector (tree block, int *n_blocks_p) tree *block_vector; *n_blocks_p = all_blocks (block, NULL); - block_vector = (tree *) xmalloc (*n_blocks_p * sizeof (tree)); + block_vector = xmalloc (*n_blocks_p * sizeof (tree)); all_blocks (block, block_vector); return block_vector; @@ -6252,7 +6251,7 @@ debug_find_var_in_block_tree (tree var, tree block) static void prepare_function_start (void) { - cfun = (struct function *) ggc_alloc_cleared (sizeof (struct function)); + cfun = ggc_alloc_cleared (sizeof (struct function)); init_stmt_for_function (); init_eh_for_function (); diff --git a/gcc/gcc.c b/gcc/gcc.c index cd6a3f59b731..a7a9cc939961 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -1107,8 +1107,7 @@ translate_options (int *argcp, const char *const **argvp) int argc = *argcp; const char *const *argv = *argvp; int newvsize = (argc + 2) * 2 * sizeof (const char *); - const char **newv = - (const char **) xmalloc (newvsize); + const char **newv = xmalloc (newvsize); int newindex = 0; i = 0; @@ -1138,7 +1137,7 @@ translate_options (int *argcp, const char *const **argvp) } newvsize += spaces * sizeof (const char *); - newv = (const char **) xrealloc (newv, newvsize); + newv = xrealloc (newv, newvsize); sp = target_option_translations[tott_idx].replacements; np = xstrdup (sp); @@ -1574,8 +1573,8 @@ init_spec (void) notice ("Using built-in specs.\n"); #ifdef EXTRA_SPECS - extra_specs = (struct spec_list *) - xcalloc (sizeof (struct spec_list), ARRAY_SIZE (extra_specs_1)); + extra_specs = xcalloc (sizeof (struct spec_list), + ARRAY_SIZE (extra_specs_1)); for (i = ARRAY_SIZE (extra_specs_1) - 1; i >= 0; i--) { @@ -1733,7 +1732,7 @@ set_spec (const char *name, const char *spec) if (!sl) { /* Not found - make it. */ - sl = (struct spec_list *) xmalloc (sizeof (struct spec_list)); + sl = xmalloc (sizeof (struct spec_list)); sl->name = xstrdup (name); sl->name_len = name_len; sl->ptr_spec = &sl->ptr; @@ -1805,7 +1804,7 @@ static void alloc_args (void) { argbuf_length = 10; - argbuf = (const char **) xmalloc (argbuf_length * sizeof (const char *)); + argbuf = xmalloc (argbuf_length * sizeof (const char *)); } /* Clear out the vector of arguments (after a command is executed). */ @@ -1827,9 +1826,7 @@ static void store_arg (const char *arg, int delete_always, int delete_failure) { if (argbuf_index + 1 == argbuf_length) - argbuf - = (const char **) xrealloc (argbuf, - (argbuf_length *= 2) * sizeof (const char *)); + argbuf = xrealloc (argbuf, (argbuf_length *= 2) * sizeof (const char *)); argbuf[argbuf_index++] = arg; argbuf[argbuf_index] = 0; @@ -2119,9 +2116,8 @@ read_specs (const char *filename, int main_p) { /* Add this pair to the vector. */ compilers - = ((struct compiler *) - xrealloc (compilers, - (n_compilers + 2) * sizeof (struct compiler))); + = xrealloc (compilers, + (n_compilers + 2) * sizeof (struct compiler)); compilers[n_compilers].suffix = suffix; compilers[n_compilers].spec = spec; @@ -2188,7 +2184,7 @@ record_temp_file (const char *filename, int always_delete, int fail_delete) if (! strcmp (name, temp->name)) goto already1; - temp = (struct temp_file *) xmalloc (sizeof (struct temp_file)); + temp = xmalloc (sizeof (struct temp_file)); temp->next = always_delete_queue; temp->name = name; always_delete_queue = temp; @@ -2203,7 +2199,7 @@ record_temp_file (const char *filename, int always_delete, int fail_delete) if (! strcmp (name, temp->name)) goto already2; - temp = (struct temp_file *) xmalloc (sizeof (struct temp_file)); + temp = xmalloc (sizeof (struct temp_file)); temp->next = failure_delete_queue; temp->name = name; failure_delete_queue = temp; @@ -2553,7 +2549,7 @@ add_prefix (struct path_prefix *pprefix, const char *prefix, if (len > pprefix->max_len) pprefix->max_len = len; - pl = (struct prefix_list *) xmalloc (sizeof (struct prefix_list)); + pl = xmalloc (sizeof (struct prefix_list)); pl->prefix = prefix; pl->require_machine_suffix = require_machine_suffix; pl->used_flag_ptr = warn; @@ -2622,7 +2618,7 @@ execute (void) n_commands++; /* Get storage for each command. */ - commands = (struct command *) alloca (n_commands * sizeof (struct command)); + commands = alloca (n_commands * sizeof (struct command)); /* Split argbuf into its separate piped processes, and record info about each one. @@ -3034,12 +3030,10 @@ add_preprocessor_option (const char *option, int len) n_preprocessor_options++; if (! preprocessor_options) - preprocessor_options - = (char **) xmalloc (n_preprocessor_options * sizeof (char *)); + preprocessor_options = xmalloc (n_preprocessor_options * sizeof (char *)); else - preprocessor_options - = (char **) xrealloc (preprocessor_options, - n_preprocessor_options * sizeof (char *)); + preprocessor_options = xrealloc (preprocessor_options, + n_preprocessor_options * sizeof (char *)); preprocessor_options [n_preprocessor_options - 1] = save_string (option, len); @@ -3051,12 +3045,10 @@ add_assembler_option (const char *option, int len) n_assembler_options++; if (! assembler_options) - assembler_options - = (char **) xmalloc (n_assembler_options * sizeof (char *)); + assembler_options = xmalloc (n_assembler_options * sizeof (char *)); else - assembler_options - = (char **) xrealloc (assembler_options, - n_assembler_options * sizeof (char *)); + assembler_options = xrealloc (assembler_options, + n_assembler_options * sizeof (char *)); assembler_options [n_assembler_options - 1] = save_string (option, len); } @@ -3067,12 +3059,10 @@ add_linker_option (const char *option, int len) n_linker_options++; if (! linker_options) - linker_options - = (char **) xmalloc (n_linker_options * sizeof (char *)); + linker_options = xmalloc (n_linker_options * sizeof (char *)); else - linker_options - = (char **) xrealloc (linker_options, - n_linker_options * sizeof (char *)); + linker_options = xrealloc (linker_options, + n_linker_options * sizeof (char *)); linker_options [n_linker_options - 1] = save_string (option, len); } @@ -3213,7 +3203,7 @@ process_command (int argc, const char *const *argv) if (temp) { const char *startp, *endp; - char *nstore = (char *) alloca (strlen (temp) + 3); + char *nstore = alloca (strlen (temp) + 3); startp = endp = temp; while (1) @@ -3248,7 +3238,7 @@ process_command (int argc, const char *const *argv) if (temp && *cross_compile == '0') { const char *startp, *endp; - char *nstore = (char *) alloca (strlen (temp) + 3); + char *nstore = alloca (strlen (temp) + 3); startp = endp = temp; while (1) @@ -3281,7 +3271,7 @@ process_command (int argc, const char *const *argv) if (temp && *cross_compile == '0') { const char *startp, *endp; - char *nstore = (char *) alloca (strlen (temp) + 3); + char *nstore = alloca (strlen (temp) + 3); startp = endp = temp; while (1) @@ -3484,8 +3474,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" } else if (strcmp (argv[i], "-specs") == 0) { - struct user_specs *user = (struct user_specs *) - xmalloc (sizeof (struct user_specs)); + struct user_specs *user = xmalloc (sizeof (struct user_specs)); if (++i >= argc) fatal ("argument to `-specs' is missing"); @@ -3499,8 +3488,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" } else if (strncmp (argv[i], "-specs=", 7) == 0) { - struct user_specs *user = (struct user_specs *) - xmalloc (sizeof (struct user_specs)); + struct user_specs *user = xmalloc (sizeof (struct user_specs)); if (strlen (argv[i]) == 7) fatal ("argument to `-specs=' is missing"); @@ -3673,9 +3661,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" for (j = 0; j < ARRAY_SIZE (modify_target); j++) if (! strcmp (argv[i], modify_target[j].sw)) { - char *new_name - = (char *) xmalloc (strlen (modify_target[j].str) - + strlen (spec_machine)); + char *new_name = xmalloc (strlen (modify_target[j].str) + + strlen (spec_machine)); const char *p, *r; char *q; int made_addition = 0; @@ -3818,9 +3805,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" /* Then create the space for the vectors and scan again. */ - switches = ((struct switchstr *) - xmalloc ((n_switches + 1) * sizeof (struct switchstr))); - infiles = (struct infile *) xmalloc ((n_infiles + 1) * sizeof (struct infile)); + switches = xmalloc ((n_switches + 1) * sizeof (struct switchstr)); + infiles = xmalloc ((n_infiles + 1) * sizeof (struct infile)); n_switches = 0; n_infiles = 0; last_language_n_infiles = -1; @@ -3969,7 +3955,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" if (i + n_args >= argc) fatal ("argument to `-%s' is missing", p); switches[n_switches].args - = (const char **) xmalloc ((n_args + 1) * sizeof(const char *)); + = xmalloc ((n_args + 1) * sizeof(const char *)); while (j < n_args) switches[n_switches].args[j++] = argv[++i]; /* Null-terminate the vector. */ @@ -3979,13 +3965,12 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" { /* On some systems, ld cannot handle some options without a space. So split the option from its argument. */ - char *part1 = (char *) xmalloc (2); + char *part1 = xmalloc (2); part1[0] = c; part1[1] = '\0'; switches[n_switches].part1 = part1; - switches[n_switches].args - = (const char **) xmalloc (2 * sizeof (const char *)); + switches[n_switches].args = xmalloc (2 * sizeof (const char *)); switches[n_switches].args[0] = xstrdup (p+1); switches[n_switches].args[1] = 0; } @@ -4453,7 +4438,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) { struct prefix_list *pl = startfile_prefixes.plist; size_t bufsize = 100; - char *buffer = (char *) xmalloc (bufsize); + char *buffer = xmalloc (bufsize); int idx; for (; pl; pl = pl->next) @@ -4481,7 +4466,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) >= bufsize) bufsize = (strlen (pl->prefix) + strlen (machine_suffix)) * 2 + 1; - buffer = (char *) xrealloc (buffer, bufsize); + buffer = xrealloc (buffer, bufsize); strcpy (buffer, pl->prefix); strcat (buffer, machine_suffix); if (is_directory (buffer, multilib_dir, 1)) @@ -4523,7 +4508,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) /* Remove slash from machine_suffix. */ if (strlen (machine_suffix) >= bufsize) bufsize = strlen (machine_suffix) * 2 + 1; - buffer = (char *) xrealloc (buffer, bufsize); + buffer = xrealloc (buffer, bufsize); strcpy (buffer, machine_suffix); idx = strlen (buffer); if (IS_DIR_SEPARATOR (buffer[idx - 1])) @@ -4544,7 +4529,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) /* Remove slash from pl->prefix. */ if (strlen (pl->prefix) >= bufsize) bufsize = strlen (pl->prefix) * 2 + 1; - buffer = (char *) xrealloc (buffer, bufsize); + buffer = xrealloc (buffer, bufsize); strcpy (buffer, pl->prefix); idx = strlen (buffer); if (IS_DIR_SEPARATOR (buffer[idx - 1])) @@ -4567,7 +4552,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) char *buf; while (*p != 0 && *p != '\n') p++; - buf = (char *) alloca (p - q + 1); + buf = alloca (p - q + 1); strncpy (buf, q, p - q); buf[p - q] = 0; error ("%s", buf); @@ -4581,7 +4566,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) char *buf; while (*p != 0 && *p != '\n') p++; - buf = (char *) alloca (p - q + 1); + buf = alloca (p - q + 1); strncpy (buf, q, p - q); buf[p - q] = 0; notice ("%s\n", buf); @@ -4663,8 +4648,8 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) else { saved_suffix - = (char *) xmalloc (suffix_length - + strlen (TARGET_OBJECT_SUFFIX)); + = xmalloc (suffix_length + + strlen (TARGET_OBJECT_SUFFIX)); strncpy (saved_suffix, suffix, suffix_length); strcpy (saved_suffix + suffix_length, TARGET_OBJECT_SUFFIX); @@ -4735,7 +4720,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) { if (t == 0) { - t = (struct temp_name *) xmalloc (sizeof (struct temp_name)); + t = xmalloc (sizeof (struct temp_name)); t->next = temp_names; temp_names = t; } @@ -5131,7 +5116,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) } else { - char *x = (char *) alloca (strlen (name) * 2 + 1); + char *x = alloca (strlen (name) * 2 + 1); char *buf = x; const char *y = name; int flag = 0; @@ -5812,7 +5797,7 @@ is_directory (const char *path1, const char *path2, int linker) { int len1 = strlen (path1); int len2 = strlen (path2); - char *path = (char *) alloca (3 + len1 + len2); + char *path = alloca (3 + len1 + len2); char *cp; struct stat st; @@ -6016,9 +6001,8 @@ main (int argc, const char *const *argv) /* Initialize the vector of specs to just the default. This means one element containing 0s, as a terminator. */ - compilers = (struct compiler *) xmalloc (sizeof default_compilers); - memcpy ((char *) compilers, (char *) default_compilers, - sizeof default_compilers); + compilers = xmalloc (sizeof default_compilers); + memcpy (compilers, default_compilers, sizeof default_compilers); n_compilers = n_default_compilers; /* Read specs from a file if there is one. */ @@ -6036,9 +6020,8 @@ main (int argc, const char *const *argv) /* We need to check standard_exec_prefix/just_machine_suffix/specs for any override of as, ld and libraries. */ - specs_file = (char *) alloca (strlen (standard_exec_prefix) - + strlen (just_machine_suffix) - + sizeof ("specs")); + specs_file = alloca (strlen (standard_exec_prefix) + + strlen (just_machine_suffix) + sizeof ("specs")); strcpy (specs_file, standard_exec_prefix); strcat (specs_file, just_machine_suffix); @@ -6297,7 +6280,7 @@ main (int argc, const char *const *argv) i = n_infiles; i += lang_specific_extra_outfiles; - outfiles = (const char **) xcalloc (i, sizeof (char *)); + outfiles = xcalloc (i, sizeof (char *)); /* Record which files were specified explicitly as link input. */ @@ -6751,8 +6734,7 @@ used_arg (const char *p, int len) if (*q == ';') cnt++; - matches = - (struct mswitchstr *) alloca ((sizeof (struct mswitchstr)) * cnt); + matches = alloca ((sizeof (struct mswitchstr)) * cnt); i = 0; q = multilib_matches; while (*q != '\0') @@ -6784,8 +6766,7 @@ used_arg (const char *p, int len) xmalloc from calling fatal, and prevents us from re-executing this block of code. */ mswitches - = (struct mswitchstr *) - xmalloc (sizeof (struct mswitchstr) + = xmalloc (sizeof (struct mswitchstr) * (n_mdswitches + (n_switches ? n_switches : 1))); for (i = 0; i < n_switches; i++) { @@ -6912,9 +6893,7 @@ set_multilib_dir (void) { int i = 0; - mdswitches - = (struct mdswitchstr *) xmalloc (sizeof (struct mdswitchstr) - * n_mdswitches); + mdswitches = xmalloc (sizeof (struct mdswitchstr) * n_mdswitches); for (start = multilib_defaults; *start != '\0'; start = end + 1) { while (*start == ' ' || *start == '\t') diff --git a/gcc/gccspec.c b/gcc/gccspec.c index b893d6592828..fce784b2ede5 100644 --- a/gcc/gccspec.c +++ b/gcc/gccspec.c @@ -73,7 +73,7 @@ lang_specific_driver (int *in_argc ATTRIBUTE_UNUSED, if (shared_libgcc) { /* Make sure to have room for the trailing NULL argument. */ - arglist = (const char **) xmalloc ((argc+2) * sizeof (char *)); + arglist = xmalloc ((argc+2) * sizeof (char *)); i = 0; do diff --git a/gcc/gcov.c b/gcc/gcov.c index cc15f65fa54c..ff6327492912 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -520,7 +520,7 @@ process_file (const char *file_name) for (fn = functions; fn; fn = fn->next) solve_flow_graph (fn); for (src = sources; src; src = src->next) - src->lines = (line_t *) xcalloc (src->num_lines, sizeof (line_t)); + src->lines = xcalloc (src->num_lines, sizeof (line_t)); for (fn = functions; fn; fn = fn->next) { coverage_t coverage; @@ -682,7 +682,7 @@ find_source (const char *file_name) if (!strcmp (file_name, src->name)) return src; - src = (source_t *)xcalloc (1, sizeof (source_t)); + src = xcalloc (1, sizeof (source_t)); src->name = xstrdup (file_name); src->coverage.name = src->name; src->index = sources ? sources->index + 1 : 1; @@ -748,7 +748,7 @@ read_graph_file (void) src = find_source (gcov_read_string ()); lineno = gcov_read_unsigned (); - fn = (function_t *)xcalloc (1, sizeof (function_t)); + fn = xcalloc (1, sizeof (function_t)); fn->name = function_name; fn->ident = ident; fn->checksum = checksum; @@ -784,8 +784,7 @@ read_graph_file (void) unsigned ix, num_blocks = GCOV_TAG_BLOCKS_NUM (length); fn->num_blocks = num_blocks; - fn->blocks - = (block_t *)xcalloc (fn->num_blocks, sizeof (block_t)); + fn->blocks = xcalloc (fn->num_blocks, sizeof (block_t)); for (ix = 0; ix != num_blocks; ix++) fn->blocks[ix].flags = gcov_read_unsigned (); } @@ -806,7 +805,7 @@ read_graph_file (void) if (dest >= fn->num_blocks) goto corrupt; - arc = (arc_t *) xcalloc (1, sizeof (arc_t)); + arc = xcalloc (1, sizeof (arc_t)); arc->dst = &fn->blocks[dest]; arc->src = &fn->blocks[src]; @@ -851,8 +850,7 @@ read_graph_file (void) else if (fn && tag == GCOV_TAG_LINES) { unsigned blockno = gcov_read_unsigned (); - unsigned *line_nos - = (unsigned *)xcalloc (length - 1, sizeof (unsigned)); + unsigned *line_nos = xcalloc (length - 1, sizeof (unsigned)); if (blockno >= fn->num_blocks || fn->blocks[blockno].u.line.encoding) goto corrupt; @@ -1047,8 +1045,7 @@ read_count_file (void) goto mismatch; if (!fn->counts) - fn->counts - = (gcov_type *)xcalloc (fn->num_counts, sizeof (gcov_type)); + fn->counts = xcalloc (fn->num_counts, sizeof (gcov_type)); for (ix = 0; ix != fn->num_counts; ix++) fn->counts[ix] += gcov_read_counter (); diff --git a/gcc/gcse.c b/gcc/gcse.c index 6420faf2a208..3b57aa1a8560 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -549,9 +549,9 @@ struct null_pointer_info }; static void compute_can_copy (void); -static char *gmalloc (unsigned int); -static char *grealloc (char *, unsigned int); -static char *gcse_alloc (unsigned long); +static void *gmalloc (unsigned int); +static void *grealloc (void *, unsigned int); +static void *gcse_alloc (unsigned long); static void alloc_gcse_mem (rtx); static void free_gcse_mem (void); static void alloc_reg_set_mem (int); @@ -821,12 +821,11 @@ gcse_main (rtx f, FILE *file) if (changed) { free_modify_mem_tables (); - modify_mem_list - = (rtx *) gmalloc (last_basic_block * sizeof (rtx)); + modify_mem_list = gmalloc (last_basic_block * sizeof (rtx)); canon_modify_mem_list - = (rtx *) gmalloc (last_basic_block * sizeof (rtx)); - memset ((char *) modify_mem_list, 0, last_basic_block * sizeof (rtx)); - memset ((char *) canon_modify_mem_list, 0, last_basic_block * sizeof (rtx)); + = gmalloc (last_basic_block * sizeof (rtx)); + memset (modify_mem_list, 0, last_basic_block * sizeof (rtx)); + memset (canon_modify_mem_list, 0, last_basic_block * sizeof (rtx)); } free_reg_set_mem (); alloc_reg_set_mem (max_reg_num ()); @@ -954,7 +953,7 @@ can_copy_p (enum machine_mode mode) /* Cover function to xmalloc to record bytes allocated. */ -static char * +static void * gmalloc (unsigned int size) { bytes_used += size; @@ -965,19 +964,19 @@ gmalloc (unsigned int size) We don't record the additional size since we don't know it. It won't affect memory usage stats much anyway. */ -static char * -grealloc (char *ptr, unsigned int size) +static void * +grealloc (void *ptr, unsigned int size) { return xrealloc (ptr, size); } /* Cover function to obstack_alloc. */ -static char * +static void * gcse_alloc (unsigned long size) { bytes_used += size; - return (char *) obstack_alloc (&gcse_obstack, size); + return obstack_alloc (&gcse_obstack, size); } /* Allocate memory for the cuid mapping array, @@ -997,8 +996,8 @@ alloc_gcse_mem (rtx f) max_uid = get_max_uid (); n = (max_uid + 1) * sizeof (int); - uid_cuid = (int *) gmalloc (n); - memset ((char *) uid_cuid, 0, n); + uid_cuid = gmalloc (n); + memset (uid_cuid, 0, n); for (insn = f, i = 0; insn; insn = NEXT_INSN (insn)) { if (INSN_P (insn)) @@ -1011,8 +1010,8 @@ alloc_gcse_mem (rtx f) max_cuid = i; n = (max_cuid + 1) * sizeof (rtx); - cuid_insn = (rtx *) gmalloc (n); - memset ((char *) cuid_insn, 0, n); + cuid_insn = gmalloc (n); + memset (cuid_insn, 0, n); for (insn = f, i = 0; insn; insn = NEXT_INSN (insn)) if (INSN_P (insn)) CUID_INSN (i++) = insn; @@ -1021,14 +1020,13 @@ alloc_gcse_mem (rtx f) reg_set_bitmap = BITMAP_XMALLOC (); /* Allocate vars to track sets of regs, memory per block. */ - reg_set_in_block = (sbitmap *) sbitmap_vector_alloc (last_basic_block, - max_gcse_regno); + reg_set_in_block = sbitmap_vector_alloc (last_basic_block, max_gcse_regno); /* Allocate array to keep a list of insns which modify memory in each basic block. */ - modify_mem_list = (rtx *) gmalloc (last_basic_block * sizeof (rtx)); - canon_modify_mem_list = (rtx *) gmalloc (last_basic_block * sizeof (rtx)); - memset ((char *) modify_mem_list, 0, last_basic_block * sizeof (rtx)); - memset ((char *) canon_modify_mem_list, 0, last_basic_block * sizeof (rtx)); + modify_mem_list = gmalloc (last_basic_block * sizeof (rtx)); + canon_modify_mem_list = gmalloc (last_basic_block * sizeof (rtx)); + memset (modify_mem_list, 0, last_basic_block * sizeof (rtx)); + memset (canon_modify_mem_list, 0, last_basic_block * sizeof (rtx)); modify_mem_list_set = BITMAP_XMALLOC (); canon_modify_mem_list_set = BITMAP_XMALLOC (); } @@ -1195,8 +1193,8 @@ alloc_reg_set_mem (int n_regs) reg_set_table_size = n_regs + REG_SET_TABLE_SLOP; n = reg_set_table_size * sizeof (struct reg_set *); - reg_set_table = (struct reg_set **) gmalloc (n); - memset ((char *) reg_set_table, 0, n); + reg_set_table = gmalloc (n); + memset (reg_set_table, 0, n); gcc_obstack_init (®_set_obstack); } @@ -1221,16 +1219,14 @@ record_one_set (int regno, rtx insn) { int new_size = regno + REG_SET_TABLE_SLOP; - reg_set_table - = (struct reg_set **) grealloc ((char *) reg_set_table, - new_size * sizeof (struct reg_set *)); - memset ((char *) (reg_set_table + reg_set_table_size), 0, + reg_set_table = grealloc (reg_set_table, + new_size * sizeof (struct reg_set *)); + memset (reg_set_table + reg_set_table_size, 0, (new_size - reg_set_table_size) * sizeof (struct reg_set *)); reg_set_table_size = new_size; } - new_reg_info = (struct reg_set *) obstack_alloc (®_set_obstack, - sizeof (struct reg_set)); + new_reg_info = obstack_alloc (®_set_obstack, sizeof (struct reg_set)); bytes_used += sizeof (struct reg_set); new_reg_info->insn = insn; new_reg_info->next = reg_set_table[regno]; @@ -1937,7 +1933,7 @@ insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p, if (! found) { - cur_expr = (struct expr *) gcse_alloc (sizeof (struct expr)); + cur_expr = gcse_alloc (sizeof (struct expr)); bytes_used += sizeof (struct expr); if (table->table[hash] == NULL) /* This is the first pattern that hashed to this index. */ @@ -1976,7 +1972,7 @@ insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p, else { /* First occurrence of this expression in this basic block. */ - antic_occr = (struct occr *) gcse_alloc (sizeof (struct occr)); + antic_occr = gcse_alloc (sizeof (struct occr)); bytes_used += sizeof (struct occr); /* First occurrence of this expression in any block? */ if (cur_expr->antic_occr == NULL) @@ -2011,7 +2007,7 @@ insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p, else { /* First occurrence of this expression in this basic block. */ - avail_occr = (struct occr *) gcse_alloc (sizeof (struct occr)); + avail_occr = gcse_alloc (sizeof (struct occr)); bytes_used += sizeof (struct occr); /* First occurrence of this expression in any block? */ @@ -2058,7 +2054,7 @@ insert_set_in_table (rtx x, rtx insn, struct hash_table *table) if (! found) { - cur_expr = (struct expr *) gcse_alloc (sizeof (struct expr)); + cur_expr = gcse_alloc (sizeof (struct expr)); bytes_used += sizeof (struct expr); if (table->table[hash] == NULL) /* This is the first pattern that hashed to this index. */ @@ -2097,7 +2093,7 @@ insert_set_in_table (rtx x, rtx insn, struct hash_table *table) else { /* First occurrence of this expression in this basic block. */ - cur_occr = (struct occr *) gcse_alloc (sizeof (struct occr)); + cur_occr = gcse_alloc (sizeof (struct occr)); bytes_used += sizeof (struct occr); /* First occurrence of this expression in any block? */ @@ -2286,9 +2282,8 @@ dump_hash_table (FILE *file, const char *name, struct hash_table *table) unsigned int *hash_val; struct expr *expr; - flat_table - = (struct expr **) xcalloc (table->n_elems, sizeof (struct expr *)); - hash_val = (unsigned int *) xmalloc (table->n_elems * sizeof (unsigned int)); + flat_table = xcalloc (table->n_elems, sizeof (struct expr *)); + hash_val = xmalloc (table->n_elems * sizeof (unsigned int)); for (i = 0; i < (int) table->size; i++) for (expr = table->table[i]; expr != NULL; expr = expr->next_same_hash) @@ -2459,8 +2454,7 @@ compute_hash_table_work (struct hash_table *table) /* re-Cache any INSN_LIST nodes we have allocated. */ clear_modify_mem_tables (); /* Some working arrays used to track first and last set in each block. */ - reg_avail_info = (struct reg_avail_info*) - gmalloc (max_gcse_regno * sizeof (struct reg_avail_info)); + reg_avail_info = gmalloc (max_gcse_regno * sizeof (struct reg_avail_info)); for (i = 0; i < max_gcse_regno; ++i) reg_avail_info[i].last_bb = NULL; @@ -2550,7 +2544,7 @@ alloc_hash_table (int n_insns, struct hash_table *table, int set_p) ??? Later take some measurements. */ table->size |= 1; n = table->size * sizeof (struct expr *); - table->table = (struct expr **) gmalloc (n); + table->table = gmalloc (n); table->set_p = set_p; } @@ -2570,8 +2564,7 @@ compute_hash_table (struct hash_table *table) { /* Initialize count of number of entries in hash table. */ table->n_elems = 0; - memset ((char *) table->table, 0, - table->size * sizeof (struct expr *)); + memset (table->table, 0, table->size * sizeof (struct expr *)); compute_hash_table_work (table); } @@ -2842,16 +2835,16 @@ mark_oprs_set (rtx insn) static void alloc_rd_mem (int n_blocks, int n_insns) { - rd_kill = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns); + rd_kill = sbitmap_vector_alloc (n_blocks, n_insns); sbitmap_vector_zero (rd_kill, n_blocks); - rd_gen = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns); + rd_gen = sbitmap_vector_alloc (n_blocks, n_insns); sbitmap_vector_zero (rd_gen, n_blocks); - reaching_defs = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns); + reaching_defs = sbitmap_vector_alloc (n_blocks, n_insns); sbitmap_vector_zero (reaching_defs, n_blocks); - rd_out = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns); + rd_out = sbitmap_vector_alloc (n_blocks, n_insns); sbitmap_vector_zero (rd_out, n_blocks); } @@ -2969,16 +2962,16 @@ compute_rd (void) static void alloc_avail_expr_mem (int n_blocks, int n_exprs) { - ae_kill = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs); + ae_kill = sbitmap_vector_alloc (n_blocks, n_exprs); sbitmap_vector_zero (ae_kill, n_blocks); - ae_gen = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs); + ae_gen = sbitmap_vector_alloc (n_blocks, n_exprs); sbitmap_vector_zero (ae_gen, n_blocks); - ae_in = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs); + ae_in = sbitmap_vector_alloc (n_blocks, n_exprs); sbitmap_vector_zero (ae_in, n_blocks); - ae_out = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs); + ae_out = sbitmap_vector_alloc (n_blocks, n_exprs); sbitmap_vector_zero (ae_out, n_blocks); } @@ -3175,7 +3168,7 @@ expr_reaches_here_p (struct occr *occr, struct expr *expr, basic_block bb, int check_self_loop) { int rval; - char *visited = (char *) xcalloc (last_basic_block, 1); + char *visited = xcalloc (last_basic_block, 1); rval = expr_reaches_here_p_work (occr, expr, bb, check_self_loop, visited); @@ -4591,7 +4584,7 @@ one_cprop_pass (int pass, int cprop_jumps, int bypass_jumps) local_cprop_pass (cprop_jumps); /* Determine implicit sets. */ - implicit_sets = (rtx *) xcalloc (last_basic_block, sizeof (rtx)); + implicit_sets = xcalloc (last_basic_block, sizeof (rtx)); find_implicit_sets (); alloc_hash_table (max_cuid, &set_hash_table, 1); @@ -5108,7 +5101,7 @@ static int pre_expr_reaches_here_p (basic_block occr_bb, struct expr *expr, basic_block bb) { int rval; - char *visited = (char *) xcalloc (last_basic_block, 1); + char *visited = xcalloc (last_basic_block, 1); rval = pre_expr_reaches_here_p_work (occr_bb, expr, bb, visited); @@ -5577,7 +5570,7 @@ pre_gcse (void) /* Compute a mapping from expression number (`bitmap_index') to hash table entry. */ - index_map = (struct expr **) xcalloc (expr_hash_table.n_elems, sizeof (struct expr *)); + index_map = xcalloc (expr_hash_table.n_elems, sizeof (struct expr *)); for (i = 0; i < expr_hash_table.size; i++) for (expr = expr_hash_table.table[i]; expr != NULL; expr = expr->next_same_hash) index_map[expr->bitmap_index] = expr; @@ -5988,7 +5981,7 @@ delete_null_pointer_checks (rtx f ATTRIBUTE_UNUSED) /* Go through the basic blocks, seeing whether or not each block ends with a conditional branch whose condition is a comparison against zero. Record the register compared in BLOCK_REG. */ - block_reg = (unsigned int *) xcalloc (last_basic_block, sizeof (int)); + block_reg = xcalloc (last_basic_block, sizeof (int)); FOR_EACH_BB (bb) { rtx last_insn = bb->end; @@ -6220,7 +6213,7 @@ hoist_code (void) /* Compute a mapping from expression number (`bitmap_index') to hash table entry. */ - index_map = (struct expr **) xcalloc (expr_hash_table.n_elems, sizeof (struct expr *)); + index_map = xcalloc (expr_hash_table.n_elems, sizeof (struct expr *)); for (i = 0; i < expr_hash_table.size; i++) for (expr = expr_hash_table.table[i]; expr != NULL; expr = expr->next_same_hash) index_map[expr->bitmap_index] = expr; @@ -6433,7 +6426,7 @@ ldst_entry (rtx x) if (!ptr) { - ptr = (struct ls_expr *) xmalloc (sizeof (struct ls_expr)); + ptr = xmalloc (sizeof (struct ls_expr)); ptr->next = pre_ldst_mems; ptr->expr = NULL; @@ -7079,7 +7072,7 @@ compute_store_table (void) max_gcse_regno = max_reg_num (); - reg_set_in_block = (sbitmap *) sbitmap_vector_alloc (last_basic_block, + reg_set_in_block = sbitmap_vector_alloc (last_basic_block, max_gcse_regno); sbitmap_vector_zero (reg_set_in_block, last_basic_block); pre_ldst_mems = 0; @@ -7379,10 +7372,10 @@ build_store_vectors (void) /* Build the gen_vector. This is any store in the table which is not killed by aliasing later in its block. */ - ae_gen = (sbitmap *) sbitmap_vector_alloc (last_basic_block, num_stores); + ae_gen = sbitmap_vector_alloc (last_basic_block, num_stores); sbitmap_vector_zero (ae_gen, last_basic_block); - st_antloc = (sbitmap *) sbitmap_vector_alloc (last_basic_block, num_stores); + st_antloc = sbitmap_vector_alloc (last_basic_block, num_stores); sbitmap_vector_zero (st_antloc, last_basic_block); for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr)) @@ -7415,10 +7408,10 @@ build_store_vectors (void) } } - ae_kill = (sbitmap *) sbitmap_vector_alloc (last_basic_block, num_stores); + ae_kill = sbitmap_vector_alloc (last_basic_block, num_stores); sbitmap_vector_zero (ae_kill, last_basic_block); - transp = (sbitmap *) sbitmap_vector_alloc (last_basic_block, num_stores); + transp = sbitmap_vector_alloc (last_basic_block, num_stores); sbitmap_vector_zero (transp, last_basic_block); regs_set_in_block = xmalloc (sizeof (int) * max_gcse_regno); diff --git a/gcc/genattr.c b/gcc/genattr.c index 98cd08cee4d8..49f368e53fce 100644 --- a/gcc/genattr.c +++ b/gcc/genattr.c @@ -268,8 +268,7 @@ main (int argc, char **argv) if (unit == 0) { - unit = (struct function_unit *) - xmalloc (sizeof (struct function_unit)); + unit = xmalloc (sizeof (struct function_unit)); unit->name = xstrdup (name); unit->multiplicity = multiplicity; unit->simultaneity = simultaneity; diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c index 15a8afabc227..30a889ca70d5 100644 --- a/gcc/genattrtab.c +++ b/gcc/genattrtab.c @@ -500,8 +500,7 @@ attr_hash_add_rtx (int hashcode, rtx rtl) { struct attr_hash *h; - h = (struct attr_hash *) obstack_alloc (hash_obstack, - sizeof (struct attr_hash)); + h = obstack_alloc (hash_obstack, sizeof (struct attr_hash)); h->hashcode = hashcode; h->u.rtl = rtl; h->next = attr_hash_table[hashcode % RTL_HASH_SIZE]; @@ -515,8 +514,7 @@ attr_hash_add_string (int hashcode, char *str) { struct attr_hash *h; - h = (struct attr_hash *) obstack_alloc (hash_obstack, - sizeof (struct attr_hash)); + h = obstack_alloc (hash_obstack, sizeof (struct attr_hash)); h->hashcode = -hashcode; h->u.str = str; h->next = attr_hash_table[hashcode % RTL_HASH_SIZE]; @@ -779,7 +777,7 @@ attr_string (const char *str, int len) return h->u.str; /* <-- return if found. */ /* Not found; create a permanent copy and add it to the hash table. */ - new_str = (char *) obstack_alloc (hash_obstack, len + 1); + new_str = obstack_alloc (hash_obstack, len + 1); memcpy (new_str, str, len); new_str[len] = '\0'; attr_hash_add_string (hashcode, new_str); @@ -1459,7 +1457,7 @@ get_attr_value (rtx value, struct attr_desc *attr, int insn_code) || insn_alternatives[av->first_insn->insn_code])) return av; - av = (struct attr_value *) oballoc (sizeof (struct attr_value)); + av = oballoc (sizeof (struct attr_value)); av->value = value; av->next = attr->first_value; attr->first_value = av; @@ -1875,13 +1873,10 @@ expand_units (void) /* Create an array of ops for each unit. Add an extra unit for the result_ready_cost function that has the ops of all other units. */ - unit_ops = (struct function_unit_op ***) - xmalloc ((num_units + 1) * sizeof (struct function_unit_op **)); - unit_num = (struct function_unit **) - xmalloc ((num_units + 1) * sizeof (struct function_unit *)); + unit_ops = xmalloc ((num_units + 1) * sizeof (struct function_unit_op **)); + unit_num = xmalloc ((num_units + 1) * sizeof (struct function_unit *)); - unit_num[num_units] = unit = (struct function_unit *) - xmalloc (sizeof (struct function_unit)); + unit_num[num_units] = unit = xmalloc (sizeof (struct function_unit)); unit->num = num_units; unit->num_opclasses = 0; @@ -1889,7 +1884,7 @@ expand_units (void) { unit_num[num_units]->num_opclasses += unit->num_opclasses; unit_num[unit->num] = unit; - unit_ops[unit->num] = op_array = (struct function_unit_op **) + unit_ops[unit->num] = op_array = xmalloc (unit->num_opclasses * sizeof (struct function_unit_op *)); for (op = unit->ops; op; op = op->next) @@ -1897,7 +1892,7 @@ expand_units (void) } /* Compose the array of ops for the extra unit. */ - unit_ops[num_units] = op_array = (struct function_unit_op **) + unit_ops[num_units] = op_array = xmalloc (unit_num[num_units]->num_opclasses * sizeof (struct function_unit_op *)); @@ -2253,7 +2248,7 @@ fill_attr (struct attr_desc *attr) else av = get_attr_value (value, attr, id->insn_code); - ie = (struct insn_ent *) oballoc (sizeof (struct insn_ent)); + ie = oballoc (sizeof (struct insn_ent)); ie->insn_code = id->insn_code; ie->insn_index = id->insn_code; insert_insn_ent (av, ie); @@ -2379,7 +2374,7 @@ make_length_attrs (void) no_address_fn[i], address_fn[i]), new_attr, ie->insn_code); - new_ie = (struct insn_ent *) oballoc (sizeof (struct insn_ent)); + new_ie = oballoc (sizeof (struct insn_ent)); new_ie->insn_code = ie->insn_code; new_ie->insn_index = ie->insn_index; insert_insn_ent (new_av, new_ie); @@ -2458,7 +2453,7 @@ simplify_cond (rtx exp, int insn_code, int insn_index) rtx defval = XEXP (exp, 1); rtx new_defval = XEXP (exp, 1); int len = XVECLEN (exp, 0); - rtx *tests = (rtx *) xmalloc (len * sizeof (rtx)); + rtx *tests = xmalloc (len * sizeof (rtx)); int allsame = 1; rtx ret; @@ -3398,17 +3393,15 @@ optimize_attrs (void) return; /* Make 2 extra elements, for "code" values -2 and -1. */ - insn_code_values - = (struct attr_value_list **) xmalloc ((insn_code_number + 2) - * sizeof (struct attr_value_list *)); - memset ((char *) insn_code_values, 0, - (insn_code_number + 2) * sizeof (struct attr_value_list *)); + insn_code_values = xmalloc ((insn_code_number + 2) + * sizeof (struct attr_value_list *)); + memset (insn_code_values, 0, + (insn_code_number + 2) * sizeof (struct attr_value_list *)); /* Offset the table address so we can index by -2 or -1. */ insn_code_values += 2; - iv = ivbuf = ((struct attr_value_list *) - xmalloc (num_insn_ents * sizeof (struct attr_value_list))); + iv = ivbuf = xmalloc (num_insn_ents * sizeof (struct attr_value_list)); for (i = 0; i < MAX_ATTRS_INDEX; i++) for (attr = attrs[i]; attr; attr = attr->next) @@ -3499,7 +3492,7 @@ simplify_by_exploding (rtx exp) cover the domain of the attribute. This makes the expanded COND form order independent. */ - space = (struct dimension *) xmalloc (ndim * sizeof (struct dimension)); + space = xmalloc (ndim * sizeof (struct dimension)); total = 1; for (ndim = 0; list; ndim++) @@ -3554,8 +3547,8 @@ simplify_by_exploding (rtx exp) for (i = 0; i < ndim; i++) space[i].current_value = space[i].values; - condtest = (rtx *) xmalloc (total * sizeof (rtx)); - condval = (rtx *) xmalloc (total * sizeof (rtx)); + condtest = xmalloc (total * sizeof (rtx)); + condval = xmalloc (total * sizeof (rtx)); /* Expand the tests and values by iterating over all values in the attribute space. */ @@ -4052,7 +4045,7 @@ gen_attr (rtx exp, int lineno) name_ptr = XSTR (exp, 1); while ((p = next_comma_elt (&name_ptr)) != NULL) { - av = (struct attr_value *) oballoc (sizeof (struct attr_value)); + av = oballoc (sizeof (struct attr_value)); av->value = attr_rtx (CONST_STRING, p); av->next = attr->first_value; attr->first_value = av; @@ -4196,7 +4189,7 @@ gen_insn (rtx exp, int lineno) { struct insn_def *id; - id = (struct insn_def *) oballoc (sizeof (struct insn_def)); + id = oballoc (sizeof (struct insn_def)); id->next = defs; defs = id; id->def = exp; @@ -4260,7 +4253,7 @@ gen_delay (rtx def, int lineno) have_annul_false = 1; } - delay = (struct delay_desc *) oballoc (sizeof (struct delay_desc)); + delay = oballoc (sizeof (struct delay_desc)); delay->def = def; delay->num = ++num_delays; delay->next = delays; @@ -4307,7 +4300,7 @@ gen_unit (rtx def, int lineno) if (unit == 0) { - unit = (struct function_unit *) oballoc (sizeof (struct function_unit)); + unit = oballoc (sizeof (struct function_unit)); unit->name = name; unit->multiplicity = multiplicity; unit->simultaneity = simultaneity; @@ -4322,7 +4315,7 @@ gen_unit (rtx def, int lineno) } /* Make a new operation class structure entry and initialize it. */ - op = (struct function_unit_op *) oballoc (sizeof (struct function_unit_op)); + op = oballoc (sizeof (struct function_unit_op)); op->condexp = condexp; op->num = unit->num_opclasses++; op->ready = ready_cost; @@ -5579,7 +5572,7 @@ find_attr (const char *name, int create) if (! create) return NULL; - attr = (struct attr_desc *) oballoc (sizeof (struct attr_desc)); + attr = oballoc (sizeof (struct attr_desc)); attr->name = attr_string (name, strlen (name)); attr->first_value = attr->default_val = NULL; attr->is_numeric = attr->negative_ok = attr->is_const = attr->is_special = 0; @@ -5896,13 +5889,13 @@ from the machine description file `md'. */\n\n"); printf ("#define operands recog_data.operand\n\n"); /* Make `insn_alternatives'. */ - insn_alternatives = (int *) oballoc (insn_code_number * sizeof (int)); + insn_alternatives = oballoc (insn_code_number * sizeof (int)); for (id = defs; id; id = id->next) if (id->insn_code >= 0) insn_alternatives[id->insn_code] = (1 << id->num_alternatives) - 1; /* Make `insn_n_alternatives'. */ - insn_n_alternatives = (int *) oballoc (insn_code_number * sizeof (int)); + insn_n_alternatives = oballoc (insn_code_number * sizeof (int)); for (id = defs; id; id = id->next) if (id->insn_code >= 0) insn_n_alternatives[id->insn_code] = id->num_alternatives; diff --git a/gcc/genautomata.c b/gcc/genautomata.c index bafb2553cdef..a5783e6f80db 100644 --- a/gcc/genautomata.c +++ b/gcc/genautomata.c @@ -1922,15 +1922,15 @@ gen_automaton (rtx def) void gen_automata_option (rtx def) { - if (strcmp ((char *) XSTR (def, 0), NO_MINIMIZATION_OPTION + 1) == 0) + if (strcmp (XSTR (def, 0), NO_MINIMIZATION_OPTION + 1) == 0) no_minimization_flag = 1; - else if (strcmp ((char *) XSTR (def, 0), TIME_OPTION + 1) == 0) + else if (strcmp (XSTR (def, 0), TIME_OPTION + 1) == 0) time_flag = 1; - else if (strcmp ((char *) XSTR (def, 0), V_OPTION + 1) == 0) + else if (strcmp (XSTR (def, 0), V_OPTION + 1) == 0) v_flag = 1; - else if (strcmp ((char *) XSTR (def, 0), W_OPTION + 1) == 0) + else if (strcmp (XSTR (def, 0), W_OPTION + 1) == 0) w_flag = 1; - else if (strcmp ((char *) XSTR (def, 0), NDFA_OPTION + 1) == 0) + else if (strcmp (XSTR (def, 0), NDFA_OPTION + 1) == 0) ndfa_flag = 1; else fatal ("invalid option `%s' in automata_option", XSTR (def, 0)); @@ -8842,8 +8842,7 @@ output_get_cpu_unit_code_func (void) LOW_VARIABLE_NAME, MIDDLE_VARIABLE_NAME, HIGH_VARIABLE_NAME); fprintf (output_file, " static struct %s %s [] =\n {\n", NAME_CODE_STRUCT_NAME, NAME_CODE_TABLE_NAME); - units = (unit_decl_t *) xmalloc (sizeof (unit_decl_t) - * description->units_num); + units = xmalloc (sizeof (unit_decl_t) * description->units_num); memcpy (units, units_array, sizeof (unit_decl_t) * description->units_num); qsort (units, description->units_num, sizeof (unit_decl_t), units_cmp); for (i = 0; i < description->units_num; i++) @@ -8927,7 +8926,7 @@ output_dfa_start_func (void) fprintf (output_file, "void\n%s (void)\n{\n %s = get_max_uid ();\n", DFA_START_FUNC_NAME, DFA_INSN_CODES_LENGTH_VARIABLE_NAME); - fprintf (output_file, " %s = (int *) xmalloc (%s * sizeof (int));\n", + fprintf (output_file, " %s = xmalloc (%s * sizeof (int));\n", DFA_INSN_CODES_VARIABLE_NAME, DFA_INSN_CODES_LENGTH_VARIABLE_NAME); fprintf (output_file, " %s ();\n}\n\n", DFA_CLEAN_INSN_CACHE_FUNC_NAME); } diff --git a/gcc/genconditions.c b/gcc/genconditions.c index 2d4cf8d2a611..32ac5aef475f 100644 --- a/gcc/genconditions.c +++ b/gcc/genconditions.c @@ -57,7 +57,7 @@ add_condition (const char *expr) if (expr[0] == 0) return; - test = (struct c_test *) xmalloc (sizeof (struct c_test)); + test = xmalloc (sizeof (struct c_test)); test->expr = expr; *(htab_find_slot (condition_table, test, INSERT)) = test; diff --git a/gcc/genemit.c b/gcc/genemit.c index ea787d24c003..8a821d67bc27 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -317,8 +317,7 @@ gen_insn (rtx insn, int lineno) if (i != XVECLEN (insn, 1) - 1) { struct clobber_pat *p; - struct clobber_ent *link - = (struct clobber_ent *) xmalloc (sizeof (struct clobber_ent)); + struct clobber_ent *link = xmalloc (sizeof (struct clobber_ent)); int j; link->code_number = insn_code_number; @@ -354,7 +353,7 @@ gen_insn (rtx insn, int lineno) if (p == 0) { - p = (struct clobber_pat *) xmalloc (sizeof (struct clobber_pat)); + p = xmalloc (sizeof (struct clobber_pat)); p->insns = 0; p->pattern = insn; diff --git a/gcc/genextract.c b/gcc/genextract.c index ef53050fbca7..d3365736510a 100644 --- a/gcc/genextract.c +++ b/gcc/genextract.c @@ -129,7 +129,7 @@ gen_insn (rtx insn) walk_rtx (XVECEXP (insn, 1, i), path); } - link = (struct code_ptr *) xmalloc (sizeof (struct code_ptr)); + link = xmalloc (sizeof (struct code_ptr)); link->insn_code = insn_code_number; /* See if we find something that already had this extraction method. */ @@ -164,7 +164,7 @@ gen_insn (rtx insn) /* Otherwise, make a new extraction method. */ - p = (struct extraction *) xmalloc (sizeof (struct extraction)); + p = xmalloc (sizeof (struct extraction)); p->op_count = op_count; p->dup_count = dup_count; p->next = extractions; @@ -220,7 +220,7 @@ walk_rtx (rtx x, const char *path) dupnums[dup_count] = XINT (x, 0); dup_count++; - newpath = (char *) xmalloc (depth + 2); + newpath = xmalloc (depth + 2); strcpy (newpath, path); newpath[depth + 1] = 0; @@ -236,7 +236,7 @@ walk_rtx (rtx x, const char *path) oplocs[XINT (x, 0)] = xstrdup (path); op_count = MAX (op_count, XINT (x, 0) + 1); - newpath = (char *) xmalloc (depth + 2); + newpath = xmalloc (depth + 2); strcpy (newpath, path); newpath[depth + 1] = 0; @@ -252,7 +252,7 @@ walk_rtx (rtx x, const char *path) oplocs[XINT (x, 0)] = xstrdup (path); op_count = MAX (op_count, XINT (x, 0) + 1); - newpath = (char *) xmalloc (depth + 2); + newpath = xmalloc (depth + 2); strcpy (newpath, path); newpath[depth + 1] = 0; @@ -272,7 +272,7 @@ walk_rtx (rtx x, const char *path) break; } - newpath = (char *) xmalloc (depth + 2); + newpath = xmalloc (depth + 2); strcpy (newpath, path); newpath[depth + 1] = 0; @@ -412,8 +412,7 @@ from the machine description file `md'. */\n\n"); else if (GET_CODE (desc) == DEFINE_PEEPHOLE) { - struct code_ptr *link - = (struct code_ptr *) xmalloc (sizeof (struct code_ptr)); + struct code_ptr *link = xmalloc (sizeof (struct code_ptr)); link->insn_code = insn_code_number; link->next = peepholes; @@ -509,8 +508,7 @@ record_insn_name (int code, const char *name) { int new_size; new_size = (insn_name_ptr_size ? insn_name_ptr_size * 2 : 512); - insn_name_ptr = - (char **) xrealloc (insn_name_ptr, sizeof(char *) * new_size); + insn_name_ptr = xrealloc (insn_name_ptr, sizeof(char *) * new_size); memset (insn_name_ptr + insn_name_ptr_size, 0, sizeof(char *) * (new_size - insn_name_ptr_size)); insn_name_ptr_size = new_size; diff --git a/gcc/genoutput.c b/gcc/genoutput.c index e3810749ea3d..74725fa57b31 100644 --- a/gcc/genoutput.c +++ b/gcc/genoutput.c @@ -782,7 +782,7 @@ validate_insn_operands (struct data *d) static void gen_insn (rtx insn, int lineno) { - struct data *d = (struct data *) xmalloc (sizeof (struct data)); + struct data *d = xmalloc (sizeof (struct data)); int i; d->code_number = next_code_number; @@ -823,7 +823,7 @@ gen_insn (rtx insn, int lineno) static void gen_peephole (rtx peep, int lineno) { - struct data *d = (struct data *) xmalloc (sizeof (struct data)); + struct data *d = xmalloc (sizeof (struct data)); int i; d->code_number = next_code_number; @@ -861,7 +861,7 @@ gen_peephole (rtx peep, int lineno) static void gen_expand (rtx insn, int lineno) { - struct data *d = (struct data *) xmalloc (sizeof (struct data)); + struct data *d = xmalloc (sizeof (struct data)); int i; d->code_number = next_code_number; @@ -904,7 +904,7 @@ gen_expand (rtx insn, int lineno) static void gen_split (rtx split, int lineno) { - struct data *d = (struct data *) xmalloc (sizeof (struct data)); + struct data *d = xmalloc (sizeof (struct data)); int i; d->code_number = next_code_number; diff --git a/gcc/genrecog.c b/gcc/genrecog.c index 9723126b274f..65387123436a 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -316,8 +316,7 @@ extern void debug_decision_list static struct decision * new_decision (const char *position, struct decision_head *last) { - struct decision *new - = (struct decision *) xmalloc (sizeof (struct decision)); + struct decision *new = xmalloc (sizeof (struct decision)); memset (new, 0, sizeof (*new)); new->success = *last; @@ -336,7 +335,7 @@ new_decision_test (enum decision_type type, struct decision_test ***pplace) struct decision_test **place = *pplace; struct decision_test *test; - test = (struct decision_test *) xmalloc (sizeof (*test)); + test = xmalloc (sizeof (*test)); test->next = *place; test->type = type; *place = test; @@ -770,7 +769,7 @@ add_to_sequence (rtx pattern, struct decision_head *last, const char *position, if (depth > max_depth) max_depth = depth; - subpos = (char *) xmalloc (depth + 2); + subpos = xmalloc (depth + 2); strcpy (subpos, position); subpos[depth + 1] = 0; @@ -2667,8 +2666,7 @@ record_insn_name (int code, const char *name) { int new_size; new_size = (insn_name_ptr_size ? insn_name_ptr_size * 2 : 512); - insn_name_ptr = - (char **) xrealloc (insn_name_ptr, sizeof(char *) * new_size); + insn_name_ptr = xrealloc (insn_name_ptr, sizeof(char *) * new_size); memset (insn_name_ptr + insn_name_ptr_size, 0, sizeof(char *) * (new_size - insn_name_ptr_size)); insn_name_ptr_size = new_size; diff --git a/gcc/gensupport.c b/gcc/gensupport.c index a255a7254d18..23f8e3f32cdb 100644 --- a/gcc/gensupport.c +++ b/gcc/gensupport.c @@ -140,7 +140,7 @@ static void queue_pattern (rtx pattern, struct queue_elem ***list_tail, const char *filename, int lineno) { - struct queue_elem *e = (struct queue_elem *) xmalloc (sizeof (*e)); + struct queue_elem *e = xmalloc (sizeof (*e)); e->data = pattern; e->filename = filename; e->lineno = lineno; @@ -583,7 +583,7 @@ alter_predicate_for_insn (rtx pattern, int alt, int max_op, int lineno) { size_t c_len = strlen (c); size_t len = alt * (c_len + 1); - char *new_c = (char *) xmalloc (len); + char *new_c = xmalloc (len); memcpy (new_c, c, c_len); for (i = 1; i < alt; ++i) @@ -876,8 +876,7 @@ init_md_reader_args (int argc, char **argv) { struct file_name_list *dirtmp; - dirtmp = (struct file_name_list *) - xmalloc (sizeof (struct file_name_list)); + dirtmp = xmalloc (sizeof (struct file_name_list)); dirtmp->next = 0; /* New one goes on the end */ if (first_dir_md_include == 0) first_dir_md_include = dirtmp; @@ -1078,7 +1077,7 @@ maybe_eval_c_test (const char *expr) return -1; dummy.expr = expr; - test = (const struct c_test *) htab_find (condition_table, &dummy); + test = htab_find (condition_table, &dummy); if (!test) abort (); diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c index 0e5845be3f62..7b0697e9fa87 100644 --- a/gcc/ggc-page.c +++ b/gcc/ggc-page.c @@ -478,8 +478,7 @@ push_depth (unsigned int i) if (G.depth_in_use >= G.depth_max) { G.depth_max *= 2; - G.depth = (unsigned int *) xrealloc ((char *) G.depth, - G.depth_max * sizeof (unsigned int)); + G.depth = xrealloc (G.depth, G.depth_max * sizeof (unsigned int)); } G.depth[G.depth_in_use++] = i; } @@ -492,10 +491,10 @@ push_by_depth (page_entry *p, unsigned long *s) if (G.by_depth_in_use >= G.by_depth_max) { G.by_depth_max *= 2; - G.by_depth = (page_entry **) xrealloc ((char *) G.by_depth, - G.by_depth_max * sizeof (page_entry *)); - G.save_in_use = (unsigned long **) xrealloc ((char *) G.save_in_use, - G.by_depth_max * sizeof (unsigned long *)); + G.by_depth = xrealloc (G.by_depth, + G.by_depth_max * sizeof (page_entry *)); + G.save_in_use = xrealloc (G.save_in_use, + G.by_depth_max * sizeof (unsigned long *)); } G.by_depth[G.by_depth_in_use] = p; G.save_in_use[G.by_depth_in_use++] = s; @@ -587,7 +586,7 @@ set_page_table_entry (void *p, page_entry *entry) goto found; /* Not found -- allocate a new table. */ - table = (page_table) xcalloc (1, sizeof(*table)); + table = xcalloc (1, sizeof(*table)); table->next = G.lookup; table->high_bits = high_bits; G.lookup = table; @@ -600,7 +599,7 @@ found: L2 = LOOKUP_L2 (p); if (base[L1] == NULL) - base[L1] = (page_entry **) xcalloc (PAGE_L2_SIZE, sizeof (page_entry *)); + base[L1] = xcalloc (PAGE_L2_SIZE, sizeof (page_entry *)); base[L1][L2] = entry; } @@ -748,7 +747,7 @@ alloc_page (unsigned order) memory order. */ for (i = GGC_QUIRE_SIZE - 1; i >= 1; i--) { - e = (struct page_entry *) xcalloc (1, page_entry_size); + e = xcalloc (1, page_entry_size); e->order = order; e->bytes = G.pagesize; e->page = page + (i << G.lg_pagesize); @@ -820,7 +819,7 @@ alloc_page (unsigned order) struct page_entry *e, *f = G.free_pages; for (a = enda - G.pagesize; a != page; a -= G.pagesize) { - e = (struct page_entry *) xcalloc (1, page_entry_size); + e = xcalloc (1, page_entry_size); e->order = order; e->bytes = G.pagesize; e->page = a; @@ -834,7 +833,7 @@ alloc_page (unsigned order) #endif if (entry == NULL) - entry = (struct page_entry *) xcalloc (1, page_entry_size); + entry = xcalloc (1, page_entry_size); entry->bytes = entry_size; entry->page = page; @@ -1327,7 +1326,7 @@ init_ggc (void) } /* We have a good page, might as well hold onto it... */ - e = (struct page_entry *) xcalloc (1, sizeof (struct page_entry)); + e = xcalloc (1, sizeof (struct page_entry)); e->bytes = G.pagesize; e->page = p; e->next = G.free_pages; @@ -1373,12 +1372,12 @@ init_ggc (void) G.depth_in_use = 0; G.depth_max = 10; - G.depth = (unsigned int *) xmalloc (G.depth_max * sizeof (unsigned int)); + G.depth = xmalloc (G.depth_max * sizeof (unsigned int)); G.by_depth_in_use = 0; G.by_depth_max = INITIAL_PTE_COUNT; - G.by_depth = (page_entry **) xmalloc (G.by_depth_max * sizeof (page_entry *)); - G.save_in_use = (unsigned long **) xmalloc (G.by_depth_max * sizeof (unsigned long *)); + G.by_depth = xmalloc (G.by_depth_max * sizeof (page_entry *)); + G.save_in_use = xmalloc (G.by_depth_max * sizeof (unsigned long *)); } /* Increment the `GC context'. Objects allocated in an outer context @@ -2017,8 +2016,8 @@ move_ptes_to_front (int count_old_page_tables, int count_new_page_tables) page_entry **new_by_depth; unsigned long **new_save_in_use; - new_by_depth = (page_entry **) xmalloc (G.by_depth_max * sizeof (page_entry *)); - new_save_in_use = (unsigned long **) xmalloc (G.by_depth_max * sizeof (unsigned long *)); + new_by_depth = xmalloc (G.by_depth_max * sizeof (page_entry *)); + new_save_in_use = xmalloc (G.by_depth_max * sizeof (unsigned long *)); memcpy (&new_by_depth[0], &G.by_depth[count_old_page_tables], diff --git a/gcc/ggc-simple.c b/gcc/ggc-simple.c index 488df3a95ab9..eee33a568af1 100644 --- a/gcc/ggc-simple.c +++ b/gcc/ggc-simple.c @@ -166,7 +166,7 @@ ggc_alloc (size_t size) { struct ggc_mem *x; - x = (struct ggc_mem *) xmalloc (offsetof (struct ggc_mem, u) + size); + x = xmalloc (offsetof (struct ggc_mem, u) + size); x->sub[0] = NULL; x->sub[1] = NULL; x->mark = 0; diff --git a/gcc/global.c b/gcc/global.c index 0573eeb285f2..c808e2074067 100644 --- a/gcc/global.c +++ b/gcc/global.c @@ -398,14 +398,14 @@ global_alloc (FILE *file) /* Establish mappings from register number to allocation number and vice versa. In the process, count the allocnos. */ - reg_allocno = (int *) xmalloc (max_regno * sizeof (int)); + reg_allocno = xmalloc (max_regno * sizeof (int)); for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) reg_allocno[i] = -1; /* Initialize the shared-hard-reg mapping from the list of pairs that may share. */ - reg_may_share = (int *) xcalloc (max_regno, sizeof (int)); + reg_may_share = xcalloc (max_regno, sizeof (int)); for (x = regs_may_share; x; x = XEXP (XEXP (x, 1), 1)) { int r1 = REGNO (XEXP (x, 0)); @@ -436,7 +436,7 @@ global_alloc (FILE *file) else reg_allocno[i] = -1; - allocno = (struct allocno *) xcalloc (max_allocno, sizeof (struct allocno)); + allocno = xcalloc (max_allocno, sizeof (struct allocno)); for (i = FIRST_PSEUDO_REGISTER; i < (size_t) max_regno; i++) if (reg_allocno[i] >= 0) @@ -454,9 +454,9 @@ global_alloc (FILE *file) /* Calculate amount of usage of each hard reg by pseudos allocated by local-alloc. This is to see if we want to override it. */ - memset ((char *) local_reg_live_length, 0, sizeof local_reg_live_length); - memset ((char *) local_reg_n_refs, 0, sizeof local_reg_n_refs); - memset ((char *) local_reg_freq, 0, sizeof local_reg_freq); + memset (local_reg_live_length, 0, sizeof local_reg_live_length); + memset (local_reg_n_refs, 0, sizeof local_reg_n_refs); + memset (local_reg_freq, 0, sizeof local_reg_freq); for (i = FIRST_PSEUDO_REGISTER; i < (size_t) max_regno; i++) if (reg_renumber[i] >= 0) { @@ -482,10 +482,9 @@ global_alloc (FILE *file) /* We used to use alloca here, but the size of what it would try to allocate would occasionally cause it to exceed the stack limit and cause unpredictable core dumps. Some examples were > 2Mb in size. */ - conflicts = (INT_TYPE *) xcalloc (max_allocno * allocno_row_words, - sizeof (INT_TYPE)); + conflicts = xcalloc (max_allocno * allocno_row_words, sizeof (INT_TYPE)); - allocnos_live = (INT_TYPE *) xmalloc (allocno_row_words * sizeof (INT_TYPE)); + allocnos_live = xmalloc (allocno_row_words * sizeof (INT_TYPE)); /* If there is work to be done (at least one reg to allocate), perform global conflict analysis and allocate the regs. */ @@ -522,7 +521,7 @@ global_alloc (FILE *file) /* Determine the order to allocate the remaining pseudo registers. */ - allocno_order = (int *) xmalloc (max_allocno * sizeof (int)); + allocno_order = xmalloc (max_allocno * sizeof (int)); for (i = 0; i < (size_t) max_allocno; i++) allocno_order[i] = i; @@ -633,13 +632,13 @@ global_conflicts (void) int *block_start_allocnos; /* Make a vector that mark_reg_{store,clobber} will store in. */ - regs_set = (rtx *) xmalloc (max_parallel * sizeof (rtx) * 2); + regs_set = xmalloc (max_parallel * sizeof (rtx) * 2); - block_start_allocnos = (int *) xmalloc (max_allocno * sizeof (int)); + block_start_allocnos = xmalloc (max_allocno * sizeof (int)); FOR_EACH_BB (b) { - memset ((char *) allocnos_live, 0, allocno_row_words * sizeof (INT_TYPE)); + memset (allocnos_live, 0, allocno_row_words * sizeof (INT_TYPE)); /* Initialize table of registers currently live to the state at the beginning of this basic block. @@ -903,7 +902,7 @@ prune_preferences (void) { int i; int num; - int *allocno_to_order = (int *) xmalloc (max_allocno * sizeof (int)); + int *allocno_to_order = xmalloc (max_allocno * sizeof (int)); /* Scan least most important to most important. For each allocno, remove from preferences registers that cannot be used, diff --git a/gcc/graph.c b/gcc/graph.c index 45788a7c3a4f..9ff50c18130f 100644 --- a/gcc/graph.c +++ b/gcc/graph.c @@ -225,7 +225,7 @@ print_rtl_graph_with_bb (const char *base, const char *suffix, rtx rtx_first) size_t namelen = strlen (base); size_t suffixlen = strlen (suffix); size_t extlen = strlen (graph_ext[graph_dump_format]) + 1; - char *buf = (char *) alloca (namelen + suffixlen + extlen); + char *buf = alloca (namelen + suffixlen + extlen); FILE *fp; if (basic_block_info == NULL) @@ -245,10 +245,9 @@ print_rtl_graph_with_bb (const char *base, const char *suffix, rtx rtx_first) { enum bb_state { NOT_IN_BB, IN_ONE_BB, IN_MULTIPLE_BB }; int max_uid = get_max_uid (); - int *start = (int *) xmalloc (max_uid * sizeof (int)); - int *end = (int *) xmalloc (max_uid * sizeof (int)); - enum bb_state *in_bb_p = (enum bb_state *) - xmalloc (max_uid * sizeof (enum bb_state)); + int *start = xmalloc (max_uid * sizeof (int)); + int *end = xmalloc (max_uid * sizeof (int)); + enum bb_state *in_bb_p = xmalloc (max_uid * sizeof (enum bb_state)); basic_block bb; int i; @@ -390,7 +389,7 @@ clean_graph_dump_file (const char *base, const char *suffix) size_t namelen = strlen (base); size_t suffixlen = strlen (suffix); size_t extlen = strlen (graph_ext[graph_dump_format]) + 1; - char *buf = (char *) alloca (namelen + extlen + suffixlen); + char *buf = alloca (namelen + extlen + suffixlen); FILE *fp; memcpy (buf, base, namelen); @@ -422,7 +421,7 @@ finish_graph_dump_file (const char *base, const char *suffix) size_t namelen = strlen (base); size_t suffixlen = strlen (suffix); size_t extlen = strlen (graph_ext[graph_dump_format]) + 1; - char *buf = (char *) alloca (namelen + suffixlen + extlen); + char *buf = alloca (namelen + suffixlen + extlen); FILE *fp; memcpy (buf, base, namelen); diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 397c251e0397..1043f09e95c5 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -658,9 +658,9 @@ get_unit_last_insn (int instance) static void clear_units (void) { - memset ((char *) unit_last_insn, 0, sizeof (unit_last_insn)); - memset ((char *) unit_tick, 0, sizeof (unit_tick)); - memset ((char *) unit_n_insns, 0, sizeof (unit_n_insns)); + memset (unit_last_insn, 0, sizeof (unit_last_insn)); + memset (unit_tick, 0, sizeof (unit_tick)); + memset (unit_n_insns, 0, sizeof (unit_n_insns)); } /* Return the issue-delay of an insn. The scheduler using only DFA @@ -2130,7 +2130,7 @@ schedule_block (int b, int rgn_n_insns) /* Allocate the ready list. */ ready.veclen = rgn_n_insns + 1 + issue_rate; ready.first = ready.veclen - 1; - ready.vec = (rtx *) xmalloc (ready.veclen * sizeof (rtx)); + ready.vec = xmalloc (ready.veclen * sizeof (rtx)); ready.n_ready = 0; if (targetm.sched.use_dfa_pipeline_interface @@ -2138,13 +2138,12 @@ schedule_block (int b, int rgn_n_insns) { /* It is used for first cycle multipass scheduling. */ temp_state = alloca (dfa_state_size); - ready_try = (char *) xmalloc ((rgn_n_insns + 1) * sizeof (char)); + ready_try = xmalloc ((rgn_n_insns + 1) * sizeof (char)); memset (ready_try, 0, (rgn_n_insns + 1) * sizeof (char)); - choice_stack - = (struct choice_entry *) xmalloc ((rgn_n_insns + 1) - * sizeof (struct choice_entry)); + choice_stack = xmalloc ((rgn_n_insns + 1) + * sizeof (struct choice_entry)); for (i = 0; i <= rgn_n_insns; i++) - choice_stack[i].state = (state_t) xmalloc (dfa_state_size); + choice_stack[i].state = xmalloc (dfa_state_size); } (*current_sched_info->init_ready_list) (&ready); @@ -2166,8 +2165,8 @@ schedule_block (int b, int rgn_n_insns) else max_insn_queue_index_macro_value = max_insn_queue_index; - insn_queue = (rtx *) alloca ((MAX_INSN_QUEUE_INDEX + 1) * sizeof (rtx)); - memset ((char *) insn_queue, 0, (MAX_INSN_QUEUE_INDEX + 1) * sizeof (rtx)); + insn_queue = alloca ((MAX_INSN_QUEUE_INDEX + 1) * sizeof (rtx)); + memset (insn_queue, 0, (MAX_INSN_QUEUE_INDEX + 1) * sizeof (rtx)); last_clock_var = -1; /* Start just before the beginning of time. */ @@ -2582,7 +2581,7 @@ sched_init (FILE *dump_file) pseudos which do not cross calls. */ old_max_uid = get_max_uid () + 1; - h_i_d = (struct haifa_insn_data *) xcalloc (old_max_uid, sizeof (*h_i_d)); + h_i_d = xcalloc (old_max_uid, sizeof (*h_i_d)); for (i = 0; i < old_max_uid; i++) h_i_d [i].cost = -1; @@ -2632,7 +2631,7 @@ sched_init (FILE *dump_file) { rtx line; - line_note_head = (rtx *) xcalloc (last_basic_block, sizeof (rtx)); + line_note_head = xcalloc (last_basic_block, sizeof (rtx)); /* Save-line-note-head: Determine the line-number at the start of each basic block. diff --git a/gcc/hashtable.c b/gcc/hashtable.c index fafa1000a03b..4740f1d5b216 100644 --- a/gcc/hashtable.c +++ b/gcc/hashtable.c @@ -57,7 +57,7 @@ ht_create (unsigned int order) unsigned int nslots = 1 << order; hash_table *table; - table = (hash_table *) xmalloc (sizeof (hash_table)); + table = xmalloc (sizeof (hash_table)); memset (table, 0, sizeof (hash_table)); /* Strings need no alignment. */ @@ -67,7 +67,7 @@ ht_create (unsigned int order) obstack_alignment_mask (&table->stack) = 0; - table->entries = (hashnode *) xcalloc (nslots, sizeof (hashnode)); + table->entries = xcalloc (nslots, sizeof (hashnode)); table->nslots = nslots; return table; } @@ -158,7 +158,7 @@ ht_expand (hash_table *table) unsigned int size, sizemask; size = table->nslots * 2; - nentries = (hashnode *) xcalloc (size, sizeof (hashnode)); + nentries = xcalloc (size, sizeof (hashnode)); sizemask = size - 1; p = table->entries; diff --git a/gcc/integrate.c b/gcc/integrate.c index d19ca65fe27f..a8ee4faa5f38 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -283,7 +283,7 @@ initialize_for_inline (tree fndecl) tree parms; /* Clear out PARMDECL_MAP. It was allocated in the caller's frame. */ - memset ((char *) parmdecl_map, 0, max_parm_reg * sizeof (tree)); + memset (parmdecl_map, 0, max_parm_reg * sizeof (tree)); arg_vector = rtvec_alloc (list_length (DECL_ARGUMENTS (fndecl))); for (parms = DECL_ARGUMENTS (fndecl), i = 0; @@ -442,7 +442,7 @@ save_for_inline (tree fndecl) for the parms, prior to elimination of virtual registers. These values are needed for substituting parms properly. */ if (! flag_no_inline) - parmdecl_map = (tree *) xmalloc (max_parm_reg * sizeof (tree)); + parmdecl_map = xmalloc (max_parm_reg * sizeof (tree)); /* Make and emit a return-label if we have not already done so. */ @@ -724,8 +724,8 @@ expand_inline_function (tree fndecl, tree parms, rtx target, int ignore, /* Expand the function arguments. Do this first so that any new registers get created before we allocate the maps. */ - arg_vals = (rtx *) xmalloc (nargs * sizeof (rtx)); - arg_trees = (tree *) xmalloc (nargs * sizeof (tree)); + arg_vals = xmalloc (nargs * sizeof (rtx)); + arg_trees = xmalloc (nargs * sizeof (tree)); for (formal = DECL_ARGUMENTS (fndecl), actual = parms, i = 0; formal; @@ -820,22 +820,21 @@ expand_inline_function (tree fndecl, tree parms, rtx target, int ignore, /* Allocate the structures we use to remap things. */ - map = (struct inline_remap *) xcalloc (1, sizeof (struct inline_remap)); + map = xcalloc (1, sizeof (struct inline_remap)); map->fndecl = fndecl; VARRAY_TREE_INIT (map->block_map, 10, "block_map"); - map->reg_map = (rtx *) xcalloc (max_regno, sizeof (rtx)); + map->reg_map = xcalloc (max_regno, sizeof (rtx)); /* We used to use alloca here, but the size of what it would try to allocate would occasionally cause it to exceed the stack limit and cause unpredictable core dumps. */ - real_label_map - = (rtx *) xmalloc ((max_labelno) * sizeof (rtx)); + real_label_map = xmalloc ((max_labelno) * sizeof (rtx)); map->label_map = real_label_map; map->local_return_label = NULL_RTX; inl_max_uid = (inl_f->emit->x_cur_insn_uid + 1); - map->insn_map = (rtx *) xcalloc (inl_max_uid, sizeof (rtx)); + map->insn_map = xcalloc (inl_max_uid, sizeof (rtx)); map->min_insnno = 0; map->max_insnno = inl_max_uid; @@ -1185,8 +1184,8 @@ expand_inline_function (tree fndecl, tree parms, rtx target, int ignore, /* Initialize label_map. get_label_from_map will actually make the labels. */ - memset ((char *) &map->label_map[min_labelno], 0, - (max_labelno - min_labelno) * sizeof (rtx)); + memset (&map->label_map[min_labelno], 0, + (max_labelno - min_labelno) * sizeof (rtx)); /* Make copies of the decls of the symbols in the inline function, so that the copies of the variables get declared in the current function. Set @@ -3051,20 +3050,19 @@ get_func_hard_reg_initial_val (struct function *fun, rtx reg) if (ivs == 0) { - fun->hard_reg_initial_vals = (void *) ggc_alloc (sizeof (initial_value_struct)); + fun->hard_reg_initial_vals = ggc_alloc (sizeof (initial_value_struct)); ivs = fun->hard_reg_initial_vals; ivs->num_entries = 0; ivs->max_entries = 5; - ivs->entries = (initial_value_pair *) ggc_alloc (5 * sizeof (initial_value_pair)); + ivs->entries = ggc_alloc (5 * sizeof (initial_value_pair)); } if (ivs->num_entries >= ivs->max_entries) { ivs->max_entries += 5; - ivs->entries = - (initial_value_pair *) ggc_realloc (ivs->entries, - ivs->max_entries - * sizeof (initial_value_pair)); + ivs->entries = ggc_realloc (ivs->entries, + ivs->max_entries + * sizeof (initial_value_pair)); } ivs->entries[ivs->num_entries].hard_reg = reg; diff --git a/gcc/jump.c b/gcc/jump.c index 2c98ad613127..dd9d8d41a2b4 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -386,7 +386,7 @@ duplicate_loop_exit_test (rtx loop_start) /* We can do the replacement. Allocate reg_map if this is the first replacement we found. */ if (reg_map == 0) - reg_map = (rtx *) xcalloc (max_reg, sizeof (rtx)); + reg_map = xcalloc (max_reg, sizeof (rtx)); REG_LOOP_TEST_P (reg) = 1; diff --git a/gcc/langhooks.c b/gcc/langhooks.c index e86cfb2b5539..124f38b7aa99 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -461,7 +461,7 @@ write_global_declarations (void) tree globals = (*lang_hooks.decls.getdecls) (); int len = list_length (globals); - tree *vec = (tree *) xmalloc (sizeof (tree) * len); + tree *vec = xmalloc (sizeof (tree) * len); int i; tree decl; diff --git a/gcc/lcm.c b/gcc/lcm.c index 87e013300c3f..0e47507752d6 100644 --- a/gcc/lcm.c +++ b/gcc/lcm.c @@ -106,8 +106,7 @@ compute_antinout_edge (sbitmap *antloc, sbitmap *transp, sbitmap *antin, /* Allocate a worklist array/queue. Entries are only added to the list if they were not already on the list. So the size is bounded by the number of basic blocks. */ - qin = qout = worklist - = (basic_block *) xmalloc (sizeof (basic_block) * n_basic_blocks); + qin = qout = worklist = xmalloc (sizeof (basic_block) * n_basic_blocks); /* We want a maximal solution, so make an optimistic initialization of ANTIN. */ @@ -259,7 +258,7 @@ compute_laterin (struct edge_list *edge_list, sbitmap *earliest, list if they were not already on the list. So the size is bounded by the number of basic blocks. */ qin = qout = worklist - = (basic_block *) xmalloc (sizeof (basic_block) * (n_basic_blocks + 1)); + = xmalloc (sizeof (basic_block) * (n_basic_blocks + 1)); /* Initialize a mapping from each edge to its index. */ for (i = 0; i < num_edges; i++) @@ -480,8 +479,7 @@ compute_available (sbitmap *avloc, sbitmap *kill, sbitmap *avout, /* Allocate a worklist array/queue. Entries are only added to the list if they were not already on the list. So the size is bounded by the number of basic blocks. */ - qin = qout = worklist - = (basic_block *) xmalloc (sizeof (basic_block) * n_basic_blocks); + qin = qout = worklist = xmalloc (sizeof (basic_block) * n_basic_blocks); /* We want a maximal solution. */ sbitmap_vector_ones (avout, last_basic_block); @@ -608,8 +606,7 @@ compute_nearerout (struct edge_list *edge_list, sbitmap *farthest, /* Allocate a worklist array/queue. Entries are only added to the list if they were not already on the list. So the size is bounded by the number of basic blocks. */ - tos = worklist - = (basic_block *) xmalloc (sizeof (basic_block) * (n_basic_blocks + 1)); + tos = worklist = xmalloc (sizeof (basic_block) * (n_basic_blocks + 1)); /* Initialize NEARER for each edge and build a mapping from an edge to its index. */ @@ -717,8 +714,8 @@ pre_edge_rev_lcm (FILE *file ATTRIBUTE_UNUSED, int n_exprs, sbitmap *transp, edge_list = create_edge_list (); num_edges = NUM_EDGES (edge_list); - st_antin = (sbitmap *) sbitmap_vector_alloc (last_basic_block, n_exprs); - st_antout = (sbitmap *) sbitmap_vector_alloc (last_basic_block, n_exprs); + st_antin = sbitmap_vector_alloc (last_basic_block, n_exprs); + st_antout = sbitmap_vector_alloc (last_basic_block, n_exprs); sbitmap_vector_zero (st_antin, last_basic_block); sbitmap_vector_zero (st_antout, last_basic_block); compute_antinout_edge (st_antloc, transp, st_antin, st_antout); @@ -997,8 +994,7 @@ optimize_mode_switching (FILE *file) entry_exit_extra = 2; #endif bb_info[n_entities] - = (struct bb_info *) xcalloc (last_basic_block + entry_exit_extra, - sizeof **bb_info); + = xcalloc (last_basic_block + entry_exit_extra, sizeof **bb_info); entity_map[n_entities++] = e; if (num_modes[e] > max_num_modes) max_num_modes = num_modes[e]; diff --git a/gcc/line-map.c b/gcc/line-map.c index 1023b9132ebb..897af21b1a5c 100644 --- a/gcc/line-map.c +++ b/gcc/line-map.c @@ -80,8 +80,7 @@ add_line_map (struct line_maps *set, enum lc_reason reason, if (set->used == set->allocated) { set->allocated = 2 * set->allocated + 256; - set->maps = (struct line_map *) - xrealloc (set->maps, set->allocated * sizeof (struct line_map)); + set->maps = xrealloc (set->maps, set->allocated * sizeof (struct line_map)); } map = &set->maps[set->used++]; diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c index 3f240fafd1f4..26cb7edaca38 100644 --- a/gcc/local-alloc.c +++ b/gcc/local-alloc.c @@ -356,16 +356,15 @@ local_alloc (void) See the declarations of these variables, above, for what they mean. */ - qty = (struct qty *) xmalloc (max_qty * sizeof (struct qty)); - qty_phys_copy_sugg - = (HARD_REG_SET *) xmalloc (max_qty * sizeof (HARD_REG_SET)); - qty_phys_num_copy_sugg = (short *) xmalloc (max_qty * sizeof (short)); - qty_phys_sugg = (HARD_REG_SET *) xmalloc (max_qty * sizeof (HARD_REG_SET)); - qty_phys_num_sugg = (short *) xmalloc (max_qty * sizeof (short)); + qty = xmalloc (max_qty * sizeof (struct qty)); + qty_phys_copy_sugg = xmalloc (max_qty * sizeof (HARD_REG_SET)); + qty_phys_num_copy_sugg = xmalloc (max_qty * sizeof (short)); + qty_phys_sugg = xmalloc (max_qty * sizeof (HARD_REG_SET)); + qty_phys_num_sugg = xmalloc (max_qty * sizeof (short)); - reg_qty = (int *) xmalloc (max_regno * sizeof (int)); - reg_offset = (char *) xmalloc (max_regno * sizeof (char)); - reg_next_in_qty = (int *) xmalloc (max_regno * sizeof (int)); + reg_qty = xmalloc (max_regno * sizeof (int)); + reg_offset = xmalloc (max_regno * sizeof (char)); + reg_next_in_qty = xmalloc (max_regno * sizeof (int)); /* Determine which pseudo-registers can be allocated by local-alloc. In general, these are the registers used only in a single block and @@ -409,7 +408,7 @@ local_alloc (void) else { #define CLEAR(vector) \ - memset ((char *) (vector), 0, (sizeof (*(vector))) * next_qty); + memset ((vector), 0, (sizeof (*(vector))) * next_qty); CLEAR (qty_phys_copy_sugg); CLEAR (qty_phys_num_copy_sugg); @@ -798,7 +797,7 @@ update_equiv_regs (void) regset_head cleared_regs; int clear_regnos = 0; - reg_equiv = (struct equivalence *) xcalloc (max_regno, sizeof *reg_equiv); + reg_equiv = xcalloc (max_regno, sizeof *reg_equiv); INIT_REG_SET (&cleared_regs); init_alias_analysis (); @@ -1218,8 +1217,7 @@ block_alloc (int b) /* +2 to leave room for a post_mark_life at the last insn and for the birth of a CLOBBER in the first insn. */ - regs_live_at = (HARD_REG_SET *) xcalloc ((2 * insn_count + 2), - sizeof (HARD_REG_SET)); + regs_live_at = xcalloc ((2 * insn_count + 2), sizeof (HARD_REG_SET)); /* Initialize table of hardware registers currently live. */ @@ -1475,7 +1473,7 @@ block_alloc (int b) number of suggested registers they need so we allocate those with the most restrictive needs first. */ - qty_order = (int *) xmalloc (next_qty * sizeof (int)); + qty_order = xmalloc (next_qty * sizeof (int)); for (i = 0; i < next_qty; i++) qty_order[i] = i; diff --git a/gcc/loop.c b/gcc/loop.c index 683d83aef043..ba25dff5696c 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -460,13 +460,11 @@ loop_optimize (rtx f, FILE *dumpfile, int flags) Leave some space for labels allocated by find_and_verify_loops. */ max_uid_for_loop = get_max_uid () + 1 + max_loop_num * 32; - uid_luid = (int *) xcalloc (max_uid_for_loop, sizeof (int)); - uid_loop = (struct loop **) xcalloc (max_uid_for_loop, - sizeof (struct loop *)); + uid_luid = xcalloc (max_uid_for_loop, sizeof (int)); + uid_loop = xcalloc (max_uid_for_loop, sizeof (struct loop *)); /* Allocate storage for array of loops. */ - loops->array = (struct loop *) - xcalloc (loops->num, sizeof (struct loop)); + loops->array = xcalloc (loops->num, sizeof (struct loop)); /* Find and process each loop. First, find them, and record them in order of their beginnings. */ @@ -908,7 +906,7 @@ scan_loop (struct loop *loop, int flags) continue; } - m = (struct movable *) xmalloc (sizeof (struct movable)); + m = xmalloc (sizeof (struct movable)); m->next = 0; m->insn = p; m->set_src = src; @@ -996,7 +994,7 @@ scan_loop (struct loop *loop, int flags) if (regs->array[regno].set_in_loop == 2) { struct movable *m; - m = (struct movable *) xmalloc (sizeof (struct movable)); + m = xmalloc (sizeof (struct movable)); m->next = 0; m->insn = p; m->set_dest = SET_DEST (set); @@ -1440,7 +1438,7 @@ static void combine_movables (struct loop_movables *movables, struct loop_regs *regs) { struct movable *m; - char *matched_regs = (char *) xmalloc (regs->num); + char *matched_regs = xmalloc (regs->num); enum machine_mode mode; /* Regs that are set more than once are not allowed to match @@ -1775,8 +1773,8 @@ move_movables (struct loop *loop, struct loop_movables *movables, /* Map of pseudo-register replacements to handle combining when we move several insns that load the same value into different pseudo-registers. */ - rtx *reg_map = (rtx *) xcalloc (nregs, sizeof (rtx)); - char *already_moved = (char *) xcalloc (nregs, sizeof (char)); + rtx *reg_map = xcalloc (nregs, sizeof (rtx)); + char *already_moved = xcalloc (nregs, sizeof (char)); for (m = movables->head; m; m = m->next) { @@ -2120,8 +2118,8 @@ move_movables (struct loop *loop, struct loop_movables *movables, } else if (m->insert_temp) { - rtx *reg_map2 = (rtx *) xcalloc (REGNO (newreg), - sizeof(rtx)); + rtx *reg_map2 = xcalloc (REGNO (newreg), + sizeof(rtx)); reg_map2 [m->regno] = newreg; i1 = loop_insn_hoist (loop, copy_rtx (PATTERN (p))); @@ -5068,7 +5066,7 @@ strength_reduce (struct loop *loop, int flags) addr_placeholder = gen_reg_rtx (Pmode); ivs->n_regs = max_reg_before_loop; - ivs->regs = (struct iv *) xcalloc (ivs->n_regs, sizeof (struct iv)); + ivs->regs = xcalloc (ivs->n_regs, sizeof (struct iv)); /* Find all BIVs in loop. */ loop_bivs_find (loop); @@ -5122,7 +5120,7 @@ strength_reduce (struct loop *loop, int flags) Some givs might have been made from biv increments, so look at ivs->reg_iv_type for a suitable size. */ reg_map_size = ivs->n_regs; - reg_map = (rtx *) xcalloc (reg_map_size, sizeof (rtx)); + reg_map = xcalloc (reg_map_size, sizeof (rtx)); /* Examine each iv class for feasibility of strength reduction/induction variable elimination. */ @@ -5385,8 +5383,7 @@ check_insn_for_bivs (struct loop *loop, rtx p, int not_every_iteration, /* It is a possible basic induction variable. Create and initialize an induction structure for it. */ - struct induction *v - = (struct induction *) xmalloc (sizeof (struct induction)); + struct induction *v = xmalloc (sizeof (struct induction)); record_biv (loop, v, p, dest_reg, inc_val, mult_val, location, not_every_iteration, maybe_multiple); @@ -5449,8 +5446,7 @@ check_insn_for_givs (struct loop *loop, rtx p, int not_every_iteration, &add_val, &mult_val, &ext_val, &last_consec_insn)))) { - struct induction *v - = (struct induction *) xmalloc (sizeof (struct induction)); + struct induction *v = xmalloc (sizeof (struct induction)); /* If this is a library call, increase benefit. */ if (find_reg_note (p, REG_RETVAL, NULL_RTX)) @@ -5567,8 +5563,7 @@ find_mem_givs (const struct loop *loop, rtx x, rtx insn, GET_MODE (x))) { /* Found one; record it. */ - struct induction *v - = (struct induction *) xmalloc (sizeof (struct induction)); + struct induction *v = xmalloc (sizeof (struct induction)); record_giv (loop, v, insn, src_reg, addr_placeholder, mult_val, add_val, ext_val, benefit, DEST_ADDR, @@ -5641,7 +5636,7 @@ record_biv (struct loop *loop, struct induction *v, rtx insn, rtx dest_reg, { /* Create and initialize new iv_class. */ - bl = (struct iv_class *) xmalloc (sizeof (struct iv_class)); + bl = xmalloc (sizeof (struct iv_class)); bl->regno = REGNO (dest_reg); bl->biv = 0; @@ -7008,7 +7003,7 @@ consec_sets_giv (const struct loop *loop, int first_benefit, rtx p, if (REG_IV_TYPE (ivs, REGNO (dest_reg)) != UNKNOWN_INDUCT) return 0; - v = (struct induction *) alloca (sizeof (struct induction)); + v = alloca (sizeof (struct induction)); v->src_reg = src_reg; v->mult_val = *mult_val; v->add_val = *add_val; @@ -7564,15 +7559,14 @@ combine_givs (struct loop_regs *regs, struct iv_class *bl) if (!g1->ignore) giv_count++; - giv_array - = (struct induction **) alloca (giv_count * sizeof (struct induction *)); + giv_array = alloca (giv_count * sizeof (struct induction *)); i = 0; for (g1 = bl->giv; g1; g1 = g1->next_iv) if (!g1->ignore) giv_array[i++] = g1; - stats = (struct combine_givs_stats *) xcalloc (giv_count, sizeof (*stats)); - can_combine = (rtx *) xcalloc (giv_count, giv_count * sizeof (rtx)); + stats = xcalloc (giv_count, sizeof (*stats)); + can_combine = xcalloc (giv_count, giv_count * sizeof (rtx)); for (i = 0; i < giv_count; i++) { @@ -9520,9 +9514,8 @@ insert_loop_mem (rtx *mem, void *data ATTRIBUTE_UNUSED) else loop_info->mems_allocated = 32; - loop_info->mems = (loop_mem_info *) - xrealloc (loop_info->mems, - loop_info->mems_allocated * sizeof (loop_mem_info)); + loop_info->mems = xrealloc (loop_info->mems, + loop_info->mems_allocated * sizeof (loop_mem_info)); } /* Actually insert the MEM. */ @@ -9573,8 +9566,7 @@ loop_regs_scan (const struct loop *loop, int extra_size) { regs->size = regs->num + extra_size; - regs->array = (struct loop_reg *) - xrealloc (regs->array, regs->size * sizeof (*regs->array)); + regs->array = xrealloc (regs->array, regs->size * sizeof (*regs->array)); /* Zero the new elements. */ memset (regs->array + old_nregs, 0, @@ -9589,7 +9581,7 @@ loop_regs_scan (const struct loop *loop, int extra_size) regs->array[i].single_usage = NULL_RTX; } - last_set = (rtx *) xcalloc (regs->num, sizeof (rtx)); + last_set = xcalloc (regs->num, sizeof (rtx)); /* Scan the loop, recording register usage. */ for (insn = loop->top ? loop->top : loop->start; insn != loop->end; diff --git a/gcc/mips-tdump.c b/gcc/mips-tdump.c index 3a183758c40e..e25c175ef54d 100644 --- a/gcc/mips-tdump.c +++ b/gcc/mips-tdump.c @@ -884,7 +884,7 @@ print_symbol (SYMR *sym_ptr, int number, const char *strbase, AUXU *aux_base, if (want_scope) { if (free_scope == (scope_t *) 0) - scope_ptr = (scope_t *) xmalloc (sizeof (scope_t)); + scope_ptr = xmalloc (sizeof (scope_t)); else { scope_ptr = free_scope; @@ -938,7 +938,7 @@ print_symbol (SYMR *sym_ptr, int number, const char *strbase, AUXU *aux_base, if (want_scope) { if (free_scope == (scope_t *) 0) - scope_ptr = (scope_t *) xmalloc (sizeof (scope_t)); + scope_ptr = xmalloc (sizeof (scope_t)); else { scope_ptr = free_scope; @@ -1324,13 +1324,12 @@ read_tfile (void) short magic; off_t sym_hdr_offset = 0; - (void) read_seek (&magic, sizeof (magic), (off_t) 0, "Magic number"); + read_seek (&magic, sizeof (magic), 0, "Magic number"); if (!tfile) { /* Print out the global header, since this is not a T-file. */ - (void) read_seek (&global_hdr, sizeof (global_hdr), (off_t) 0, - "Global file header"); + read_seek (&global_hdr, sizeof (global_hdr), 0, "Global file header"); print_global_hdr (&global_hdr); @@ -1343,70 +1342,45 @@ read_tfile (void) sym_hdr_offset = global_hdr.f_symptr; } - (void) read_seek (&sym_hdr, - sizeof (sym_hdr), - sym_hdr_offset, - "Symbolic header"); + read_seek (&sym_hdr, sizeof (sym_hdr), sym_hdr_offset, "Symbolic header"); print_sym_hdr (&sym_hdr); - lines = (LINER *) read_seek (NULL, - sym_hdr.cbLine, - sym_hdr.cbLineOffset, - "Line numbers"); + lines = read_seek (NULL, sym_hdr.cbLine, sym_hdr.cbLineOffset, + "Line numbers"); - dense_nums = (DNR *) read_seek (NULL, - sym_hdr.idnMax * sizeof (DNR), - sym_hdr.cbDnOffset, - "Dense numbers"); + dense_nums = read_seek (NULL, sym_hdr.idnMax * sizeof (DNR), + sym_hdr.cbDnOffset, "Dense numbers"); - proc_desc = (PDR *) read_seek (NULL, - sym_hdr.ipdMax * sizeof (PDR), - sym_hdr.cbPdOffset, - "Procedure tables"); + proc_desc = read_seek (NULL, sym_hdr.ipdMax * sizeof (PDR), + sym_hdr.cbPdOffset, "Procedure tables"); - l_symbols = (SYMR *) read_seek (NULL, - sym_hdr.isymMax * sizeof (SYMR), - sym_hdr.cbSymOffset, - "Local symbols"); + l_symbols = read_seek (NULL, sym_hdr.isymMax * sizeof (SYMR), + sym_hdr.cbSymOffset, "Local symbols"); - opt_symbols = (OPTR *) read_seek (NULL, - sym_hdr.ioptMax * sizeof (OPTR), - sym_hdr.cbOptOffset, - "Optimization symbols"); + opt_symbols = read_seek (NULL, sym_hdr.ioptMax * sizeof (OPTR), + sym_hdr.cbOptOffset, "Optimization symbols"); - aux_symbols = (AUXU *) read_seek (NULL, - sym_hdr.iauxMax * sizeof (AUXU), - sym_hdr.cbAuxOffset, - "Auxiliary symbols"); + aux_symbols = read_seek (NULL, sym_hdr.iauxMax * sizeof (AUXU), + sym_hdr.cbAuxOffset, "Auxiliary symbols"); if (sym_hdr.iauxMax > 0) aux_used = xcalloc (sym_hdr.iauxMax, 1); - l_strings = (char *) read_seek (NULL, - sym_hdr.issMax, - sym_hdr.cbSsOffset, - "Local string table"); - - e_strings = (char *) read_seek (NULL, - sym_hdr.issExtMax, - sym_hdr.cbSsExtOffset, - "External string table"); - - file_desc = (FDR *) read_seek (NULL, - sym_hdr.ifdMax * sizeof (FDR), - sym_hdr.cbFdOffset, - "File tables"); - - rfile_desc = (ulong *) read_seek (NULL, - sym_hdr.crfd * sizeof (ulong), - sym_hdr.cbRfdOffset, - "Relative file tables"); - - e_symbols = (EXTR *) read_seek (NULL, - sym_hdr.iextMax * sizeof (EXTR), - sym_hdr.cbExtOffset, - "External symbols"); + l_strings = read_seek (NULL, sym_hdr.issMax, + sym_hdr.cbSsOffset, "Local string table"); + + e_strings = read_seek (NULL, sym_hdr.issExtMax, + sym_hdr.cbSsExtOffset, "External string table"); + + file_desc = read_seek (NULL, sym_hdr.ifdMax * sizeof (FDR), + sym_hdr.cbFdOffset, "File tables"); + + rfile_desc = read_seek (NULL, sym_hdr.crfd * sizeof (ulong), + sym_hdr.cbRfdOffset, "Relative file tables"); + + e_symbols = read_seek (NULL, sym_hdr.iextMax * sizeof (EXTR), + sym_hdr.cbExtOffset, "External symbols"); } diff --git a/gcc/mips-tfile.c b/gcc/mips-tfile.c index 79345e564691..4a284611f78e 100644 --- a/gcc/mips-tfile.c +++ b/gcc/mips-tfile.c @@ -1637,7 +1637,7 @@ add_varray_page (varray_t *vp) #ifdef MALLOC_CHECK if (vp->object_size > 1) - new_links->datum = (page_t *) xcalloc (1, vp->object_size); + new_links->datum = xcalloc (1, vp->object_size); else #endif new_links->datum = allocate_page (); @@ -2353,7 +2353,7 @@ add_procedure (const char *func_start, /* 1st byte of func name */ STATIC void initialize_init_file (void) { - memset ((void*) &init_file, 0, sizeof (init_file)); + memset (&init_file, 0, sizeof (init_file)); init_file.fdr.lang = langC; init_file.fdr.fMerge = 1; @@ -4257,7 +4257,7 @@ read_seek (Size_t size, /* # bytes to read */ #ifndef MALLOC_CHECK ptr = allocate_multiple_pages ((size + PAGE_USIZE - 1) / PAGE_USIZE); #else - ptr = (page_t *) xcalloc (1, size); + ptr = xcalloc (1, size); #endif /* If we need to seek, and the distance is nearby, just do some reads, @@ -4379,61 +4379,61 @@ copy_object (void) file_offset = orig_file_header.f_symptr + sizeof (struct filehdr); if (orig_sym_hdr.cbLine > 0) /* line numbers */ - orig_linenum = (char *) read_seek ((Size_t) orig_sym_hdr.cbLine, + orig_linenum = (char *) read_seek (orig_sym_hdr.cbLine, orig_sym_hdr.cbLineOffset, "Line numbers"); if (orig_sym_hdr.ipdMax > 0) /* procedure tables */ - orig_procs = (PDR *) read_seek ((Size_t) orig_sym_hdr.ipdMax * sizeof (PDR), + orig_procs = (PDR *) read_seek (orig_sym_hdr.ipdMax * sizeof (PDR), orig_sym_hdr.cbPdOffset, "Procedure tables"); if (orig_sym_hdr.isymMax > 0) /* local symbols */ - orig_local_syms = (SYMR *) read_seek ((Size_t) orig_sym_hdr.isymMax * sizeof (SYMR), + orig_local_syms = (SYMR *) read_seek (orig_sym_hdr.isymMax * sizeof (SYMR), orig_sym_hdr.cbSymOffset, "Local symbols"); if (orig_sym_hdr.iauxMax > 0) /* aux symbols */ - orig_aux_syms = (AUXU *) read_seek ((Size_t) orig_sym_hdr.iauxMax * sizeof (AUXU), + orig_aux_syms = (AUXU *) read_seek (orig_sym_hdr.iauxMax * sizeof (AUXU), orig_sym_hdr.cbAuxOffset, "Aux. symbols"); if (orig_sym_hdr.issMax > 0) /* local strings */ - orig_local_strs = (char *) read_seek ((Size_t) orig_sym_hdr.issMax, + orig_local_strs = (char *) read_seek (orig_sym_hdr.issMax, orig_sym_hdr.cbSsOffset, "Local strings"); if (orig_sym_hdr.issExtMax > 0) /* external strings */ - orig_ext_strs = (char *) read_seek ((Size_t) orig_sym_hdr.issExtMax, + orig_ext_strs = (char *) read_seek (orig_sym_hdr.issExtMax, orig_sym_hdr.cbSsExtOffset, "External strings"); if (orig_sym_hdr.ifdMax > 0) /* file tables */ - orig_files = (FDR *) read_seek ((Size_t) orig_sym_hdr.ifdMax * sizeof (FDR), + orig_files = (FDR *) read_seek (orig_sym_hdr.ifdMax * sizeof (FDR), orig_sym_hdr.cbFdOffset, "File tables"); if (orig_sym_hdr.crfd > 0) /* relative file descriptors */ - orig_rfds = (symint_t *) read_seek ((Size_t) orig_sym_hdr.crfd * sizeof (symint_t), + orig_rfds = (symint_t *) read_seek (orig_sym_hdr.crfd * sizeof (symint_t), orig_sym_hdr.cbRfdOffset, "Relative file descriptors"); if (orig_sym_hdr.issExtMax > 0) /* external symbols */ - orig_ext_syms = (EXTR *) read_seek ((Size_t) orig_sym_hdr.iextMax * sizeof (EXTR), + orig_ext_syms = (EXTR *) read_seek (orig_sym_hdr.iextMax * sizeof (EXTR), orig_sym_hdr.cbExtOffset, "External symbols"); if (orig_sym_hdr.idnMax > 0) /* dense numbers */ { - orig_dense = (DNR *) read_seek ((Size_t) orig_sym_hdr.idnMax * sizeof (DNR), + orig_dense = (DNR *) read_seek (orig_sym_hdr.idnMax * sizeof (DNR), orig_sym_hdr.cbDnOffset, "Dense numbers"); - add_bytes (&dense_num, (char *) orig_dense, (Size_t) orig_sym_hdr.idnMax); + add_bytes (&dense_num, (char *) orig_dense, orig_sym_hdr.idnMax); } if (orig_sym_hdr.ioptMax > 0) /* opt symbols */ - orig_opt_syms = (OPTR *) read_seek ((Size_t) orig_sym_hdr.ioptMax * sizeof (OPTR), + orig_opt_syms = (OPTR *) read_seek (orig_sym_hdr.ioptMax * sizeof (OPTR), orig_sym_hdr.cbOptOffset, "Optimizer symbols"); @@ -4464,7 +4464,7 @@ copy_object (void) (in case there are duplicate filenames, we collapse them into one file section, the MIPS assembler may or may not collapse them). */ - remap_file_number = (int *) alloca (sizeof (int) * orig_sym_hdr.ifdMax); + remap_file_number = alloca (sizeof (int) * orig_sym_hdr.ifdMax); for (fd = delete_ifd; fd < orig_sym_hdr.ifdMax; fd++) { @@ -4972,7 +4972,7 @@ out_of_bounds (symint_t indx, /* index that is out of bounds */ STATIC page_t * allocate_cluster (Size_t npages) { - page_t *value = (page_t *) xcalloc (npages, PAGE_USIZE); + page_t *value = xcalloc (npages, PAGE_USIZE); if (debug > 3) fprintf (stderr, "\talloc\tnpages = %d, value = 0x%.8x\n", npages, value); @@ -5038,7 +5038,7 @@ allocate_multiple_pages (Size_t npages) return allocate_cluster (npages); #else /* MALLOC_CHECK */ - return (page_t *) xcalloc (npages, PAGE_SIZE); + return xcalloc (npages, PAGE_SIZE); #endif /* MALLOC_CHECK */ } @@ -5089,7 +5089,7 @@ allocate_page (void) return cluster_ptr++; #else /* MALLOC_CHECK */ - return (page_t *) xcalloc (1, PAGE_SIZE); + return xcalloc (1, PAGE_SIZE); #endif /* MALLOC_CHECK */ } @@ -5125,7 +5125,7 @@ allocate_scope (void) } #else - ptr = (scope_t *) xmalloc (sizeof (scope_t)); + ptr = xmalloc (sizeof (scope_t)); #endif @@ -5175,7 +5175,7 @@ allocate_vlinks (void) alloc_counts[ (int) alloc_type_vlinks ].unallocated = unallocated; #else - ptr = (vlinks_t *) xmalloc (sizeof (vlinks_t)); + ptr = xmalloc (sizeof (vlinks_t)); #endif @@ -5208,7 +5208,7 @@ allocate_shash (void) alloc_counts[ (int) alloc_type_shash ].unallocated = unallocated; #else - ptr = (shash_t *) xmalloc (sizeof (shash_t)); + ptr = xmalloc (sizeof (shash_t)); #endif @@ -5241,7 +5241,7 @@ allocate_thash (void) alloc_counts[ (int) alloc_type_thash ].unallocated = unallocated; #else - ptr = (thash_t *) xmalloc (sizeof (thash_t)); + ptr = xmalloc (sizeof (thash_t)); #endif @@ -5281,7 +5281,7 @@ allocate_tag (void) } #else - ptr = (tag_t *) xmalloc (sizeof (tag_t)); + ptr = xmalloc (sizeof (tag_t)); #endif @@ -5338,7 +5338,7 @@ allocate_forward (void) } #else - ptr = (forward_t *) xmalloc (sizeof (forward_t)); + ptr = xmalloc (sizeof (forward_t)); #endif @@ -5395,7 +5395,7 @@ allocate_thead (void) } #else - ptr = (thead_t *) xmalloc (sizeof (thead_t)); + ptr = xmalloc (sizeof (thead_t)); #endif diff --git a/gcc/mkdeps.c b/gcc/mkdeps.c index bb084a59d0a1..23af9d83f780 100644 --- a/gcc/mkdeps.c +++ b/gcc/mkdeps.c @@ -110,7 +110,7 @@ munge (const char *filename) struct deps * deps_init (void) { - struct deps *d = (struct deps *) xmalloc (sizeof (struct deps)); + struct deps *d = xmalloc (sizeof (struct deps)); /* Allocate space for the vectors only if we need it. */ @@ -155,7 +155,7 @@ deps_add_target (struct deps *d, const char *t, int quote) if (d->ntargets == d->targets_size) { d->targets_size = d->targets_size * 2 + 4; - d->targetv = (const char **) xrealloc (d->targetv, + d->targetv = xrealloc (d->targetv, d->targets_size * sizeof (const char *)); } @@ -185,7 +185,7 @@ deps_add_default_target (struct deps *d, const char *tgt) # define TARGET_OBJECT_SUFFIX ".o" #endif const char *start = lbasename (tgt); - char *o = (char *) alloca (strlen (start) + strlen (TARGET_OBJECT_SUFFIX) + 1); + char *o = alloca (strlen (start) + strlen (TARGET_OBJECT_SUFFIX) + 1); char *suffix; strcpy (o, start); @@ -207,8 +207,7 @@ deps_add_dep (struct deps *d, const char *t) if (d->ndeps == d->deps_size) { d->deps_size = d->deps_size * 2 + 8; - d->depv = (const char **) - xrealloc (d->depv, d->deps_size * sizeof (const char *)); + d->depv = xrealloc (d->depv, d->deps_size * sizeof (const char *)); } d->depv[d->ndeps++] = t; } @@ -315,7 +314,7 @@ deps_restore (struct deps *deps, FILE *fd, const char *self) unsigned int i, count; size_t num_to_read; size_t buf_size = 512; - char *buf = (char *) xmalloc (buf_size); + char *buf = xmalloc (buf_size); /* Number of dependences. */ if (fread (&count, 1, sizeof (count), fd) != sizeof (count)) diff --git a/gcc/optabs.c b/gcc/optabs.c index f8ae543024b7..9e4ba2b06a21 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -5201,7 +5201,7 @@ static optab new_optab (void) { int i; - optab op = (optab) ggc_alloc (sizeof (struct optab)); + optab op = ggc_alloc (sizeof (struct optab)); for (i = 0; i < NUM_MACHINE_MODES; i++) { op->handlers[i].insn_code = CODE_FOR_nothing; diff --git a/gcc/params.c b/gcc/params.c index 3ef0a7fdf5ad..e109d3adb3fe 100644 --- a/gcc/params.c +++ b/gcc/params.c @@ -43,10 +43,8 @@ void add_params (const param_info params[], size_t n) { /* Allocate enough space for the new parameters. */ - compiler_params = - ((param_info *) - xrealloc (compiler_params, - (num_compiler_params + n) * sizeof (param_info))); + compiler_params = xrealloc (compiler_params, + (num_compiler_params + n) * sizeof (param_info)); /* Copy them into the table. */ memcpy (compiler_params + num_compiler_params, params, diff --git a/gcc/postreload.c b/gcc/postreload.c index 9c459c5b4635..2875dbdffd0e 100644 --- a/gcc/postreload.c +++ b/gcc/postreload.c @@ -377,11 +377,11 @@ reload_cse_simplify_operands (rtx insn, rtx testreg) if (! constrain_operands (1)) fatal_insn_not_found (insn); - alternative_reject = (int *) alloca (recog_data.n_alternatives * sizeof (int)); - alternative_nregs = (int *) alloca (recog_data.n_alternatives * sizeof (int)); - alternative_order = (int *) alloca (recog_data.n_alternatives * sizeof (int)); - memset ((char *) alternative_reject, 0, recog_data.n_alternatives * sizeof (int)); - memset ((char *) alternative_nregs, 0, recog_data.n_alternatives * sizeof (int)); + alternative_reject = alloca (recog_data.n_alternatives * sizeof (int)); + alternative_nregs = alloca (recog_data.n_alternatives * sizeof (int)); + alternative_order = alloca (recog_data.n_alternatives * sizeof (int)); + memset (alternative_reject, 0, recog_data.n_alternatives * sizeof (int)); + memset (alternative_nregs, 0, recog_data.n_alternatives * sizeof (int)); /* For each operand, find out which regs are equivalent. */ for (i = 0; i < recog_data.n_operands; i++) @@ -414,7 +414,7 @@ reload_cse_simplify_operands (rtx insn, rtx testreg) int regno; const char *p; - op_alt_regno[i] = (int *) alloca (recog_data.n_alternatives * sizeof (int)); + op_alt_regno[i] = alloca (recog_data.n_alternatives * sizeof (int)); for (j = 0; j < recog_data.n_alternatives; j++) op_alt_regno[i][j] = -1; @@ -659,7 +659,7 @@ reload_combine (void) destination. */ min_labelno = get_first_label_num (); n_labels = max_label_num () - min_labelno; - label_live = (HARD_REG_SET *) xmalloc (n_labels * sizeof (HARD_REG_SET)); + label_live = xmalloc (n_labels * sizeof (HARD_REG_SET)); CLEAR_HARD_REG_SET (ever_live_at_start); FOR_EACH_BB_REVERSE (bb) diff --git a/gcc/prefix.c b/gcc/prefix.c index ef9d9b8da923..df556aaa30c0 100644 --- a/gcc/prefix.c +++ b/gcc/prefix.c @@ -155,12 +155,12 @@ lookup_key (char *key) } size = 32; - dst = (char *) xmalloc (size); + dst = xmalloc (size); res = RegQueryValueExA (reg_key, key, 0, &type, dst, &size); if (res == ERROR_MORE_DATA && type == REG_SZ) { - dst = (char *) xrealloc (dst, size); + dst = xrealloc (dst, size); res = RegQueryValueExA (reg_key, key, 0, &type, dst, &size); } @@ -197,7 +197,7 @@ translate_name (char *name) keylen++) ; - key = (char *) alloca (keylen + 1); + key = alloca (keylen + 1); strncpy (key, &name[1], keylen); key[keylen] = 0; diff --git a/gcc/print-tree.c b/gcc/print-tree.c index 6d56d7e62fb8..651fb094f23d 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -49,7 +49,7 @@ static struct bucket **table; void debug_tree (tree node) { - table = (struct bucket **) xcalloc (HASH_SIZE, sizeof (struct bucket *)); + table = xcalloc (HASH_SIZE, sizeof (struct bucket *)); print_node (stderr, "", node, 0); free (table); table = 0; @@ -200,7 +200,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent) } /* Add this node to the table. */ - b = (struct bucket *) xmalloc (sizeof (struct bucket)); + b = xmalloc (sizeof (struct bucket)); b->node = node; b->next = table[hash]; table[hash] = b; diff --git a/gcc/protoize.c b/gcc/protoize.c index 937f01e54ad4..58be683b9d86 100644 --- a/gcc/protoize.c +++ b/gcc/protoize.c @@ -521,7 +521,7 @@ notice (const char *msgid, ...) static char * savestring (const char *input, unsigned int size) { - char *output = (char *) xmalloc (size + 1); + char *output = xmalloc (size + 1); strcpy (output, input); return output; } @@ -542,7 +542,7 @@ fancy_abort (void) static char * dupnstr (const char *s, size_t n) { - char *ret_val = (char *) xmalloc (n + 1); + char *ret_val = xmalloc (n + 1); strncpy (ret_val, s, n); ret_val[n] = '\0'; @@ -692,7 +692,7 @@ in_system_include_dir (const char *path) static int file_could_be_converted (const char *path) { - char *const dir_name = (char *) alloca (strlen (path) + 1); + char *const dir_name = alloca (strlen (path) + 1); if (access (path, R_OK)) return 0; @@ -898,8 +898,7 @@ file_excluded_p (const char *name) static struct string_list * string_list_cons (const char *string, struct string_list *rest) { - struct string_list *temp - = (struct string_list *) xmalloc (sizeof (struct string_list)); + struct string_list *temp = xmalloc (sizeof (struct string_list)); temp->next = rest; temp->name = string; @@ -973,7 +972,7 @@ lookup (hash_table_entry *hash_tab_p, const char *search_symbol) if (!strcmp (p->symbol, search_symbol)) return p; } - p->hash_next = (hash_table_entry *) xmalloc (sizeof (hash_table_entry)); + p->hash_next = xmalloc (sizeof (hash_table_entry)); p = p->hash_next; return add_symbol (p, search_symbol); } @@ -1022,7 +1021,7 @@ unexpand_if_needed (const char *aux_info_line) if (line_buf == 0) { line_buf_size = 1024; - line_buf = (char *) xmalloc (line_buf_size); + line_buf = xmalloc (line_buf_size); } copy_p = line_buf; @@ -1045,7 +1044,7 @@ unexpand_if_needed (const char *aux_info_line) int offset = copy_p - line_buf; line_buf_size *= 2; line_buf_size += size; - line_buf = (char *) xrealloc (line_buf, line_buf_size); + line_buf = xrealloc (line_buf, line_buf_size); copy_p = line_buf + offset; } strcpy (copy_p, unexp_p->contracted); @@ -1062,7 +1061,7 @@ unexpand_if_needed (const char *aux_info_line) { int offset = copy_p - line_buf; line_buf_size *= 2; - line_buf = (char *) xrealloc (line_buf, line_buf_size); + line_buf = xrealloc (line_buf, line_buf_size); copy_p = line_buf + offset; } *copy_p++ = *s++; @@ -1072,7 +1071,7 @@ continue_outer: ; { int offset = copy_p - line_buf; line_buf_size *= 2; - line_buf = (char *) xrealloc (line_buf, line_buf_size); + line_buf = xrealloc (line_buf, line_buf_size); copy_p = line_buf + offset; } *copy_p++ = '\n'; @@ -1096,8 +1095,7 @@ abspath (const char *cwd, const char *rel_filename) { /* Setup the current working directory as needed. */ const char *const cwd2 = (cwd) ? cwd : cwd_buffer; - char *const abs_buffer - = (char *) alloca (strlen (cwd2) + strlen (rel_filename) + 2); + char *const abs_buffer = alloca (strlen (cwd2) + strlen (rel_filename) + 2); char *endp = abs_buffer; char *outp, *inp; @@ -1219,7 +1217,7 @@ shortpath (const char *cwd, const char *filename) size_t filename_len = strlen (filename); path_p = abspath (cwd, filename); - rel_buf_p = rel_buffer = (char *) xmalloc (filename_len); + rel_buf_p = rel_buffer = xmalloc (filename_len); while (*cwd_p && IS_SAME_PATH_CHAR (*cwd_p, *path_p)) { @@ -1306,7 +1304,7 @@ find_file (const char *filename, int do_not_stat) else { struct stat stat_buf; - file_info *file_p = (file_info *) xmalloc (sizeof (file_info)); + file_info *file_p = xmalloc (sizeof (file_info)); /* If we cannot get status on any given source file, give a warning and then just set its time of last modification to infinity. */ @@ -1404,7 +1402,7 @@ referenced_file_is_newer (const char *l, time_t aux_info_mtime) #endif ) p++; - filename = (char *) alloca ((size_t) (p - filename_start) + 1); + filename = alloca ((size_t) (p - filename_start) + 1); strncpy (filename, filename_start, (size_t) (p - filename_start)); filename[p-filename_start] = '\0'; } @@ -1439,7 +1437,7 @@ save_def_or_dec (const char *l, int is_syscalls) { const char *p; const char *semicolon_p; - def_dec_info *def_dec_p = (def_dec_info *) xmalloc (sizeof (def_dec_info)); + def_dec_info *def_dec_p = xmalloc (sizeof (def_dec_info)); #ifndef UNPROTOIZE def_dec_p->written = 0; @@ -1464,7 +1462,7 @@ save_def_or_dec (const char *l, int is_syscalls) #endif ) p++; - filename = (char *) alloca ((size_t) (p - filename_start) + 1); + filename = alloca ((size_t) (p - filename_start) + 1); strncpy (filename, filename_start, (size_t) (p - filename_start)); filename[p-filename_start] = '\0'; @@ -1594,8 +1592,7 @@ save_def_or_dec (const char *l, int is_syscalls) const char *left_paren_p = find_corresponding_lparen (p); #ifndef UNPROTOIZE { - f_list_chain_item *cip - = (f_list_chain_item *) xmalloc (sizeof (f_list_chain_item)); + f_list_chain_item *cip = xmalloc (sizeof (f_list_chain_item)); cip->formals_list = dupnstr (left_paren_p + 1, (size_t) (p - (left_paren_p+1))); @@ -1637,7 +1634,7 @@ save_def_or_dec (const char *l, int is_syscalls) /* p now points to the leftmost character of the function name. */ { - char *fn_string = (char *) alloca (past_fn - p + 1); + char *fn_string = alloca (past_fn - p + 1); strncpy (fn_string, p, (size_t) (past_fn - p)); fn_string[past_fn-p] = '\0'; @@ -1833,7 +1830,7 @@ munge_compile_params (const char *params_list) /* Build up the contents in a temporary vector that is so big that to has to be big enough. */ const char **temp_params - = (const char **) alloca ((strlen (params_list) + 8) * sizeof (char *)); + = alloca ((strlen (params_list) + 8) * sizeof (char *)); int param_count = 0; const char *param; struct stat st; @@ -1902,8 +1899,7 @@ munge_compile_params (const char *params_list) /* Make a copy of the compile_params in heap space. */ - compile_params - = (const char **) xmalloc (sizeof (char *) * (param_count+1)); + compile_params = xmalloc (sizeof (char *) * (param_count+1)); memcpy (compile_params, temp_params, sizeof (char *) * param_count); } @@ -1979,8 +1975,7 @@ process_aux_info_file (const char *base_source_filename, int keep_it, int is_syscalls) { size_t base_len = strlen (base_source_filename); - char * aux_info_filename - = (char *) alloca (base_len + strlen (aux_info_suffix) + 1); + char * aux_info_filename = alloca (base_len + strlen (aux_info_suffix) + 1); char *aux_info_base; char *aux_info_limit; char *aux_info_relocated_name; @@ -2309,8 +2304,8 @@ rename_c_file (const hash_table_entry *hp) { const char *filename = hp->symbol; int last_char_index = strlen (filename) - 1; - char *const new_filename = (char *) alloca (strlen (filename) - + strlen (cplus_suffix) + 1); + char *const new_filename = alloca (strlen (filename) + + strlen (cplus_suffix) + 1); /* Note that we don't care here if the given file was converted or not. It is possible that the given file was *not* converted, simply because there @@ -2517,7 +2512,7 @@ find_extern_def (const def_dec_info *head, const def_dec_info *user) { /* Why copy this string into `needed' at all? Why not just use user->ansi_decl without copying? */ - char *needed = (char *) alloca (strlen (user->ansi_decl) + 1); + char *needed = alloca (strlen (user->ansi_decl) + 1); char *p; strcpy (needed, user->ansi_decl); @@ -2815,7 +2810,7 @@ output_bytes (const char *str, size_t len) if ((repl_write_ptr + 1) + len >= repl_text_limit) { size_t new_size = (repl_text_limit - repl_text_base) << 1; - char *new_buf = (char *) xrealloc (repl_text_base, new_size); + char *new_buf = xrealloc (repl_text_base, new_size); repl_write_ptr = new_buf + (repl_write_ptr - repl_text_base); repl_text_base = new_buf; @@ -3887,7 +3882,7 @@ scan_for_missed_items (const file_info *file_p) goto not_missed; { - char *func_name = (char *) alloca (id_length + 1); + char *func_name = alloca (id_length + 1); static const char * const stmt_keywords[] = { "if", "else", "do", "while", "for", "switch", "case", "return", 0 }; const char * const *stmt_keyword; @@ -4010,12 +4005,12 @@ edit_file (const hash_table_entry *hp) /* Allocate a buffer to hold the original text. */ - orig_text_base = new_orig_text_base = (char *) xmalloc (orig_size + 2); + orig_text_base = new_orig_text_base = xmalloc (orig_size + 2); orig_text_limit = new_orig_text_limit = new_orig_text_base + orig_size; /* Allocate a buffer to hold the cleaned-up version of the original text. */ - clean_text_base = new_clean_text_base = (char *) xmalloc (orig_size + 2); + clean_text_base = new_clean_text_base = xmalloc (orig_size + 2); clean_text_limit = new_clean_text_limit = new_clean_text_base + orig_size; clean_read_ptr = clean_text_base - 1; @@ -4025,7 +4020,7 @@ edit_file (const hash_table_entry *hp) buffer can be expanded later as needed. */ repl_size = orig_size + (orig_size >> 2) + 4096; - repl_text_base = (char *) xmalloc (repl_size + 2); + repl_text_base = xmalloc (repl_size + 2); repl_text_limit = repl_text_base + repl_size - 1; repl_write_ptr = repl_text_base - 1; @@ -4083,7 +4078,7 @@ edit_file (const hash_table_entry *hp) { int clean_file; size_t clean_size = orig_text_limit - orig_text_base; - char *const clean_filename = (char *) alloca (strlen (convert_filename) + 6 + 1); + char *const clean_filename = alloca (strlen (convert_filename) + 6 + 1); /* Open (and create) the clean file. */ @@ -4183,7 +4178,7 @@ edit_file (const hash_table_entry *hp) if (!nosave_flag) { char *new_filename - = (char *) xmalloc (strlen (convert_filename) + strlen (save_suffix) + 2); + = xmalloc (strlen (convert_filename) + strlen (save_suffix) + 2); strcpy (new_filename, convert_filename); #ifdef __MSDOS__ @@ -4310,8 +4305,8 @@ do_processing (void) if (nondefault_syscalls_dir) { syscalls_absolute_filename - = (char *) xmalloc (strlen (nondefault_syscalls_dir) + 1 - + sizeof (syscalls_filename)); + = xmalloc (strlen (nondefault_syscalls_dir) + 1 + + sizeof (syscalls_filename)); strcpy (syscalls_absolute_filename, nondefault_syscalls_dir); } else @@ -4322,10 +4317,10 @@ do_processing (void) default_syscalls_dir = standard_exec_prefix; } syscalls_absolute_filename - = (char *) xmalloc (strlen (default_syscalls_dir) + 0 - + strlen (target_machine) + 1 - + strlen (target_version) + 1 - + sizeof (syscalls_filename)); + = xmalloc (strlen (default_syscalls_dir) + 0 + + strlen (target_machine) + 1 + + strlen (target_version) + 1 + + sizeof (syscalls_filename)); strcpy (syscalls_absolute_filename, default_syscalls_dir); strcat (syscalls_absolute_filename, target_machine); strcat (syscalls_absolute_filename, "/"); @@ -4528,7 +4523,7 @@ main (int argc, char **const argv) /* Now actually make a list of the base source filenames. */ base_source_filenames - = (const char **) xmalloc ((n_base_source_files + 1) * sizeof (char *)); + = xmalloc ((n_base_source_files + 1) * sizeof (char *)); n_base_source_files = 0; for (; optind < argc; optind++) { diff --git a/gcc/ra-build.c b/gcc/ra-build.c index e6f846aea593..d00369ec14e0 100644 --- a/gcc/ra-build.c +++ b/gcc/ra-build.c @@ -331,8 +331,7 @@ get_sub_conflicts (wp, size_word) bitmap b = find_sub_conflicts (wp, size_word); if (!b) { - struct tagged_conflict *cl = - (struct tagged_conflict *) ra_alloc (sizeof *cl); + struct tagged_conflict *cl = ra_alloc (sizeof *cl); cl->conflicts = BITMAP_XMALLOC (); cl->size_word = size_word; cl->next = wp->sub_conflicts; @@ -583,10 +582,10 @@ remember_move (insn) subwebs could be source and target of coalescing). */ if (GET_CODE (s) == REG && GET_CODE (d) == REG) { - struct move *m = (struct move *) ra_calloc (sizeof (struct move)); + struct move *m = ra_calloc (sizeof (struct move)); struct move_list *ml; m->insn = insn; - ml = (struct move_list *) ra_alloc (sizeof (struct move_list)); + ml = ra_alloc (sizeof (struct move_list)); ml->move = m; ml->next = wl_moves; wl_moves = ml; @@ -1112,8 +1111,7 @@ init_bb_info () basic_block bb; FOR_ALL_BB (bb) { - struct ra_bb_info *info = - (struct ra_bb_info *) xcalloc (1, sizeof *info); + struct ra_bb_info *info = xcalloc (1, sizeof *info); info->regnos_mentioned = BITMAP_XMALLOC (); info->live_throughout = BITMAP_XMALLOC (); info->old_aux = bb->aux; @@ -1149,9 +1147,8 @@ build_web_parts_and_conflicts (df) struct curr_use use; basic_block bb; - number_seen = (int *) xcalloc (get_max_uid (), sizeof (int)); - visit_trace = (struct visit_trace *) xcalloc (get_max_uid (), - sizeof (visit_trace[0])); + number_seen = xcalloc (get_max_uid (), sizeof (int)); + visit_trace = xcalloc (get_max_uid (), sizeof (visit_trace[0])); update_regnos_mentioned (); /* Here's the main loop. @@ -1252,7 +1249,7 @@ init_one_web_common (web, reg) web->orig_x = reg; if (!web->dlink) { - web->dlink = (struct dlist *) ra_calloc (sizeof (struct dlist)); + web->dlink = ra_calloc (sizeof (struct dlist)); DLIST_WEB (web->dlink) = web; } /* XXX @@ -1384,7 +1381,7 @@ add_subweb (web, reg) struct web *w; if (GET_CODE (reg) != SUBREG) abort (); - w = (struct web *) xmalloc (sizeof (struct web)); + w = xmalloc (sizeof (struct web)); /* Copy most content from parent-web. */ *w = *web; /* And initialize the private stuff. */ @@ -1519,7 +1516,7 @@ copy_conflict_list (web) for (cl = web->conflict_list; cl; cl = cl->next) { struct conflict_link *ncl; - ncl = (struct conflict_link *) ra_alloc (sizeof *ncl); + ncl = ra_alloc (sizeof *ncl); ncl->t = cl->t; ncl->sub = NULL; ncl->next = web->orig_conflict_list; @@ -1529,7 +1526,7 @@ copy_conflict_list (web) struct sub_conflict *sl, *nsl; for (sl = cl->sub; sl; sl = sl->next) { - nsl = (struct sub_conflict *) ra_alloc (sizeof *nsl); + nsl = ra_alloc (sizeof *nsl); nsl->s = sl->s; nsl->t = sl->t; nsl->next = ncl->sub; @@ -1571,7 +1568,7 @@ add_conflict_edge (from, to) copy_conflict_list (pfrom); if (!TEST_BIT (sup_igraph, (pfrom->id * num_webs + pto->id))) { - cl = (struct conflict_link *) ra_alloc (sizeof (*cl)); + cl = ra_alloc (sizeof (*cl)); cl->t = pto; cl->sub = NULL; cl->next = pfrom->conflict_list; @@ -1596,7 +1593,7 @@ add_conflict_edge (from, to) means we are not interested in this subconflict. */ if (!may_delete || cl->sub != NULL) { - sl = (struct sub_conflict *) ra_alloc (sizeof (*sl)); + sl = ra_alloc (sizeof (*sl)); sl->s = from; sl->t = to; sl->next = cl->sub; @@ -1698,8 +1695,8 @@ copy_web (web, wl) struct web *web; struct web_link **wl; { - struct web *cweb = (struct web *) xmalloc (sizeof *cweb); - struct web_link *link = (struct web_link *) ra_alloc (sizeof *link); + struct web *cweb = xmalloc (sizeof *cweb); + struct web_link *link = ra_alloc (sizeof *link); link->next = *wl; *wl = link; link->web = cweb; @@ -1776,11 +1773,9 @@ init_webs_defs_uses () continue; } if (web->num_defs) - web->defs = (struct ref **) xmalloc (web->num_defs * - sizeof (web->defs[0])); + web->defs = xmalloc (web->num_defs * sizeof (web->defs[0])); if (web->num_uses) - web->uses = (struct ref **) xmalloc (web->num_uses * - sizeof (web->uses[0])); + web->uses = xmalloc (web->num_uses * sizeof (web->uses[0])); def_i = use_i = 0; for (link = web->temp_refs; link; link = link->next) { @@ -1840,7 +1835,7 @@ parts_to_webs_1 (df, copy_webs, all_refs) allocate a new one. */ if (ra_pass == 1) { - web = (struct web *) xmalloc (sizeof (struct web)); + web = xmalloc (sizeof (struct web)); newid = last_num_webs++; init_one_web (web, GET_CODE (reg) == SUBREG ? SUBREG_REG (reg) : reg); @@ -1873,7 +1868,7 @@ parts_to_webs_1 (df, copy_webs, all_refs) else { /* Else allocate a new one. */ - web = (struct web *) xmalloc (sizeof (struct web)); + web = xmalloc (sizeof (struct web)); newid = last_num_webs++; } } @@ -2032,8 +2027,7 @@ parts_to_webs (df) num_subwebs = 0; /* First build webs and ordinary subwebs. */ - all_refs = (struct df_link *) xcalloc (df->def_id + df->use_id, - sizeof (all_refs[0])); + all_refs = xcalloc (df->def_id + df->use_id, sizeof (all_refs[0])); webnum = parts_to_webs_1 (df, ©_webs, all_refs); /* Setup the webs for hardregs which are still missing (weren't @@ -2041,7 +2035,7 @@ parts_to_webs (df) for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) if (!hardreg2web[i]) { - struct web *web = (struct web *) xmalloc (sizeof (struct web)); + struct web *web = xmalloc (sizeof (struct web)); init_one_web (web, gen_rtx_REG (reg_raw_mode[i], i)); web->id = last_num_webs++; hardreg2web[web->regno] = web; @@ -2089,7 +2083,7 @@ parts_to_webs (df) } /* Now that everyone has an ID, we can setup the id2web array. */ - id2web = (struct web **) xcalloc (webnum, sizeof (id2web[0])); + id2web = xcalloc (webnum, sizeof (id2web[0])); for (d = WEBS(INITIAL); d; d = d->next) { struct web *web = DLIST_WEB (d); @@ -2243,7 +2237,7 @@ conflicts_between_webs (df) #endif bitmap ignore_defs = BITMAP_XMALLOC (); unsigned int have_ignored; - unsigned int *pass_cache = (unsigned int *) xcalloc (num_webs, sizeof (int)); + unsigned int *pass_cache = xcalloc (num_webs, sizeof (int)); unsigned int pass = 0; if (ra_pass > 1) @@ -2831,8 +2825,7 @@ moves_to_webs (df) for (; test && test->move != m; test = test->next); if (! test) { - newml = (struct move_list*) - ra_alloc (sizeof (struct move_list)); + newml = ra_alloc (sizeof (struct move_list)); newml->move = m; newml->next = m->source_web->moves; m->source_web->moves = newml; @@ -2841,8 +2834,7 @@ moves_to_webs (df) for (; test && test->move != m; test = test->next); if (! test) { - newml = (struct move_list*) - ra_alloc (sizeof (struct move_list)); + newml = ra_alloc (sizeof (struct move_list)); newml->move = m; newml->next = m->target_web->moves; m->target_web->moves = newml; @@ -3079,10 +3071,8 @@ ra_build_realloc (df) unsigned int i; struct dlist *d; move_handled = sbitmap_alloc (get_max_uid () ); - web_parts = (struct web_part *) xcalloc (df->def_id + df->use_id, - sizeof web_parts[0]); - def2web = (struct web **) xcalloc (df->def_id + df->use_id, - sizeof def2web[0]); + web_parts = xcalloc (df->def_id + df->use_id, sizeof web_parts[0]); + def2web = xcalloc (df->def_id + df->use_id, sizeof def2web[0]); use2web = &def2web[df->def_id]; live_over_abnormal = sbitmap_alloc (df->use_id); sbitmap_zero (live_over_abnormal); @@ -3172,14 +3162,12 @@ ra_build_realloc (df) if (!last_max_uid) { /* Setup copy cache, for copy_insn_p (). */ - copy_cache = (struct copy_p_cache *) - xcalloc (get_max_uid (), sizeof (copy_cache[0])); + copy_cache = xcalloc (get_max_uid (), sizeof (copy_cache[0])); init_bb_info (); } else { - copy_cache = (struct copy_p_cache *) - xrealloc (copy_cache, get_max_uid () * sizeof (copy_cache[0])); + copy_cache = xrealloc (copy_cache, get_max_uid () * sizeof (copy_cache[0])); memset (©_cache[last_max_uid], 0, (get_max_uid () - last_max_uid) * sizeof (copy_cache[0])); } diff --git a/gcc/ra-colorize.c b/gcc/ra-colorize.c index 121cd1bbca17..07d2196749b1 100644 --- a/gcc/ra-colorize.c +++ b/gcc/ra-colorize.c @@ -348,7 +348,7 @@ build_worklists (df) unsigned int i, num, max_num; struct web **order2web; max_num = num_webs - num_subwebs; - order2web = (struct web **) xmalloc (max_num * sizeof (order2web[0])); + order2web = xmalloc (max_num * sizeof (order2web[0])); for (i = 0, num = 0; i < max_num; i++) if (id2web[i]->regno >= max_normal_pseudo) order2web[num++] = id2web[i]; @@ -397,7 +397,7 @@ build_worklists (df) if (ml->move) { struct move *m = ml->move; - d = (struct dlist *) ra_calloc (sizeof (struct dlist)); + d = ra_calloc (sizeof (struct dlist)); DLIST_MOVE (d) = m; m->dlink = d; put_move (m, WORKLIST); @@ -1702,11 +1702,10 @@ try_recolor_web (web) int newcol, c; HARD_REG_SET precolored_neighbors, spill_temps; HARD_REG_SET possible_begin, wide_seen; - cost_neighbors = (unsigned HOST_WIDE_INT *) - xcalloc (FIRST_PSEUDO_REGISTER, sizeof (cost_neighbors[0])); + cost_neighbors = xcalloc (FIRST_PSEUDO_REGISTER, sizeof (cost_neighbors[0])); /* For each hard-regs count the number of preceding hardregs, which would overlap this color, if used in WEB's mode. */ - min_color = (unsigned int *) xcalloc (FIRST_PSEUDO_REGISTER, sizeof (int)); + min_color = xcalloc (FIRST_PSEUDO_REGISTER, sizeof (int)); CLEAR_HARD_REG_SET (possible_begin); for (c = 0; c < FIRST_PSEUDO_REGISTER; c++) { @@ -1805,7 +1804,7 @@ try_recolor_web (web) remove_list (web->dlink, &WEBS(SPILLED)); put_web (web, COLORED); web->color = newcol; - old_colors = (int *) xcalloc (num_webs, sizeof (int)); + old_colors = xcalloc (num_webs, sizeof (int)); for (wl = web->conflict_list; wl; wl = wl_next) { struct web *web2 = alias (wl->t); @@ -1972,7 +1971,7 @@ recolor_spills () unsigned int i, num; struct web **order2web; num = num_webs - num_subwebs; - order2web = (struct web **) xmalloc (num * sizeof (order2web[0])); + order2web = xmalloc (num * sizeof (order2web[0])); for (i = 0; i < num; i++) { order2web[i] = id2web[i]; @@ -2431,7 +2430,7 @@ add_web_pair_cost (web1, web2, cost, conflicts) p->conflicts += conflicts; return; } - p = (struct web_pair *) ra_alloc (sizeof *p); + p = ra_alloc (sizeof *p); p->next_hash = web_pair_hash[hash]; p->next_list = web_pair_list; p->smaller = web1; @@ -2477,7 +2476,7 @@ sort_and_combine_web_pairs (for_move) struct web_pair *p; if (!num_web_pairs) return; - sorted = (struct web_pair **) xmalloc (num_web_pairs * sizeof (sorted[0])); + sorted = xmalloc (num_web_pairs * sizeof (sorted[0])); for (p = web_pair_list, i = 0; p; p = p->next_list) sorted[i++] = p; if (i != num_web_pairs) diff --git a/gcc/ra-rewrite.c b/gcc/ra-rewrite.c index 21ff034f2ba9..ef2cca1c166b 100644 --- a/gcc/ra-rewrite.c +++ b/gcc/ra-rewrite.c @@ -329,8 +329,7 @@ static void choose_spill_colors () { struct dlist *d; - unsigned HOST_WIDE_INT *costs = (unsigned HOST_WIDE_INT *) - xmalloc (FIRST_PSEUDO_REGISTER * sizeof (costs[0])); + unsigned HOST_WIDE_INT *costs = xmalloc (FIRST_PSEUDO_REGISTER * sizeof (costs[0])); for (d = WEBS(SPILLED); d; d = d->next) { struct web *web = DLIST_WEB (d); @@ -545,7 +544,7 @@ remember_slot (list, x) { struct rtx_list *l; /* PRE: X is not already in LIST. */ - l = (struct rtx_list *) ra_alloc (sizeof (*l)); + l = ra_alloc (sizeof (*l)); l->next = *list; l->x = x; *list = l; @@ -1089,7 +1088,7 @@ rewrite_program2 (new_deaths) int nl_first_reload; struct rewrite_info ri; rtx insn; - ri.needed_loads = (struct web **) xmalloc (num_webs * sizeof (struct web *)); + ri.needed_loads = xmalloc (num_webs * sizeof (struct web *)); ri.need_reload = BITMAP_XMALLOC (); ri.scratch = BITMAP_XMALLOC (); ri.live = sbitmap_alloc (num_webs); @@ -1750,7 +1749,7 @@ emit_colors (df) } ra_max_regno = max_regno = max_reg_num (); allocate_reg_info (max_regno, FALSE, FALSE); - ra_reg_renumber = (short *) xmalloc (max_regno * sizeof (short)); + ra_reg_renumber = xmalloc (max_regno * sizeof (short)); for (si = 0; si < max_regno; si++) ra_reg_renumber[si] = -1; diff --git a/gcc/ra.c b/gcc/ra.c index 45f22ced3bb3..1f24abd45d1c 100644 --- a/gcc/ra.c +++ b/gcc/ra.c @@ -375,8 +375,7 @@ alloc_mem (df) ra_build_realloc (df); if (!live_at_end) { - live_at_end = (bitmap *) xmalloc ((last_basic_block + 2) - * sizeof (bitmap)); + live_at_end = xmalloc ((last_basic_block + 2) * sizeof (bitmap)); for (i = 0; i < last_basic_block + 2; i++) live_at_end[i] = BITMAP_XMALLOC (); live_at_end += 2; @@ -907,7 +906,7 @@ reg_alloc () "after allocation/spilling, before reload", NULL); /* Allocate the reg_equiv_memory_loc array for reload. */ - reg_equiv_memory_loc = (rtx *) xcalloc (max_regno, sizeof (rtx)); + reg_equiv_memory_loc = xcalloc (max_regno, sizeof (rtx)); /* And possibly initialize it. */ allocate_initial_values (reg_equiv_memory_loc); /* And one last regclass pass just before reload. */ diff --git a/gcc/recog.c b/gcc/recog.c index a804669595b3..508baeeed3a9 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -150,8 +150,8 @@ check_asm_operands (rtx x) if (noperands == 0) return 1; - operands = (rtx *) alloca (noperands * sizeof (rtx)); - constraints = (const char **) alloca (noperands * sizeof (char *)); + operands = alloca (noperands * sizeof (rtx)); + constraints = alloca (noperands * sizeof (char *)); decode_asm_operands (x, operands, NULL, constraints, NULL); @@ -226,9 +226,7 @@ validate_change (rtx object, rtx *loc, rtx new, int in_group) else changes_allocated *= 2; - changes = - (change_t*) xrealloc (changes, - sizeof (change_t) * changes_allocated); + changes = xrealloc (changes, sizeof (change_t) * changes_allocated); } changes[num_changes].object = object; diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c index 299ba0e6501e..016c5c7c2c66 100644 --- a/gcc/reg-stack.c +++ b/gcc/reg-stack.c @@ -630,7 +630,7 @@ check_asm_stack_operands (rtx insn) if (GET_CODE (body) == PARALLEL) { - clobber_reg = (rtx *) alloca (XVECLEN (body, 0) * sizeof (rtx)); + clobber_reg = alloca (XVECLEN (body, 0) * sizeof (rtx)); for (i = 0; i < XVECLEN (body, 0); i++) if (GET_CODE (XVECEXP (body, 0, i)) == CLOBBER) @@ -1946,9 +1946,9 @@ subst_asm_stack_regs (rtx insn, stack regstack) for (i = 0, note = REG_NOTES (insn); note; note = XEXP (note, 1)) i++; - note_reg = (rtx *) alloca (i * sizeof (rtx)); - note_loc = (rtx **) alloca (i * sizeof (rtx *)); - note_kind = (enum reg_note *) alloca (i * sizeof (enum reg_note)); + note_reg = alloca (i * sizeof (rtx)); + note_loc = alloca (i * sizeof (rtx *)); + note_kind = alloca (i * sizeof (enum reg_note)); n_notes = 0; for (note = REG_NOTES (insn); note; note = XEXP (note, 1)) @@ -1979,8 +1979,8 @@ subst_asm_stack_regs (rtx insn, stack regstack) if (GET_CODE (body) == PARALLEL) { - clobber_reg = (rtx *) alloca (XVECLEN (body, 0) * sizeof (rtx)); - clobber_loc = (rtx **) alloca (XVECLEN (body, 0) * sizeof (rtx *)); + clobber_reg = alloca (XVECLEN (body, 0) * sizeof (rtx)); + clobber_loc = alloca (XVECLEN (body, 0) * sizeof (rtx *)); for (i = 0; i < XVECLEN (body, 0); i++) if (GET_CODE (XVECEXP (body, 0, i)) == CLOBBER) @@ -2800,7 +2800,7 @@ convert_regs_2 (FILE *file, basic_block block) basic_block *stack, *sp; int inserted; - stack = (basic_block *) xmalloc (sizeof (*stack) * n_basic_blocks); + stack = xmalloc (sizeof (*stack) * n_basic_blocks); sp = stack; *sp++ = block; diff --git a/gcc/regclass.c b/gcc/regclass.c index 46f8cb1a6368..b48f2e657fb6 100644 --- a/gcc/regclass.c +++ b/gcc/regclass.c @@ -311,7 +311,7 @@ init_reg_sets_1 (void) /* Compute number of hard regs in each class. */ - memset ((char *) reg_class_size, 0, sizeof reg_class_size); + memset (reg_class_size, 0, sizeof reg_class_size); for (i = 0; i < N_REG_CLASSES; i++) for (j = 0; j < FIRST_PSEUDO_REGISTER; j++) if (TEST_HARD_REG_BIT (reg_class_contents[i], j)) @@ -1202,11 +1202,11 @@ regclass (rtx f, int nregs, FILE *dump) init_recog (); - costs = (struct costs *) xmalloc (nregs * sizeof (struct costs)); + costs = xmalloc (nregs * sizeof (struct costs)); #ifdef FORBIDDEN_INC_DEC_CLASSES - in_inc_dec = (char *) xmalloc (nregs); + in_inc_dec = xmalloc (nregs); #endif /* FORBIDDEN_INC_DEC_CLASSES */ @@ -1223,7 +1223,7 @@ regclass (rtx f, int nregs, FILE *dump) fprintf (dump, "\n\nPass %i\n\n",pass); /* Zero out our accumulation of the cost of each class for each reg. */ - memset ((char *) costs, 0, nregs * sizeof (struct costs)); + memset (costs, 0, nregs * sizeof (struct costs)); #ifdef FORBIDDEN_INC_DEC_CLASSES memset (in_inc_dec, 0, nregs); @@ -1423,7 +1423,7 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops, if (*p == 0) { if (GET_CODE (op) == REG && REGNO (op) >= FIRST_PSEUDO_REGISTER) - memset ((char *) &this_op_costs[i], 0, sizeof this_op_costs[i]); + memset (&this_op_costs[i], 0, sizeof this_op_costs[i]); continue; } @@ -2162,9 +2162,9 @@ allocate_reg_info (size_t num_regs, int new_p, int renumber_p) if (!reg_n_info) { VARRAY_REG_INIT (reg_n_info, regno_allocated, "reg_n_info"); - renumber = (short *) xmalloc (size_renumber); - reg_pref_buffer = (struct reg_pref *) xmalloc (regno_allocated - * sizeof (struct reg_pref)); + renumber = xmalloc (size_renumber); + reg_pref_buffer = xmalloc (regno_allocated + * sizeof (struct reg_pref)); } else @@ -2175,23 +2175,23 @@ allocate_reg_info (size_t num_regs, int new_p, int renumber_p) { free ((char *) renumber); free ((char *) reg_pref); - renumber = (short *) xmalloc (size_renumber); - reg_pref_buffer = (struct reg_pref *) xmalloc (regno_allocated - * sizeof (struct reg_pref)); + renumber = xmalloc (size_renumber); + reg_pref_buffer = xmalloc (regno_allocated + * sizeof (struct reg_pref)); } else { - renumber = (short *) xrealloc ((char *) renumber, size_renumber); - reg_pref_buffer = (struct reg_pref *) xrealloc ((char *) reg_pref_buffer, - regno_allocated - * sizeof (struct reg_pref)); + renumber = xrealloc (renumber, size_renumber); + reg_pref_buffer = xrealloc (reg_pref_buffer, + regno_allocated + * sizeof (struct reg_pref)); } } size_info = (regno_allocated - old_allocated) * sizeof (reg_info) + sizeof (struct reg_info_data) - sizeof (reg_info); - reg_data = (struct reg_info_data *) xcalloc (size_info, 1); + reg_data = xcalloc (size_info, 1); reg_data->min_index = old_allocated; reg_data->max_index = regno_allocated - 1; reg_data->next = reg_info_head; @@ -2221,8 +2221,8 @@ allocate_reg_info (size_t num_regs, int new_p, int renumber_p) if (!reg_data->used_p) /* page just allocated with calloc */ reg_data->used_p = 1; /* no need to zero */ else - memset ((char *) ®_data->data[local_min], 0, - sizeof (reg_info) * (max - min_index - local_min + 1)); + memset (®_data->data[local_min], 0, + sizeof (reg_info) * (max - min_index - local_min + 1)); for (i = min_index+local_min; i <= max; i++) { diff --git a/gcc/regmove.c b/gcc/regmove.c index cfc45f4ee53b..435a1565cc2a 100644 --- a/gcc/regmove.c +++ b/gcc/regmove.c @@ -1055,10 +1055,10 @@ regmove_optimize (rtx f, int nregs, FILE *regmove_dump_file) can suppress some optimizations in those zones. */ mark_flags_life_zones (discover_flags_reg ()); - regno_src_regno = (int *) xmalloc (sizeof *regno_src_regno * nregs); + regno_src_regno = xmalloc (sizeof *regno_src_regno * nregs); for (i = nregs; --i >= 0; ) regno_src_regno[i] = -1; - regmove_bb_head = (int *) xmalloc (sizeof (int) * (old_max_uid + 1)); + regmove_bb_head = xmalloc (sizeof (int) * (old_max_uid + 1)); for (i = old_max_uid; i >= 0; i--) regmove_bb_head[i] = -1; FOR_EACH_BB (bb) regmove_bb_head[INSN_UID (bb->head)] = bb->index; @@ -2198,7 +2198,7 @@ record_one_stack_memref (rtx insn, rtx *mem, struct csa_memlist *next_memlist) { struct csa_memlist *ml; - ml = (struct csa_memlist *) xmalloc (sizeof (*ml)); + ml = xmalloc (sizeof (*ml)); if (XEXP (*mem, 0) == stack_pointer_rtx) ml->sp_offset = 0; diff --git a/gcc/regrename.c b/gcc/regrename.c index 719db5841b36..c1ff6255316c 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -194,7 +194,7 @@ regrename_optimize (void) memset (tick, 0, sizeof tick); gcc_obstack_init (&rename_obstack); - first_obj = (char *) obstack_alloc (&rename_obstack, 0); + first_obj = obstack_alloc (&rename_obstack, 0); FOR_EACH_BB (bb) { @@ -395,8 +395,8 @@ scan_rtx_reg (rtx insn, rtx *loc, enum reg_class class, { if (type == OP_OUT) { - struct du_chain *this = (struct du_chain *) - obstack_alloc (&rename_obstack, sizeof (struct du_chain)); + struct du_chain *this + = obstack_alloc (&rename_obstack, sizeof (struct du_chain)); this->next_use = 0; this->next_chain = open_chains; this->loc = loc; @@ -450,8 +450,7 @@ scan_rtx_reg (rtx insn, rtx *loc, enum reg_class class, be replaced with, terminate the chain. */ if (class != NO_REGS) { - this = (struct du_chain *) - obstack_alloc (&rename_obstack, sizeof (struct du_chain)); + this = obstack_alloc (&rename_obstack, sizeof (struct du_chain)); this->next_use = 0; this->next_chain = (*p)->next_chain; this->loc = loc; diff --git a/gcc/reload.c b/gcc/reload.c index a12af45f2aa8..dc088730e67b 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -651,7 +651,7 @@ get_secondary_mem (rtx x ATTRIBUTE_UNUSED, enum machine_mode mode, void clear_secondary_mem (void) { - memset ((char *) secondary_memlocs, 0, sizeof secondary_memlocs); + memset (secondary_memlocs, 0, sizeof secondary_memlocs); } #endif /* SECONDARY_MEMORY_NEEDED */ @@ -2539,7 +2539,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, /* The eliminated forms of any secondary memory locations are per-insn, so clear them out here. */ - memset ((char *) secondary_memlocs_elim, 0, sizeof secondary_memlocs_elim); + memset (secondary_memlocs_elim, 0, sizeof secondary_memlocs_elim); #endif /* Dispose quickly of (set (reg..) (reg..)) if both have hard regs and it diff --git a/gcc/reload1.c b/gcc/reload1.c index 2e152de2d28c..37cc4b280920 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -475,7 +475,7 @@ init_reload (void) /* Initialize obstack for our rtl allocation. */ gcc_obstack_init (&reload_obstack); - reload_startobj = (char *) obstack_alloc (&reload_obstack, 0); + reload_startobj = obstack_alloc (&reload_obstack, 0); INIT_REG_SET (&spilled_pseudos); INIT_REG_SET (&pseudos_counted); @@ -492,8 +492,7 @@ new_insn_chain (void) if (unused_insn_chains == 0) { - c = (struct insn_chain *) - obstack_alloc (&reload_obstack, sizeof (struct insn_chain)); + c = obstack_alloc (&reload_obstack, sizeof (struct insn_chain)); INIT_REG_SET (&c->live_throughout); INIT_REG_SET (&c->dead_or_set); } @@ -638,7 +637,7 @@ reload (rtx first, int global) failure = 0; - reload_firstobj = (char *) obstack_alloc (&reload_obstack, 0); + reload_firstobj = obstack_alloc (&reload_obstack, 0); /* Make sure that the last insn in the chain is not something that needs reloading. */ @@ -653,8 +652,8 @@ reload (rtx first, int global) #endif /* We don't have a stack slot for any spill reg yet. */ - memset ((char *) spill_stack_slot, 0, sizeof spill_stack_slot); - memset ((char *) spill_stack_slot_width, 0, sizeof spill_stack_slot_width); + memset (spill_stack_slot, 0, sizeof spill_stack_slot); + memset (spill_stack_slot_width, 0, sizeof spill_stack_slot_width); /* Initialize the save area information for caller-save, in case some are needed. */ @@ -684,17 +683,15 @@ reload (rtx first, int global) Record memory equivalents in reg_mem_equiv so they can be substituted eventually by altering the REG-rtx's. */ - reg_equiv_constant = (rtx *) xcalloc (max_regno, sizeof (rtx)); - reg_equiv_mem = (rtx *) xcalloc (max_regno, sizeof (rtx)); - reg_equiv_init = (rtx *) xcalloc (max_regno, sizeof (rtx)); - reg_equiv_address = (rtx *) xcalloc (max_regno, sizeof (rtx)); - reg_max_ref_width = (unsigned int *) xcalloc (max_regno, sizeof (int)); - reg_old_renumber = (short *) xcalloc (max_regno, sizeof (short)); + reg_equiv_constant = xcalloc (max_regno, sizeof (rtx)); + reg_equiv_mem = xcalloc (max_regno, sizeof (rtx)); + reg_equiv_init = xcalloc (max_regno, sizeof (rtx)); + reg_equiv_address = xcalloc (max_regno, sizeof (rtx)); + reg_max_ref_width = xcalloc (max_regno, sizeof (int)); + reg_old_renumber = xcalloc (max_regno, sizeof (short)); memcpy (reg_old_renumber, reg_renumber, max_regno * sizeof (short)); - pseudo_forbidden_regs - = (HARD_REG_SET *) xmalloc (max_regno * sizeof (HARD_REG_SET)); - pseudo_previous_regs - = (HARD_REG_SET *) xcalloc (max_regno, sizeof (HARD_REG_SET)); + pseudo_forbidden_regs = xmalloc (max_regno * sizeof (HARD_REG_SET)); + pseudo_previous_regs = xcalloc (max_regno, sizeof (HARD_REG_SET)); CLEAR_HARD_REG_SET (bad_spill_regs_global); @@ -819,9 +816,7 @@ reload (rtx first, int global) allocate would occasionally cause it to exceed the stack limit and cause a core dump. */ offsets_known_at = xmalloc (num_labels); - offsets_at - = (int (*)[NUM_ELIMINABLE_REGS]) - xmalloc (num_labels * NUM_ELIMINABLE_REGS * sizeof (int)); + offsets_at = xmalloc (num_labels * NUM_ELIMINABLE_REGS * sizeof (int)); /* Alter each pseudo-reg rtx to contain its hard reg number. Assign stack slots to the pseudos that lack hard regs or equivalents. @@ -953,7 +948,7 @@ reload (rtx first, int global) { save_call_clobbered_regs (); /* That might have allocated new insn_chain structures. */ - reload_firstobj = (char *) obstack_alloc (&reload_obstack, 0); + reload_firstobj = obstack_alloc (&reload_obstack, 0); } calculate_needs_all_insns (global); @@ -1381,11 +1376,10 @@ static void copy_reloads (struct insn_chain *chain) { chain->n_reloads = n_reloads; - chain->rld - = (struct reload *) obstack_alloc (&reload_obstack, - n_reloads * sizeof (struct reload)); + chain->rld = obstack_alloc (&reload_obstack, + n_reloads * sizeof (struct reload)); memcpy (chain->rld, rld, n_reloads * sizeof (struct reload)); - reload_insn_firstobj = (char *) obstack_alloc (&reload_obstack, 0); + reload_insn_firstobj = obstack_alloc (&reload_obstack, 0); } /* Walk the chain of insns, and determine for each whether it needs reloads @@ -1399,7 +1393,7 @@ calculate_needs_all_insns (int global) something_needs_elimination = 0; - reload_insn_firstobj = (char *) obstack_alloc (&reload_obstack, 0); + reload_insn_firstobj = obstack_alloc (&reload_obstack, 0); for (chain = reload_insn_chain; chain != 0; chain = next) { rtx insn = chain->insn; @@ -3442,8 +3436,7 @@ init_elim_table (void) #endif if (!reg_eliminate) - reg_eliminate = (struct elim_table *) - xcalloc (sizeof (struct elim_table), NUM_ELIMINABLE_REGS); + reg_eliminate = xcalloc (sizeof (struct elim_table), NUM_ELIMINABLE_REGS); /* Does this function require a frame pointer? */ @@ -3589,7 +3582,7 @@ finish_spills (int global) /* Retry global register allocation if possible. */ if (global) { - memset ((char *) pseudo_forbidden_regs, 0, max_regno * sizeof (HARD_REG_SET)); + memset (pseudo_forbidden_regs, 0, max_regno * sizeof (HARD_REG_SET)); /* For every insn that needs reloads, set the registers used as spill regs in pseudo_forbidden_regs for every pseudo live across the insn. */ @@ -3759,10 +3752,10 @@ reload_as_needed (int live_known) #endif rtx x; - memset ((char *) spill_reg_rtx, 0, sizeof spill_reg_rtx); - memset ((char *) spill_reg_store, 0, sizeof spill_reg_store); - reg_last_reload_reg = (rtx *) xcalloc (max_regno, sizeof (rtx)); - reg_has_output_reload = (char *) xmalloc (max_regno); + memset (spill_reg_rtx, 0, sizeof spill_reg_rtx); + memset (spill_reg_store, 0, sizeof spill_reg_store); + reg_last_reload_reg = xcalloc (max_regno, sizeof (rtx)); + reg_has_output_reload = xmalloc (max_regno); CLEAR_HARD_REG_SET (reg_reloaded_valid); set_initial_elim_offsets (); @@ -5156,8 +5149,8 @@ choose_reload_regs_init (struct insn_chain *chain, rtx *save_reload_reg_rtx) rld[i].reg_rtx = save_reload_reg_rtx[i]; memset (reload_inherited, 0, MAX_RELOADS); - memset ((char *) reload_inheritance_insn, 0, MAX_RELOADS * sizeof (rtx)); - memset ((char *) reload_override_in, 0, MAX_RELOADS * sizeof (rtx)); + memset (reload_inheritance_insn, 0, MAX_RELOADS * sizeof (rtx)); + memset (reload_override_in, 0, MAX_RELOADS * sizeof (rtx)); CLEAR_HARD_REG_SET (reload_reg_used); CLEAR_HARD_REG_SET (reload_reg_used_at_all); diff --git a/gcc/reorg.c b/gcc/reorg.c index 9a7c05bc7f18..3d7159daa7c9 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -3587,7 +3587,7 @@ dbr_schedule (rtx first, FILE *file) epilogue_insn = insn; } - uid_to_ruid = (int *) xmalloc ((max_uid + 1) * sizeof (int)); + uid_to_ruid = xmalloc ((max_uid + 1) * sizeof (int)); for (i = 0, insn = first; insn; i++, insn = NEXT_INSN (insn)) uid_to_ruid[INSN_UID (insn)] = i; @@ -3595,7 +3595,7 @@ dbr_schedule (rtx first, FILE *file) if (unfilled_firstobj == 0) { gcc_obstack_init (&unfilled_slots_obstack); - unfilled_firstobj = (rtx *) obstack_alloc (&unfilled_slots_obstack, 0); + unfilled_firstobj = obstack_alloc (&unfilled_slots_obstack, 0); } for (insn = next_active_insn (first); insn; insn = next_active_insn (insn)) @@ -3629,8 +3629,8 @@ dbr_schedule (rtx first, FILE *file) end_of_function_label = 0; /* Initialize the statistics for this function. */ - memset ((char *) num_insns_needing_delays, 0, sizeof num_insns_needing_delays); - memset ((char *) num_filled_delays, 0, sizeof num_filled_delays); + memset (num_insns_needing_delays, 0, sizeof num_insns_needing_delays); + memset (num_filled_delays, 0, sizeof num_filled_delays); /* Now do the delay slot filling. Try everything twice in case earlier changes make more slots fillable. */ @@ -3670,7 +3670,7 @@ dbr_schedule (rtx first, FILE *file) obstack_free (&unfilled_slots_obstack, unfilled_firstobj); /* It is not clear why the line below is needed, but it does seem to be. */ - unfilled_firstobj = (rtx *) obstack_alloc (&unfilled_slots_obstack, 0); + unfilled_firstobj = obstack_alloc (&unfilled_slots_obstack, 0); if (file) { @@ -3703,8 +3703,8 @@ dbr_schedule (rtx first, FILE *file) fprintf (file, "\n"); } } - memset ((char *) total_delay_slots, 0, sizeof total_delay_slots); - memset ((char *) total_annul_slots, 0, sizeof total_annul_slots); + memset (total_delay_slots, 0, sizeof total_delay_slots); + memset (total_annul_slots, 0, sizeof total_annul_slots); for (insn = first; insn; insn = NEXT_INSN (insn)) { if (! INSN_DELETED_P (insn) diff --git a/gcc/resource.c b/gcc/resource.c index 4d4cc6be50f8..2aab94c525d4 100644 --- a/gcc/resource.c +++ b/gcc/resource.c @@ -947,7 +947,7 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res) { /* Allocate a place to put our results and chain it into the hash table. */ - tinfo = (struct target_info *) xmalloc (sizeof (struct target_info)); + tinfo = xmalloc (sizeof (struct target_info)); tinfo->uid = INSN_UID (target); tinfo->block = b; tinfo->next @@ -1223,9 +1223,8 @@ init_resource_info (rtx epilogue_insn) MARK_SRC_DEST_CALL); /* Allocate and initialize the tables used by mark_target_live_regs. */ - target_hash_table = (struct target_info **) - xcalloc (TARGET_HASH_PRIME, sizeof (struct target_info *)); - bb_ticks = (int *) xcalloc (last_basic_block, sizeof (int)); + target_hash_table = xcalloc (TARGET_HASH_PRIME, sizeof (struct target_info *)); + bb_ticks = xcalloc (last_basic_block, sizeof (int)); } /* Free up the resources allocated to mark_target_live_regs (). This diff --git a/gcc/sbitmap.c b/gcc/sbitmap.c index 508eca3eabe0..3cec45de6278 100644 --- a/gcc/sbitmap.c +++ b/gcc/sbitmap.c @@ -41,7 +41,7 @@ sbitmap_alloc (unsigned int n_elms) bytes = size * sizeof (SBITMAP_ELT_TYPE); amt = (sizeof (struct simple_bitmap_def) + bytes - sizeof (SBITMAP_ELT_TYPE)); - bmap = (sbitmap) xmalloc (amt); + bmap = xmalloc (amt); bmap->n_bits = n_elms; bmap->size = size; bmap->bytes = bytes; @@ -64,7 +64,7 @@ sbitmap_resize (sbitmap bmap, unsigned int n_elms, int def) { amt = (sizeof (struct simple_bitmap_def) + bytes - sizeof (SBITMAP_ELT_TYPE)); - bmap = (sbitmap) xrealloc (bmap, amt); + bmap = xrealloc (bmap, amt); } if (n_elms > bmap->n_bits) @@ -130,7 +130,7 @@ sbitmap_vector_alloc (unsigned int n_vecs, unsigned int n_elms) } amt = vector_bytes + (n_vecs * elm_bytes); - bitmap_vector = (sbitmap *) xmalloc (amt); + bitmap_vector = xmalloc (amt); for (i = 0, offset = vector_bytes; i < n_vecs; i++, offset += elm_bytes) { diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index f2d4fe6cbc6f..1a41e9989c90 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -1390,8 +1390,7 @@ init_deps (struct deps *deps) int max_reg = (reload_completed ? FIRST_PSEUDO_REGISTER : max_reg_num ()); deps->max_reg = max_reg; - deps->reg_last = (struct deps_reg *) - xcalloc (max_reg, sizeof (struct deps_reg)); + deps->reg_last = xcalloc (max_reg, sizeof (struct deps_reg)); INIT_REG_SET (&deps->reg_last_in_use); INIT_REG_SET (&deps->reg_conditional_sets); diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c index 61ab0565dbe2..cb5e52d48a65 100644 --- a/gcc/sched-rgn.c +++ b/gcc/sched-rgn.c @@ -398,9 +398,9 @@ build_control_flow (struct edge_list *edge_list) } /* ??? We can kill these soon. */ - in_edges = (int *) xcalloc (last_basic_block, sizeof (int)); - out_edges = (int *) xcalloc (last_basic_block, sizeof (int)); - edge_table = (haifa_edge *) xcalloc (num_edges, sizeof (haifa_edge)); + in_edges = xcalloc (last_basic_block, sizeof (int)); + out_edges = xcalloc (last_basic_block, sizeof (int)); + edge_table = xcalloc (num_edges, sizeof (haifa_edge)); nr_edges = 0; for (i = 0; i < num_edges; i++) @@ -650,9 +650,9 @@ find_rgns (struct edge_list *edge_list, dominance_info dom) STACK, SP and DFS_NR are only used during the first traversal. */ /* Allocate and initialize variables for the first traversal. */ - max_hdr = (int *) xmalloc (last_basic_block * sizeof (int)); - dfs_nr = (int *) xcalloc (last_basic_block, sizeof (int)); - stack = (int *) xmalloc (nr_edges * sizeof (int)); + max_hdr = xmalloc (last_basic_block * sizeof (int)); + dfs_nr = xcalloc (last_basic_block, sizeof (int)); + stack = xmalloc (nr_edges * sizeof (int)); inner = sbitmap_alloc (last_basic_block); sbitmap_ones (inner); @@ -796,7 +796,7 @@ find_rgns (struct edge_list *edge_list, dominance_info dom) /* Second traversal:find reducible inner loops and topologically sort block of each region. */ - queue = (int *) xmalloc (n_basic_blocks * sizeof (int)); + queue = xmalloc (n_basic_blocks * sizeof (int)); /* Find blocks which are inner loop headers. We still have non-reducible loops to consider at this point. */ @@ -1117,7 +1117,7 @@ compute_dom_prob_ps (int bb) static void split_edges (int bb_src, int bb_trg, edgelst *bl) { - sbitmap src = (edgeset) sbitmap_alloc (pot_split[bb_src]->n_bits); + sbitmap src = sbitmap_alloc (pot_split[bb_src]->n_bits); sbitmap_copy (src, pot_split[bb_src]); sbitmap_difference (src, src, pot_split[bb_trg]); @@ -1181,7 +1181,7 @@ compute_trg_info (int trg) add the TO block to the update block list. This list can end up with a lot of duplicates. We need to weed them out to avoid overrunning the end of the bblst_table. */ - update_blocks = (char *) alloca (last_basic_block); + update_blocks = alloca (last_basic_block); memset (update_blocks, 0, last_basic_block); update_idx = 0; @@ -1734,8 +1734,7 @@ init_ready_list (struct ready_list *ready) /* Prepare current target block info. */ if (current_nr_blocks > 1) { - candidate_table = (candidate *) xmalloc (current_nr_blocks - * sizeof (candidate)); + candidate_table = xmalloc (current_nr_blocks * sizeof (candidate)); bblst_last = 0; /* bblst_table holds split blocks and update blocks for each block after @@ -1743,10 +1742,10 @@ init_ready_list (struct ready_list *ready) the TO blocks of region edges, so there can be at most rgn_nr_edges of them. */ bblst_size = (current_nr_blocks - target_bb) * rgn_nr_edges; - bblst_table = (int *) xmalloc (bblst_size * sizeof (int)); + bblst_table = xmalloc (bblst_size * sizeof (int)); bitlst_table_last = 0; - bitlst_table = (int *) xmalloc (rgn_nr_edges * sizeof (int)); + bitlst_table = xmalloc (rgn_nr_edges * sizeof (int)); compute_trg_info (target_bb); } @@ -2388,7 +2387,7 @@ schedule_region (int rgn) init_deps_global (); /* Initializations for region data dependence analysis. */ - bb_deps = (struct deps *) xmalloc (sizeof (struct deps) * current_nr_blocks); + bb_deps = xmalloc (sizeof (struct deps) * current_nr_blocks); for (bb = 0; bb < current_nr_blocks; bb++) init_deps (bb_deps + bb); @@ -2423,17 +2422,17 @@ schedule_region (int rgn) { int i; - prob = (float *) xmalloc ((current_nr_blocks) * sizeof (float)); + prob = xmalloc ((current_nr_blocks) * sizeof (float)); dom = sbitmap_vector_alloc (current_nr_blocks, current_nr_blocks); sbitmap_vector_zero (dom, current_nr_blocks); /* Edge to bit. */ rgn_nr_edges = 0; - edge_to_bit = (int *) xmalloc (nr_edges * sizeof (int)); + edge_to_bit = xmalloc (nr_edges * sizeof (int)); for (i = 1; i < nr_edges; i++) if (CONTAINING_RGN (FROM_BLOCK (i)) == rgn) EDGE_TO_BIT (i) = rgn_nr_edges++; - rgn_edges = (int *) xmalloc (rgn_nr_edges * sizeof (int)); + rgn_edges = xmalloc (rgn_nr_edges * sizeof (int)); rgn_nr_edges = 0; for (i = 1; i < nr_edges; i++) @@ -2564,10 +2563,10 @@ init_regions (void) int rgn; nr_regions = 0; - rgn_table = (region *) xmalloc ((n_basic_blocks) * sizeof (region)); - rgn_bb_table = (int *) xmalloc ((n_basic_blocks) * sizeof (int)); - block_to_bb = (int *) xmalloc ((last_basic_block) * sizeof (int)); - containing_rgn = (int *) xmalloc ((last_basic_block) * sizeof (int)); + rgn_table = xmalloc ((n_basic_blocks) * sizeof (region)); + rgn_bb_table = xmalloc ((n_basic_blocks) * sizeof (int)); + block_to_bb = xmalloc ((last_basic_block) * sizeof (int)); + containing_rgn = xmalloc ((last_basic_block) * sizeof (int)); /* Compute regions for scheduling. */ if (reload_completed @@ -2621,7 +2620,7 @@ init_regions (void) if (CHECK_DEAD_NOTES) { blocks = sbitmap_alloc (last_basic_block); - deaths_in_region = (int *) xmalloc (sizeof (int) * nr_regions); + deaths_in_region = xmalloc (sizeof (int) * nr_regions); /* Remove all death notes from the subroutine. */ for (rgn = 0; rgn < nr_regions; rgn++) { diff --git a/gcc/sched-vis.c b/gcc/sched-vis.c index 91f25e79b88c..55741d14c0be 100644 --- a/gcc/sched-vis.c +++ b/gcc/sched-vis.c @@ -134,7 +134,7 @@ get_visual_tbl_length (void) } /* Compute length of one field in line. */ - s = (char *) alloca (INSN_LEN + 6); + s = alloca (INSN_LEN + 6); sprintf (s, " %33s", "uname"); n1 = strlen (s); diff --git a/gcc/sdbout.c b/gcc/sdbout.c index 54dcc799f40f..5d1a3d56c2b7 100644 --- a/gcc/sdbout.c +++ b/gcc/sdbout.c @@ -1452,7 +1452,7 @@ sdbout_finish (const char *main_filename ATTRIBUTE_UNUSED) { tree decl = (*lang_hooks.decls.getdecls) (); unsigned int len = list_length (decl); - tree *vec = (tree *) xmalloc (sizeof (tree) * len); + tree *vec = xmalloc (sizeof (tree) * len); unsigned int i; /* Process the decls in reverse order--earliest first. Put them @@ -1645,7 +1645,7 @@ sdbout_start_source_file (unsigned int line ATTRIBUTE_UNUSED, const char *filename ATTRIBUTE_UNUSED) { #ifdef MIPS_DEBUGGING_INFO - struct sdb_file *n = (struct sdb_file *) xmalloc (sizeof *n); + struct sdb_file *n = xmalloc (sizeof *n); n->next = current_file; n->name = filename; @@ -1675,7 +1675,7 @@ static void sdbout_init (const char *input_file_name ATTRIBUTE_UNUSED) { #ifdef MIPS_DEBUGGING_INFO - current_file = (struct sdb_file *) xmalloc (sizeof *current_file); + current_file = xmalloc (sizeof *current_file); current_file->next = NULL; current_file->name = input_file_name; #endif diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index d4b51627ca30..84127daebceb 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -1907,7 +1907,7 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0, int first, negate, changed; int i, j; - memset ((char *) ops, 0, sizeof ops); + memset (ops, 0, sizeof ops); /* Set up the two operands and then expand them until nothing has been changed. If we run out of room in our array, give up; this should diff --git a/gcc/ssa-ccp.c b/gcc/ssa-ccp.c index c093cc463e74..7ff305a9d3d2 100644 --- a/gcc/ssa-ccp.c +++ b/gcc/ssa-ccp.c @@ -989,7 +989,7 @@ ssa_const_prop (void) edges = create_edge_list (); /* Initialize the values array with everything as undefined. */ - values = (value *) xmalloc (VARRAY_SIZE (ssa_definition) * sizeof (value)); + values = xmalloc (VARRAY_SIZE (ssa_definition) * sizeof (value)); for (i = 0; i < VARRAY_SIZE (ssa_definition); i++) { if (i < FIRST_PSEUDO_REGISTER) @@ -1008,7 +1008,7 @@ ssa_const_prop (void) executable_edges = sbitmap_alloc (NUM_EDGES (edges)); sbitmap_zero (executable_edges); - edge_info = (edge *) xmalloc (NUM_EDGES (edges) * sizeof (edge)); + edge_info = xmalloc (NUM_EDGES (edges) * sizeof (edge)); flow_edges = ENTRY_BLOCK_PTR->succ; /* Add the successors of the entry block to the edge worklist. That diff --git a/gcc/ssa.c b/gcc/ssa.c index 1e36290491c6..c12cdbe7afb4 100644 --- a/gcc/ssa.c +++ b/gcc/ssa.c @@ -253,8 +253,7 @@ ssa_rename_from_lookup (int reg) ssa_rename_from_pair *answer; srfp.reg = reg; srfp.original = NULL_RTX; - answer = (ssa_rename_from_pair *) - htab_find_with_hash (ssa_rename_from_ht, (void *) &srfp, reg); + answer = htab_find_with_hash (ssa_rename_from_ht, (void *) &srfp, reg); return (answer == 0 ? NULL_RTX : answer->original); } @@ -673,7 +672,7 @@ static void create_delayed_rename (struct rename_context *c, rtx *reg_loc) { struct rename_set_data *r; - r = (struct rename_set_data *) xmalloc (sizeof(*r)); + r = xmalloc (sizeof(*r)); if (GET_CODE (*reg_loc) != REG || !CONVERT_REGISTER_TO_SSA_P (REGNO (*reg_loc))) @@ -1064,10 +1063,10 @@ rename_registers (int nregs, dominance_info idom) VARRAY_RTX_INIT (ssa_definition, nregs * 3, "ssa_definition"); ssa_rename_from_initialize (); - ssa_rename_to_pseudo = (rtx *) alloca (nregs * sizeof(rtx)); - memset ((char *) ssa_rename_to_pseudo, 0, nregs * sizeof(rtx)); - memset ((char *) ssa_rename_to_hard, 0, - FIRST_PSEUDO_REGISTER * NUM_MACHINE_MODES * sizeof (rtx)); + ssa_rename_to_pseudo = alloca (nregs * sizeof(rtx)); + memset (ssa_rename_to_pseudo, 0, nregs * sizeof(rtx)); + memset (ssa_rename_to_hard, 0, + FIRST_PSEUDO_REGISTER * NUM_MACHINE_MODES * sizeof (rtx)); rename_block (0, idom); @@ -1313,7 +1312,7 @@ eliminate_phi (edge e, partition reg_partition) present in Phi(B). There is an edge from FIND(T0)->FIND(T1) for each T0 = PHI(...,T1,...), where T1 is for the edge from block C. */ - nodes = (rtx *) alloca (n_nodes * sizeof(rtx)); + nodes = alloca (n_nodes * sizeof(rtx)); pred = sbitmap_vector_alloc (n_nodes, n_nodes); succ = sbitmap_vector_alloc (n_nodes, n_nodes); sbitmap_vector_zero (pred, n_nodes); @@ -1362,7 +1361,7 @@ eliminate_phi (edge e, partition reg_partition) visited = sbitmap_alloc (n_nodes); sbitmap_zero (visited); - tstack = stack = (int *) alloca (n_nodes * sizeof (int)); + tstack = stack = alloca (n_nodes * sizeof (int)); for (i = 0; i < n_nodes; ++i) if (! TEST_BIT (visited, i)) diff --git a/gcc/stmt.c b/gcc/stmt.c index 09c282de6c6d..7dba03013d26 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -252,8 +252,7 @@ struct nesting GTY(()) /* Allocate and return a new `struct nesting'. */ -#define ALLOC_NESTING() \ - (struct nesting *) ggc_alloc (sizeof (struct nesting)) +#define ALLOC_NESTING() ggc_alloc (sizeof (struct nesting)) /* Pop the nesting stack element by element until we pop off the element which is at the top of STACK. @@ -434,7 +433,7 @@ using_eh_for_cleanups (void) void init_stmt_for_function (void) { - cfun->stmt = ((struct stmt_status *)ggc_alloc (sizeof (struct stmt_status))); + cfun->stmt =ggc_alloc (sizeof (struct stmt_status)); /* We are not currently within any block, conditional, loop or case. */ block_stack = 0; @@ -588,7 +587,7 @@ expand_label (tree label) if (stack_block_stack != 0) { - p = (struct label_chain *) ggc_alloc (sizeof (struct label_chain)); + p = ggc_alloc (sizeof (struct label_chain)); p->next = stack_block_stack->data.block.label_chain; stack_block_stack->data.block.label_chain = p; p->label = label; @@ -851,8 +850,7 @@ expand_fixup (tree tree_label, rtx rtl_label, rtx last_insn) if (block != end_block) { /* Ok, a fixup is needed. Add a fixup to the list of such. */ - struct goto_fixup *fixup - = (struct goto_fixup *) ggc_alloc (sizeof (struct goto_fixup)); + struct goto_fixup *fixup = ggc_alloc (sizeof (struct goto_fixup)); /* In case an old stack level is restored, make sure that comes after any pending stack adjust. */ /* ?? If the fixup isn't to come at the present position, @@ -1471,13 +1469,13 @@ expand_asm_operands (tree string, tree outputs, tree inputs, tree t; int i; /* Vector of RTX's of evaluated output operands. */ - rtx *output_rtx = (rtx *) alloca (noutputs * sizeof (rtx)); - int *inout_opnum = (int *) alloca (noutputs * sizeof (int)); - rtx *real_output_rtx = (rtx *) alloca (noutputs * sizeof (rtx)); + rtx *output_rtx = alloca (noutputs * sizeof (rtx)); + int *inout_opnum = alloca (noutputs * sizeof (int)); + rtx *real_output_rtx = alloca (noutputs * sizeof (rtx)); enum machine_mode *inout_mode - = (enum machine_mode *) alloca (noutputs * sizeof (enum machine_mode)); + = alloca (noutputs * sizeof (enum machine_mode)); const char **constraints - = (const char **) alloca ((noutputs + ninputs) * sizeof (const char *)); + = alloca ((noutputs + ninputs) * sizeof (const char *)); int old_generating_concat_p = generating_concat_p; /* An ASM with no outputs needs to be treated as volatile, for now. */ @@ -3082,7 +3080,7 @@ expand_return (tree retval) int n_regs = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD; unsigned int bitsize = MIN (TYPE_ALIGN (TREE_TYPE (retval_rhs)), BITS_PER_WORD); - rtx *result_pseudos = (rtx *) alloca (sizeof (rtx) * n_regs); + rtx *result_pseudos = alloca (sizeof (rtx) * n_regs); rtx result_reg, src = NULL_RTX, dst = NULL_RTX; rtx result_val = expand_expr (retval_rhs, NULL_RTX, VOIDmode, 0); enum machine_mode tmpmode, result_reg_mode; @@ -3257,7 +3255,7 @@ tail_recursion_args (tree actuals, tree formals) /* Compute all the actuals. */ - argvec = (rtx *) alloca (i * sizeof (rtx)); + argvec = alloca (i * sizeof (rtx)); for (a = actuals, i = 0; a; a = TREE_CHAIN (a), i++) argvec[i] = expand_expr (TREE_VALUE (a), NULL_RTX, VOIDmode, 0); @@ -4592,7 +4590,7 @@ add_case_node (tree low, tree high, tree label, tree *duplicate) /* Add this label to the chain, and succeed. */ - r = (struct case_node *) ggc_alloc (sizeof (struct case_node)); + r = ggc_alloc (sizeof (struct case_node)); r->low = low; /* If the bounds are equal, turn this into the one-value case. */ @@ -5025,8 +5023,7 @@ check_for_full_enumeration_handling (tree type) /* We deliberately use calloc here, not cmalloc, so that we can suppress this optimization if we don't have enough memory rather than aborting, as xmalloc would do. */ - && (cases_seen = - (unsigned char *) really_call_calloc (bytes_needed, 1)) != NULL) + && (cases_seen = really_call_calloc (bytes_needed, 1)) != NULL) { HOST_WIDE_INT i; tree v = TYPE_VALUES (type); @@ -5540,8 +5537,8 @@ expand_end_case_type (tree orig_index, tree orig_type) /* Get table of labels to jump to, in order of case index. */ ncases = tree_low_cst (range, 0) + 1; - labelvec = (rtx *) alloca (ncases * sizeof (rtx)); - memset ((char *) labelvec, 0, ncases * sizeof (rtx)); + labelvec = alloca (ncases * sizeof (rtx)); + memset (labelvec, 0, ncases * sizeof (rtx)); for (n = thiscase->data.case_stmt.case_list; n; n = n->right) { diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 061eec4c4340..041fe6257c9f 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -553,8 +553,7 @@ set_lang_adjust_rli (void (*f) (record_layout_info)) record_layout_info start_record_layout (tree t) { - record_layout_info rli - = (record_layout_info) xmalloc (sizeof (struct record_layout_info_s)); + record_layout_info rli = xmalloc (sizeof (struct record_layout_info_s)); rli->t = t; diff --git a/gcc/timevar.c b/gcc/timevar.c index 6fa1610cc5d3..9746488c649b 100644 --- a/gcc/timevar.c +++ b/gcc/timevar.c @@ -226,7 +226,7 @@ timevar_init (void) timevar_enable = true; /* Zero all elapsed times. */ - memset ((void *) timevars, 0, sizeof (timevars)); + memset (timevars, 0, sizeof (timevars)); /* Initialize the names of timing variables. */ #define DEFTIMEVAR(identifier__, name__) \ @@ -286,8 +286,7 @@ timevar_push (timevar_id_t timevar) unused_stack_instances = unused_stack_instances->next; } else - context = (struct timevar_stack_def *) - xmalloc (sizeof (struct timevar_stack_def)); + context = xmalloc (sizeof (struct timevar_stack_def)); /* Fill it in and put it on the stack. */ context->timevar = tv; diff --git a/gcc/tlink.c b/gcc/tlink.c index d377c7592dc7..6406615b5e3e 100644 --- a/gcc/tlink.c +++ b/gcc/tlink.c @@ -192,7 +192,7 @@ struct file_stack_entry *file_stack; static void symbol_push (symbol *p) { - struct symbol_stack_entry *ep = (struct symbol_stack_entry *) obstack_alloc + struct symbol_stack_entry *ep = obstack_alloc (&symbol_stack_obstack, sizeof (struct symbol_stack_entry)); ep->value = p; ep->next = symbol_stack; @@ -220,7 +220,7 @@ file_push (file *p) if (p->tweaking) return; - ep = (struct file_stack_entry *) obstack_alloc + ep = obstack_alloc (&file_stack_obstack, sizeof (struct file_stack_entry)); ep->value = p; ep->next = file_stack; diff --git a/gcc/toplev.c b/gcc/toplev.c index 3bf601113a9c..93fc1856714b 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1706,7 +1706,7 @@ push_srcloc (const char *file, int line) { struct file_stack *fs; - fs = (struct file_stack *) xmalloc (sizeof (struct file_stack)); + fs = xmalloc (sizeof (struct file_stack)); fs->location = input_location; fs->next = input_file_stack; input_filename = file; @@ -2135,7 +2135,7 @@ rest_of_handle_old_regalloc (tree decl, rtx insns, int *rebuild_notes) allocate_reg_info (max_regno, FALSE, TRUE); /* And the reg_equiv_memory_loc array. */ - reg_equiv_memory_loc = (rtx *) xcalloc (max_regno, sizeof (rtx)); + reg_equiv_memory_loc = xcalloc (max_regno, sizeof (rtx)); allocate_initial_values (reg_equiv_memory_loc); @@ -4053,7 +4053,7 @@ init_asm_output (const char *name) if (asm_file_name == 0) { int len = strlen (dump_base_name); - char *dumpname = (char *) xmalloc (len + 6); + char *dumpname = xmalloc (len + 6); memcpy (dumpname, dump_base_name, len + 1); strip_off_ending (dumpname, len); strcat (dumpname, ".s"); @@ -4068,7 +4068,7 @@ init_asm_output (const char *name) } #ifdef IO_BUFFER_SIZE - setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE), + setvbuf (asm_out_file, xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE); #endif diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c index c6e92e65c1ff..c3696336c446 100644 --- a/gcc/tree-dump.c +++ b/gcc/tree-dump.c @@ -57,10 +57,10 @@ queue (dump_info_p di, tree t, int flags) di->free_list = dq->next; } else - dq = (dump_queue_p) xmalloc (sizeof (struct dump_queue)); + dq = xmalloc (sizeof (struct dump_queue)); /* Create a new entry in the splay-tree. */ - dni = (dump_node_info_p) xmalloc (sizeof (struct dump_node_info)); + dni = xmalloc (sizeof (struct dump_node_info)); dni->index = index; dni->binfo_p = ((flags & DUMP_BINFO) != 0); dq->node = splay_tree_insert (di->nodes, (splay_tree_key) t, diff --git a/gcc/tree.c b/gcc/tree.c index c9a7bcf72401..5590598148e1 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -494,7 +494,7 @@ real_value_from_int_cst (tree type ATTRIBUTE_UNUSED, tree i) /* Clear all bits of the real value type so that we can later do bitwise comparisons to see if two values are the same. */ - memset ((char *) &d, 0, sizeof d); + memset (&d, 0, sizeof d); if (! TREE_UNSIGNED (TREE_TYPE (i))) REAL_VALUE_FROM_INT (d, TREE_INT_CST_LOW (i), TREE_INT_CST_HIGH (i), @@ -2985,7 +2985,7 @@ type_hash_add (unsigned int hashcode, tree type) struct type_hash *h; void **loc; - h = (struct type_hash *) ggc_alloc (sizeof (struct type_hash)); + h = ggc_alloc (sizeof (struct type_hash)); h->hash = hashcode; h->type = type; loc = htab_find_slot_with_hash (type_hash_table, h, hashcode, INSERT); @@ -4517,7 +4517,7 @@ get_file_function_name_long (const char *type) file = input_filename; len = strlen (file); - q = (char *) alloca (9 * 2 + len); + q = alloca (9 * 2 + len); memcpy (q, file, len + 1); clean_symbol_name (q); @@ -4527,8 +4527,7 @@ get_file_function_name_long (const char *type) p = q; } - buf = (char *) alloca (sizeof (FILE_FUNCTION_FORMAT) + strlen (p) - + strlen (type)); + buf = alloca (sizeof (FILE_FUNCTION_FORMAT) + strlen (p) + strlen (type)); /* Set up the name of the file-level functions we may need. Use a global object (which is already required to be unique over @@ -4623,7 +4622,7 @@ get_set_constructor_bytes (tree init, unsigned char *buffer, int wd_size) int bit_size = wd_size * set_word_size; int bit_pos = 0; unsigned char *bytep = buffer; - char *bit_buffer = (char *) alloca (bit_size); + char *bit_buffer = alloca (bit_size); tree non_const_bits = get_set_constructor_bits (init, bit_buffer, bit_size); for (i = 0; i < wd_size; i++) diff --git a/gcc/unroll.c b/gcc/unroll.c index e557cb2c1e59..62b8152daf46 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -671,14 +671,14 @@ unroll_loop (struct loop *loop, int insn_count, int strength_reduce_p) without initializing fields within the map structure. To be safe, we use xcalloc to zero the memory. */ - map = (struct inline_remap *) xcalloc (1, sizeof (struct inline_remap)); + map = xcalloc (1, sizeof (struct inline_remap)); /* Allocate the label map. */ if (max_labelno > 0) { - map->label_map = (rtx *) xcalloc (max_labelno, sizeof (rtx)); - local_label = (char *) xcalloc (max_labelno, sizeof (char)); + map->label_map = xcalloc (max_labelno, sizeof (rtx)); + local_label = xcalloc (max_labelno, sizeof (char)); } /* Search the loop and mark all local labels, i.e. the ones which have to @@ -722,7 +722,7 @@ unroll_loop (struct loop *loop, int insn_count, int strength_reduce_p) /* Allocate space for the insn map. */ - map->insn_map = (rtx *) xmalloc (max_insnno * sizeof (rtx)); + map->insn_map = xmalloc (max_insnno * sizeof (rtx)); /* Set this to zero, to indicate that we are doing loop unrolling, not function inlining. */ @@ -748,11 +748,10 @@ unroll_loop (struct loop *loop, int insn_count, int strength_reduce_p) preconditioning code and find_splittable_regs will never be used to access the splittable_regs[] and addr_combined_regs[] arrays. */ - splittable_regs = (rtx *) xcalloc (maxregnum, sizeof (rtx)); - splittable_regs_updates = (int *) xcalloc (maxregnum, sizeof (int)); - addr_combined_regs - = (struct induction **) xcalloc (maxregnum, sizeof (struct induction *)); - local_regno = (char *) xcalloc (maxregnum, sizeof (char)); + splittable_regs = xcalloc (maxregnum, sizeof (rtx)); + splittable_regs_updates = xcalloc (maxregnum, sizeof (int)); + addr_combined_regs = xcalloc (maxregnum, sizeof (struct induction *)); + local_regno = xcalloc (maxregnum, sizeof (char)); /* Mark all local registers, i.e. the ones which are referenced only inside the loop. */ @@ -854,7 +853,7 @@ unroll_loop (struct loop *loop, int insn_count, int strength_reduce_p) int less_p = (cc == LE || cc == LEU || cc == LT || cc == LTU); int unsigned_p = (cc == LEU || cc == GEU || cc == LTU || cc == GTU); - map->reg_map = (rtx *) xmalloc (maxregnum * sizeof (rtx)); + map->reg_map = xmalloc (maxregnum * sizeof (rtx)); VARRAY_CONST_EQUIV_INIT (map->const_equiv_varray, maxregnum, "unroll_loop_precondition"); @@ -921,7 +920,7 @@ unroll_loop (struct loop *loop, int insn_count, int strength_reduce_p) /* Now emit a sequence of branches to jump to the proper precond loop entry point. */ - labels = (rtx *) xmalloc (sizeof (rtx) * unroll_number); + labels = xmalloc (sizeof (rtx) * unroll_number); for (i = 0; i < unroll_number; i++) labels[i] = gen_label_rtx (); @@ -1054,8 +1053,8 @@ unroll_loop (struct loop *loop, int insn_count, int strength_reduce_p) emit_label_after (labels[unroll_number - i], PREV_INSN (loop_start)); - memset ((char *) map->insn_map, 0, max_insnno * sizeof (rtx)); - memset ((char *) &VARRAY_CONST_EQUIV (map->const_equiv_varray, 0), + memset (map->insn_map, 0, max_insnno * sizeof (rtx)); + memset (&VARRAY_CONST_EQUIV (map->const_equiv_varray, 0), 0, (VARRAY_SIZE (map->const_equiv_varray) * sizeof (struct const_equiv_data))); map->const_age = 0; @@ -1158,7 +1157,7 @@ unroll_loop (struct loop *loop, int insn_count, int strength_reduce_p) the constant maps also. */ maxregnum = max_reg_num (); - map->reg_map = (rtx *) xmalloc (maxregnum * sizeof (rtx)); + map->reg_map = xmalloc (maxregnum * sizeof (rtx)); init_reg_map (map, maxregnum); @@ -1206,8 +1205,8 @@ unroll_loop (struct loop *loop, int insn_count, int strength_reduce_p) for (i = 0; i < unroll_number; i++) { - memset ((char *) map->insn_map, 0, max_insnno * sizeof (rtx)); - memset ((char *) &VARRAY_CONST_EQUIV (map->const_equiv_varray, 0), 0, + memset (map->insn_map, 0, max_insnno * sizeof (rtx)); + memset (&VARRAY_CONST_EQUIV (map->const_equiv_varray, 0), 0, VARRAY_SIZE (map->const_equiv_varray) * sizeof (struct const_equiv_data)); map->const_age = 0; diff --git a/gcc/unwind-dw2-fde.c b/gcc/unwind-dw2-fde.c index 31fc1c475978..21d86b03bc1a 100644 --- a/gcc/unwind-dw2-fde.c +++ b/gcc/unwind-dw2-fde.c @@ -115,7 +115,7 @@ __register_frame (void *begin) if (*(uword *) begin == 0) return; - ob = (struct object *) malloc (sizeof (struct object)); + ob = malloc (sizeof (struct object)); __register_frame_info (begin, ob); } @@ -153,7 +153,7 @@ __register_frame_info_table (void *begin, struct object *ob) void __register_frame_table (void *begin) { - struct object *ob = (struct object *) malloc (sizeof (struct object)); + struct object *ob = malloc (sizeof (struct object)); __register_frame_info_table (begin, ob); } @@ -395,10 +395,10 @@ start_fde_sort (struct fde_accumulator *accu, size_t count) return 0; size = sizeof (struct fde_vector) + sizeof (fde *) * count; - if ((accu->linear = (struct fde_vector *) malloc (size))) + if ((accu->linear = malloc (size))) { accu->linear->count = 0; - if ((accu->erratic = (struct fde_vector *) malloc (size))) + if ((accu->erratic = malloc (size))) accu->erratic->count = 0; return 1; } diff --git a/gcc/varasm.c b/gcc/varasm.c index 9b02fe0d3133..073fcdf37540 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -372,7 +372,7 @@ set_named_section_flags (const char *section, unsigned int flags) if (!entry) { - entry = (struct in_named_entry *) ggc_alloc (sizeof (*entry)); + entry = ggc_alloc (sizeof (*entry)); *slot = entry; entry->name = ggc_strdup (section); entry->flags = flags; @@ -2128,7 +2128,7 @@ const_hash_1 (const tree exp) char *tmp; len = int_size_in_bytes (TREE_TYPE (exp)); - tmp = (char *) alloca (len); + tmp = alloca (len); get_set_constructor_bytes (exp, (unsigned char *) tmp, len); p = tmp; break; @@ -2258,8 +2258,8 @@ compare_constant (const tree t1, const tree t2) if (int_size_in_bytes (TREE_TYPE (t1)) != len) return 0; - tmp1 = (unsigned char *) alloca (len); - tmp2 = (unsigned char *) alloca (len); + tmp1 = alloca (len); + tmp2 = alloca (len); if (get_set_constructor_bytes (t1, tmp1, len) != NULL_TREE) return 0; @@ -2634,16 +2634,14 @@ void init_varasm_status (struct function *f) { struct varasm_status *p; - p = (struct varasm_status *) ggc_alloc (sizeof (struct varasm_status)); + p = ggc_alloc (sizeof (struct varasm_status)); f->varasm = p; p->x_const_rtx_hash_table - = ((struct constant_descriptor_rtx **) - ggc_alloc_cleared (MAX_RTX_HASH_TABLE - * sizeof (struct constant_descriptor_rtx *))); + = ggc_alloc_cleared (MAX_RTX_HASH_TABLE + * sizeof (struct constant_descriptor_rtx *)); p->x_const_rtx_sym_hash_table - = ((struct pool_constant **) - ggc_alloc_cleared (MAX_RTX_HASH_TABLE - * sizeof (struct pool_constant *))); + = ggc_alloc_cleared (MAX_RTX_HASH_TABLE + * sizeof (struct pool_constant *)); p->x_first_pool = p->x_last_pool = 0; p->x_pool_offset = 0; @@ -2896,7 +2894,7 @@ record_constant_rtx (enum machine_mode mode, rtx x) { struct constant_descriptor_rtx *ptr; - ptr = (struct constant_descriptor_rtx *) ggc_alloc (sizeof (*ptr)); + ptr = ggc_alloc (sizeof (*ptr)); decode_rtx_const (mode, x, &ptr->value); return ptr; @@ -2950,7 +2948,7 @@ force_const_mem (enum machine_mode mode, rtx x) LABEL_PRESERVE_P (XEXP (x, 0)) = 1; /* Allocate a pool constant descriptor, fill it in, and chain it in. */ - pool = (struct pool_constant *) ggc_alloc (sizeof (struct pool_constant)); + pool = ggc_alloc (sizeof (struct pool_constant)); pool->desc = desc; pool->constant = x; pool->mode = mode; @@ -3767,7 +3765,7 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align) thissize, align, 1); else if (TREE_CODE (exp) == CONSTRUCTOR) { - unsigned char *buffer = (unsigned char *) alloca (thissize); + unsigned char *buffer = alloca (thissize); if (get_set_constructor_bytes (exp, buffer, thissize)) abort (); assemble_string ((char *) buffer, thissize); diff --git a/gcc/varray.c b/gcc/varray.c index 9af706e2b7c9..7901471bd798 100644 --- a/gcc/varray.c +++ b/gcc/varray.c @@ -68,9 +68,9 @@ varray_init (size_t num_elements, enum varray_data_enum element_kind, size_t data_size = num_elements * element[element_kind].size; varray_type ptr; if (element[element_kind].uses_ggc) - ptr = (varray_type) ggc_alloc_cleared (VARRAY_HDR_SIZE + data_size); + ptr = ggc_alloc_cleared (VARRAY_HDR_SIZE + data_size); else - ptr = (varray_type) xcalloc (VARRAY_HDR_SIZE + data_size, 1); + ptr = xcalloc (VARRAY_HDR_SIZE + data_size, 1); ptr->num_elements = num_elements; ptr->elements_used = 0; @@ -93,9 +93,9 @@ varray_grow (varray_type va, size_t n) size_t data_size = n * elem_size; if (element[va->type].uses_ggc) - va = (varray_type) ggc_realloc (va, VARRAY_HDR_SIZE + data_size); + va = ggc_realloc (va, VARRAY_HDR_SIZE + data_size); else - va = (varray_type) xrealloc ((char *) va, VARRAY_HDR_SIZE + data_size); + va = xrealloc (va, VARRAY_HDR_SIZE + data_size); va->num_elements = n; if (n > old_elements) memset (&va->data.c[old_data_size], 0, data_size - old_data_size); diff --git a/gcc/vmsdbgout.c b/gcc/vmsdbgout.c index ac148c2ce997..4f7f62d2e976 100644 --- a/gcc/vmsdbgout.c +++ b/gcc/vmsdbgout.c @@ -1362,8 +1362,8 @@ vmsdbgout_begin_function (tree decl) if (func_table_in_use == func_table_allocated) { func_table_allocated += FUNC_TABLE_INCREMENT; - func_table = (char **) xrealloc (func_table, - func_table_allocated * sizeof (char *)); + func_table = xrealloc (func_table, + func_table_allocated * sizeof (char *)); } /* Add the new entry to the end of the function name table. */ @@ -1481,10 +1481,9 @@ lookup_filename (const char *file_name) { file_info_table_allocated += FILE_TABLE_INCREMENT; - file_info_table - = (dst_file_info_ref) xrealloc (file_info_table, - (file_info_table_allocated - * sizeof (dst_file_info_entry))); + file_info_table = xrealloc (file_info_table, + (file_info_table_allocated + * sizeof (dst_file_info_entry))); } /* Add the new entry to the end of the filename table. */ @@ -1521,10 +1520,9 @@ vmsdbgout_source_line (register unsigned line, register const char *filename) if (line_info_table_in_use == line_info_table_allocated) { line_info_table_allocated += LINE_INFO_TABLE_INCREMENT; - line_info_table - = (dst_line_info_ref) xrealloc (line_info_table, - (line_info_table_allocated - * sizeof (dst_line_info_entry))); + line_info_table = xrealloc (line_info_table, + (line_info_table_allocated + * sizeof (dst_line_info_entry))); } /* Add the new entry at the end of the line_info_table. */ @@ -1574,21 +1572,19 @@ vmsdbgout_init (const char *main_input_filename) /* Allocate the initial hunk of the file_info_table. */ file_info_table - = (dst_file_info_ref) xcalloc (FILE_TABLE_INCREMENT, - sizeof (dst_file_info_entry)); + = xcalloc (FILE_TABLE_INCREMENT, sizeof (dst_file_info_entry)); file_info_table_allocated = FILE_TABLE_INCREMENT; /* Skip the first entry - file numbers begin at 1 */ file_info_table_in_use = 1; - func_table = (char **) xcalloc (FUNC_TABLE_INCREMENT, sizeof (char *)); + func_table = xcalloc (FUNC_TABLE_INCREMENT, sizeof (char *)); func_table_allocated = FUNC_TABLE_INCREMENT; func_table_in_use = 1; /* Allocate the initial hunk of the line_info_table. */ line_info_table - = (dst_line_info_ref) xcalloc (LINE_INFO_TABLE_INCREMENT, - sizeof (dst_line_info_entry)); + = xcalloc (LINE_INFO_TABLE_INCREMENT, sizeof (dst_line_info_entry)); line_info_table_allocated = LINE_INFO_TABLE_INCREMENT; /* zero-th entry is allocated, but unused */ line_info_table_in_use = 1; diff --git a/gcc/xcoffout.c b/gcc/xcoffout.c index ee6e3ada34e0..7c03ca5b096c 100644 --- a/gcc/xcoffout.c +++ b/gcc/xcoffout.c @@ -400,7 +400,7 @@ xcoffout_declare_function (FILE *file, tree decl, const char *name) { if (name[i] == '[') { - char *n = (char *) alloca (i + 1); + char *n = alloca (i + 1); strncpy (n, name, i); n[i] = '\0'; name = n; -- 2.39.2