OSDN Git Service

* c-format.c (handle_format_attribute): Fix -Wc++-compat and/or
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 Jun 2008 16:53:54 +0000 (16:53 +0000)
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 Jun 2008 16:53:54 +0000 (16:53 +0000)
-Wcast-qual warnings.
* c-pragma.c (dpm_eq, handle_pragma_push_macro,
handle_pragma_pop_macro): Likewise.
* collect2.c (resolve_lib_name): Likewise.
* config/arc/arc.c (arc_init): Likewise.
* config/arm/arm.c (neon_builtin_compare,
locate_neon_builtin_icode): Likewise.
* config/arm/pe.c (arm_mark_dllexport, arm_pe_unique_section):
Likewise.
* config/bfin/bfin.c (bfin_init_machine_status,
bfin_optimize_loop): Likewise.
* config/bfin/bfin.h (TARGET_CPU_CPP_BUILTINS): Likewise.
* config/cris/cris.c (cris_init_expanders): Likewise.
* config/darwin-c.c (frameworks_in_use, add_framework): Likewise.
* config/darwin.c (machopic_indirection_eq,
machopic_indirection_name, machopic_output_indirection):
Likewise.
* config/frv/frv.c (frv_init_machine_status, frv_compare_insns,
frv_io_check_address, frv_io_handle_set, frv_io_handle_use_1,
frv_optimize_membar): Likewise.
* config/i386/cygwin.h (mingw_scan,
GCC_DRIVER_HOST_INITIALIZATION): Likewise.
* config/i386/cygwin1.c (mingw_scan): Likewise.
* config/i386/i386.c (machopic_output_stub): Likewise.
* config/i386/winnt.c (gen_stdcall_or_fastcall_suffix,
i386_pe_unique_section): Likewise.
* config/ia64/ia64.c (ia64_init_machine_status,
ia64_h_i_d_extended, get_free_bundle_state, bundling, ia64_reorg):
Likewise.
* config/iq2000/iq2000.c, iq2000_init_machine_status): Likewise.
* config/m68hc11/m68hc11.c (m68hc11_encode_label): Likewise.
* config/m68k/m68k.c (m68k_handle_option,
m68k_sched_md_init_global): Likewise.
* config/mcore/mcore.c (mcore_mark_dllexport,
mcore_mark_dllimport, mcore_unique_section): Likewise.
* config/mips/mips.c (mips_block_move_straight,
mips16_rewrite_pool_refs, mips_sim_wait_regs_2,
mips_sim_record_set): Likewise.
* config/mmix/mmix.c (mmix_init_machine_status,
mmix_encode_section_info): Likewise.
* config/pa/pa.c (pa_init_machine_status, hppa_encode_label):
Likewise.
* config/rs6000/rs6000.c (rs6000_init_machine_status,
print_operand_address, output_toc, redefine_groups,
rs6000_elf_encode_section_info, machopic_output_stub): Likewise.
* config/s390/s390.c (s390_init_machine_status): Likewise.
* config/score/score.c (score_block_move_straight,
score_block_move_loop_body): Likewise.
* config/sparc/sparc.c (sparc_init_machine_status): Likewise.
* config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise.
* emit-rtl.c (find_auto_inc): Likewise.
* gcc.c (translate_options, process_command): Likewise.
* reorg.c (dbr_schedule): Likewise.
* sdbout.c (sdbout_start_source_file, sdbout_init): Likewise.
* xcoffout.c (xcoffout_declare_function): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137191 138bc75d-0d04-0410-961f-82ee72b054a4

35 files changed:
gcc/ChangeLog
gcc/c-format.c
gcc/c-pragma.c
gcc/collect2.c
gcc/config/arc/arc.c
gcc/config/arm/arm.c
gcc/config/arm/pe.c
gcc/config/bfin/bfin.c
gcc/config/bfin/bfin.h
gcc/config/cris/cris.c
gcc/config/darwin-c.c
gcc/config/darwin.c
gcc/config/frv/frv.c
gcc/config/i386/cygwin.h
gcc/config/i386/cygwin1.c
gcc/config/i386/i386.c
gcc/config/i386/winnt.c
gcc/config/ia64/ia64.c
gcc/config/iq2000/iq2000.c
gcc/config/m68hc11/m68hc11.c
gcc/config/m68k/m68k.c
gcc/config/mcore/mcore.c
gcc/config/mips/mips.c
gcc/config/mmix/mmix.c
gcc/config/pa/pa.c
gcc/config/rs6000/rs6000.c
gcc/config/s390/s390.c
gcc/config/score/score.c
gcc/config/sparc/sparc.c
gcc/config/xtensa/xtensa.c
gcc/emit-rtl.c
gcc/gcc.c
gcc/reorg.c
gcc/sdbout.c
gcc/xcoffout.c

index 6e762a5..0139070 100644 (file)
@@ -1,3 +1,62 @@
+2008-06-27  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * c-format.c (handle_format_attribute): Fix -Wc++-compat and/or
+       -Wcast-qual warnings.
+       * c-pragma.c (dpm_eq, handle_pragma_push_macro,
+       handle_pragma_pop_macro): Likewise.
+       * collect2.c (resolve_lib_name): Likewise.
+       * config/arc/arc.c (arc_init): Likewise.
+       * config/arm/arm.c (neon_builtin_compare,
+       locate_neon_builtin_icode): Likewise.
+       * config/arm/pe.c (arm_mark_dllexport, arm_pe_unique_section):
+       Likewise.
+       * config/bfin/bfin.c (bfin_init_machine_status,
+       bfin_optimize_loop): Likewise.
+       * config/bfin/bfin.h (TARGET_CPU_CPP_BUILTINS): Likewise.
+       * config/cris/cris.c (cris_init_expanders): Likewise.
+       * config/darwin-c.c (frameworks_in_use, add_framework): Likewise.
+       * config/darwin.c (machopic_indirection_eq,
+       machopic_indirection_name, machopic_output_indirection):
+       Likewise.
+       * config/frv/frv.c (frv_init_machine_status, frv_compare_insns,
+       frv_io_check_address, frv_io_handle_set, frv_io_handle_use_1,
+       frv_optimize_membar): Likewise.
+       * config/i386/cygwin.h (mingw_scan,
+       GCC_DRIVER_HOST_INITIALIZATION): Likewise.
+       * config/i386/cygwin1.c (mingw_scan): Likewise.
+       * config/i386/i386.c (machopic_output_stub): Likewise.
+       * config/i386/winnt.c (gen_stdcall_or_fastcall_suffix,
+       i386_pe_unique_section): Likewise.
+       * config/ia64/ia64.c (ia64_init_machine_status,
+       ia64_h_i_d_extended, get_free_bundle_state, bundling, ia64_reorg):
+       Likewise.
+       * config/iq2000/iq2000.c, iq2000_init_machine_status): Likewise.
+       * config/m68hc11/m68hc11.c (m68hc11_encode_label): Likewise.
+       * config/m68k/m68k.c (m68k_handle_option,
+       m68k_sched_md_init_global): Likewise.
+       * config/mcore/mcore.c (mcore_mark_dllexport,
+       mcore_mark_dllimport, mcore_unique_section): Likewise.
+       * config/mips/mips.c (mips_block_move_straight,
+       mips16_rewrite_pool_refs, mips_sim_wait_regs_2,
+       mips_sim_record_set): Likewise.
+       * config/mmix/mmix.c (mmix_init_machine_status,
+       mmix_encode_section_info): Likewise.
+       * config/pa/pa.c (pa_init_machine_status, hppa_encode_label):
+       Likewise.
+       * config/rs6000/rs6000.c (rs6000_init_machine_status,
+       print_operand_address, output_toc, redefine_groups,
+       rs6000_elf_encode_section_info, machopic_output_stub): Likewise.
+       * config/s390/s390.c (s390_init_machine_status): Likewise.
+       * config/score/score.c (score_block_move_straight,
+       score_block_move_loop_body): Likewise.
+       * config/sparc/sparc.c (sparc_init_machine_status): Likewise.
+       * config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise.
+       * emit-rtl.c (find_auto_inc): Likewise.
+       * gcc.c (translate_options, process_command): Likewise.
+       * reorg.c (dbr_schedule): Likewise.
+       * sdbout.c (sdbout_start_source_file, sdbout_init): Likewise.
+       * xcoffout.c (xcoffout_declare_function): Likewise.
+
 2008-06-27  Daniel Berlin  <dberlin@dberlin.org>
 
        * tree-ssa-structalias.c (find_func_aliases): Trivial fix to get
index 6fb96a3..fa28763 100644 (file)
@@ -2804,8 +2804,8 @@ handle_format_attribute (tree *node, tree ARG_UNUSED (name), tree args,
      add them to FORMAT_TYPES at first use.  */
   if (TARGET_FORMAT_TYPES != NULL && !dynamic_format_types)
     {
-      dynamic_format_types = xmalloc ((n_format_types + TARGET_N_FORMAT_TYPES)
-                                     * sizeof (dynamic_format_types[0]));
+      dynamic_format_types = XNEWVEC (format_kind_info,
+                                     n_format_types + TARGET_N_FORMAT_TYPES);
       memcpy (dynamic_format_types, format_types_orig,
              sizeof (format_types_orig));
       memcpy (&dynamic_format_types[n_format_types], TARGET_FORMAT_TYPES,
index 81b9910..e7bb928 100644 (file)
@@ -270,7 +270,8 @@ dpm_hash (const void *p)
 static int
 dpm_eq (const void *pa, const void *pb)
 {
-  const struct def_pragma_macro *a = pa, *b = pb;
+  const struct def_pragma_macro *const a = (const struct def_pragma_macro *) pa,
+    *const b = (const struct def_pragma_macro *) pb;
   return a->hash == b->hash && strcmp (a->name, b->name) == 0;
 }
 
@@ -315,10 +316,10 @@ handle_pragma_push_macro (cpp_reader *reader)
   dummy.name = macroname;
   slot = htab_find_slot_with_hash (pushed_macro_table, &dummy,
                                   dummy.hash, INSERT);
-  c = *slot;
+  c = (struct def_pragma_macro *) *slot;
   if (c == NULL)
     {
-      *slot = c = ggc_alloc (sizeof (struct def_pragma_macro));
+      *slot = c = GGC_NEW (struct def_pragma_macro);
       c->hash = dummy.hash;
       c->name = ggc_alloc_string (macroname, TREE_STRING_LENGTH (id) - 1);
       c->value.prev = NULL;
@@ -326,7 +327,7 @@ handle_pragma_push_macro (cpp_reader *reader)
   else
     {
       struct def_pragma_macro_value *v;
-      v = ggc_alloc (sizeof (struct def_pragma_macro_value));
+      v = GGC_NEW (struct def_pragma_macro_value);
       *v = c->value;
       c->value.prev = v;
     }
@@ -372,7 +373,7 @@ handle_pragma_pop_macro (cpp_reader *reader)
                                     dummy.hash, NO_INSERT);
   if (slot == NULL)
     return;
-  c = *slot;
+  c = (struct def_pragma_macro *) *slot;
 
   cpp_pop_definition (reader, c->name, c->value.value);
 
index dbd5806..314d30d 100644 (file)
@@ -2628,7 +2628,7 @@ resolve_lib_name (const char *name)
     if (libpaths[i]->max_len > l)
       l = libpaths[i]->max_len;
 
-  lib_buf = xmalloc (l + strlen(name) + 10);
+  lib_buf = XNEWVEC (char, l + strlen(name) + 10);
 
   for (i = 0; libpaths[i]; i++)
     {
index b5e2cb9..067d9f7 100644 (file)
@@ -173,11 +173,11 @@ arc_init (void)
   char *tmp;
   
   /* Set the pseudo-ops for the various standard sections.  */
-  arc_text_section = tmp = xmalloc (strlen (arc_text_string) + sizeof (ARC_SECTION_FORMAT) + 1);
+  arc_text_section = tmp = XNEWVEC (char, strlen (arc_text_string) + sizeof (ARC_SECTION_FORMAT) + 1);
   sprintf (tmp, ARC_SECTION_FORMAT, arc_text_string);
-  arc_data_section = tmp = xmalloc (strlen (arc_data_string) + sizeof (ARC_SECTION_FORMAT) + 1);
+  arc_data_section = tmp = XNEWVEC (char, strlen (arc_data_string) + sizeof (ARC_SECTION_FORMAT) + 1);
   sprintf (tmp, ARC_SECTION_FORMAT, arc_data_string);
-  arc_rodata_section = tmp = xmalloc (strlen (arc_rodata_string) + sizeof (ARC_SECTION_FORMAT) + 1);
+  arc_rodata_section = tmp = XNEWVEC (char, strlen (arc_rodata_string) + sizeof (ARC_SECTION_FORMAT) + 1);
   sprintf (tmp, ARC_SECTION_FORMAT, arc_rodata_string);
 
   arc_init_reg_tables ();
index c7f223a..fa3d06d 100644 (file)
@@ -15609,8 +15609,8 @@ arm_expand_unop_builtin (enum insn_code icode,
 static int
 neon_builtin_compare (const void *a, const void *b)
 {
-  const neon_builtin_datum *key = a;
-  const neon_builtin_datum *memb = b;
+  const neon_builtin_datum *const key = (const neon_builtin_datum *) a;
+  const neon_builtin_datum *const memb = (const neon_builtin_datum *) b;
   unsigned int soughtcode = key->base_fcode;
 
   if (soughtcode >= memb->base_fcode
@@ -15629,7 +15629,8 @@ locate_neon_builtin_icode (int fcode, neon_itype *itype)
   int idx;
 
   key.base_fcode = fcode;
-  found = bsearch (&key, &neon_builtin_data[0], ARRAY_SIZE (neon_builtin_data),
+  found = (neon_builtin_datum *)
+    bsearch (&key, &neon_builtin_data[0], ARRAY_SIZE (neon_builtin_data),
                   sizeof (neon_builtin_data[0]), neon_builtin_compare);
   gcc_assert (found);
   idx = fcode - (int) found->base_fcode;
index 90bc729..8b8adff 100644 (file)
@@ -112,7 +112,7 @@ arm_mark_dllexport (tree decl)
   else if (arm_dllexport_name_p (oldname))
     return; /* already done */
 
-  newname = alloca (strlen (oldname) + 4);
+  newname = XALLOCAVEC (char, strlen (oldname) + 4);
   sprintf (newname, "%ce.%s", ARM_PE_FLAG_CHAR, oldname);
 
   /* We pass newname through get_identifier to ensure it has a unique
@@ -178,7 +178,7 @@ arm_mark_dllimport (tree decl)
       TREE_PUBLIC (decl) = 1;
     }
 
-  newname = alloca (strlen (oldname) + 11);
+  newname = XALLOCAVEC (char, strlen (oldname) + 11);
   sprintf (newname, "%ci.__imp_%s", ARM_PE_FLAG_CHAR, oldname);
 
   /* We pass newname through get_identifier to ensure it has a unique
@@ -250,7 +250,7 @@ arm_pe_unique_section (tree decl, int reloc)
   else
     prefix = ".data$";
   len = strlen (name) + strlen (prefix);
-  string = alloca (len + 1);
+  string = XALLOCAVEC (char, len + 1);
   sprintf (string, "%s%s", prefix, name);
 
   DECL_SECTION_NAME (decl) = build_string (len, string);
index a7600cf..05a5e49 100644 (file)
@@ -2436,7 +2436,7 @@ bfin_init_machine_status (void)
 {
   struct machine_function *f;
 
-  f = ggc_alloc_cleared (sizeof (struct machine_function));
+  f = GGC_CNEW (struct machine_function);
 
   return f;
 }
@@ -3838,7 +3838,7 @@ bfin_optimize_loop (loop_info loop)
 
   if (JUMP_P (last_insn))
     {
-      loop_info inner = bb->aux;
+      loop_info inner = (loop_info) bb->aux;
       if (inner
          && inner->outer == loop
          && inner->loop_end == last_insn
index 8efcb5e..6f2d16c 100644 (file)
@@ -121,7 +121,7 @@ extern int target_flags;
       if (bfin_si_revision != -1)              \
        {                                       \
          /* space of 0xnnnn and a NUL */       \
-         char *buf = alloca (7);               \
+         char *buf = XALLOCAVEC (char, 7);     \
                                                \
          sprintf (buf, "0x%04x", bfin_si_revision);                    \
          builtin_define_with_value ("__SILICON_REVISION__", buf, 0);   \
index 810366f..3a0eb2d 100644 (file)
@@ -2533,7 +2533,7 @@ cris_init_expanders (void)
 static struct machine_function *
 cris_init_machine_status (void)
 {
-  return ggc_alloc_cleared (sizeof (struct machine_function));
+  return GGC_CNEW (struct machine_function);
 }
 
 /* Split a 2 word move (DI or presumably DF) into component parts.
index ba0eca1..9f3b444 100644 (file)
@@ -179,7 +179,7 @@ darwin_pragma_ms_struct (cpp_reader *pfile ATTRIBUTE_UNUSED)
     BAD ("junk at end of '#pragma ms_struct'");
 }
 
-static struct {
+static struct frameworks_in_use {
   size_t len;
   const char *name;
   cpp_dir* dir;
@@ -211,8 +211,8 @@ add_framework (const char *name, size_t len, cpp_dir *dir)
     {
       max_frameworks = i*2;
       max_frameworks += i == 0;
-      frameworks_in_use = xrealloc (frameworks_in_use,
-                                   max_frameworks*sizeof(*frameworks_in_use));
+      frameworks_in_use = XRESIZEVEC (struct frameworks_in_use,
+                                     frameworks_in_use, max_frameworks);
     }
   dir_name = XNEWVEC (char, len + 1);
   memcpy (dir_name, name, len);
index 5461fe0..20cce26 100644 (file)
@@ -366,7 +366,8 @@ machopic_indirection_hash (const void *slot)
 static int
 machopic_indirection_eq (const void *slot, const void *key)
 {
-  return strcmp (((const machopic_indirection *) slot)->ptr_name, key) == 0;
+  return strcmp (((const machopic_indirection *) slot)->ptr_name,
+                (const char *) key) == 0;
 }
 
 /* Return the name of the non-lazy pointer (if STUB_P is false) or
@@ -420,7 +421,7 @@ machopic_indirection_name (rtx sym_ref, bool stub_p)
   else
     suffix = NON_LAZY_POINTER_SUFFIX;
 
-  buffer = alloca (strlen ("&L")
+  buffer = XALLOCAVEC (char, strlen ("&L")
                   + strlen (prefix)
                   + namelen
                   + strlen (suffix)
@@ -969,7 +970,7 @@ machopic_output_indirection (void **slot, void *data)
            sym_name = IDENTIFIER_POINTER (id);
        }
 
-      sym = alloca (strlen (sym_name) + 2);
+      sym = XALLOCAVEC (char, strlen (sym_name) + 2);
       if (sym_name[0] == '*' || sym_name[0] == '&')
        strcpy (sym, sym_name + 1);
       else if (sym_name[0] == '-' || sym_name[0] == '+')
@@ -977,7 +978,7 @@ machopic_output_indirection (void **slot, void *data)
       else
        sprintf (sym, "%s%s", user_label_prefix, sym_name);
 
-      stub = alloca (strlen (ptr_name) + 2);
+      stub = XALLOCAVEC (char, strlen (ptr_name) + 2);
       if (ptr_name[0] == '*' || ptr_name[0] == '&')
        strcpy (stub, ptr_name + 1);
       else
index 93648cc..6ba924b 100644 (file)
@@ -6950,7 +6950,7 @@ frv_assemble_integer (rtx value, unsigned int size, int aligned_p)
 static struct machine_function *
 frv_init_machine_status (void)
 {
-  return ggc_alloc_cleared (sizeof (struct machine_function));
+  return GGC_CNEW (struct machine_function);
 }
 \f
 /* Implement TARGET_SCHED_ISSUE_RATE.  */
@@ -7525,7 +7525,8 @@ frv_sort_insn_group_1 (enum frv_insn_group group,
 static int
 frv_compare_insns (const void *first, const void *second)
 {
-  const rtx *insn1 = first, *insn2 = second;
+  const rtx *const insn1 = (rtx const *) first,
+    *const insn2 = (rtx const *) second;
   return frv_insn_unit (*insn1) - frv_insn_unit (*insn2);
 }
 
@@ -7758,7 +7759,7 @@ frv_extract_membar (struct frv_io *io, rtx insn)
 static void
 frv_io_check_address (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data)
 {
-  rtx *other = data;
+  rtx *other = (rtx *) data;
 
   if (REG_P (x) && *other != 0 && reg_overlap_mentioned_p (x, *other))
     *other = 0;
@@ -7770,7 +7771,7 @@ frv_io_check_address (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data)
 static void
 frv_io_handle_set (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data)
 {
-  HARD_REG_SET *set = data;
+  HARD_REG_SET *set = (HARD_REG_SET *) data;
   unsigned int regno;
 
   if (REG_P (x))
@@ -7784,7 +7785,7 @@ frv_io_handle_set (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data)
 static int
 frv_io_handle_use_1 (rtx *x, void *data)
 {
-  HARD_REG_SET *set = data;
+  HARD_REG_SET *set = (HARD_REG_SET *) data;
   unsigned int regno;
 
   if (REG_P (*x))
@@ -8005,8 +8006,8 @@ frv_optimize_membar (void)
   rtx *last_membar;
 
   compute_bb_for_insn ();
-  first_io = xcalloc (last_basic_block, sizeof (struct frv_io));
-  last_membar = xcalloc (last_basic_block, sizeof (rtx));
+  first_io = XCNEWVEC (struct frv_io, last_basic_block);
+  last_membar = XCNEWVEC (rtx, last_basic_block);
 
   FOR_EACH_BB (bb)
     frv_optimize_membar_local (bb, &first_io[bb->index],
index 1af4880..f61cacb 100644 (file)
@@ -203,12 +203,12 @@ char *cvt_to_mingw[] =
 #undef GEN_CVT_ARRAY
 #endif /*GEN_CVT_ARRAY*/
 
-void mingw_scan (int, const char * const *, char **);
+void mingw_scan (int, const char * const *, const char **);
 #if 1
 #define GCC_DRIVER_HOST_INITIALIZATION \
 do \
 { \
-  mingw_scan(argc, (const char * const *) argv, (char **) &spec_machine); \
+  mingw_scan(argc, (const char * const *) argv, &spec_machine); \
   } \
 while (0)
 #else
index fb8657a..3ba812f 100644 (file)
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3.  If not see
 void
 mingw_scan (int argc ATTRIBUTE_UNUSED,
             const char *const *argv,
-            char **spec_machine)
+            const char **spec_machine)
 {
   putenv (xstrdup ("GCC_CYGWIN_MINGW=0"));
  
@@ -42,7 +42,7 @@ mingw_scan (int argc ATTRIBUTE_UNUSED,
        if (p)
          {
            int len = p - *spec_machine;
-           char *s = xmalloc (strlen (*spec_machine) + 3);
+           char *s = XNEWVEC (char, strlen (*spec_machine) + 3);
            memcpy (s, *spec_machine, len);
            strcpy (s + len, "-mingw32");
            *spec_machine = s;
index 5ebb31c..319d0b7 100644 (file)
@@ -22967,11 +22967,11 @@ machopic_output_stub (FILE *file, const char *symb, const char *stub)
   symb = (*targetm.strip_name_encoding) (symb);
 
   length = strlen (stub);
-  binder_name = alloca (length + 32);
+  binder_name = XALLOCAVEC (char, length + 32);
   GEN_BINDER_NAME_FOR_STUB (binder_name, stub, length);
 
   length = strlen (symb);
-  symbol_name = alloca (length + 32);
+  symbol_name = XALLOCAVEC (char, length + 32);
   GEN_SYMBOL_NAME_FOR_SYMBOL (symbol_name, symb, length);
 
   sprintf (lazy_ptr_name, "L%d$lz", label);
index 35d7f9f..7fdd894 100644 (file)
@@ -199,7 +199,7 @@ gen_stdcall_or_fastcall_suffix (tree decl, tree id, bool fastcall)
        }
       }
   /* Assume max of 8 base 10 digits in the suffix.  */
-  p = new_str = alloca (1 + strlen (old_str) + 1 + 8 + 1);
+  p = new_str = XALLOCAVEC (char, 1 + strlen (old_str) + 1 + 8 + 1);
   if (fastcall)
     *p++ = FASTCALL_PREFIX;
   sprintf (p, "%s@" HOST_WIDE_INT_PRINT_DEC, old_str, total);
@@ -380,7 +380,7 @@ i386_pe_unique_section (tree decl, int reloc)
   else
     prefix = ".data$";
   len = strlen (name) + strlen (prefix);
-  string = alloca (len + 1);
+  string = XALLOCAVEC (char, len + 1);
   sprintf (string, "%s%s", prefix, name);
 
   DECL_SECTION_NAME (decl) = build_string (len, string);
index 22d0c0a..d1928f6 100644 (file)
@@ -5248,7 +5248,7 @@ void ia64_init_expanders (void)
 static struct machine_function *
 ia64_init_machine_status (void)
 {
-  return ggc_alloc_cleared (sizeof (struct machine_function));
+  return GGC_CNEW (struct machine_function);
 }
 \f
 static enum attr_itanium_class ia64_safe_itanium_class (rtx);
@@ -6772,7 +6772,7 @@ ia64_h_i_d_extended (void)
     {
       int new_max_uid = get_max_uid () + 1;
 
-      spec_check_no = xrecalloc (spec_check_no, new_max_uid,
+      spec_check_no = (int *) xrecalloc (spec_check_no, new_max_uid,
                                 max_uid, sizeof (*spec_check_no));
       max_uid = new_max_uid;
     }
@@ -6781,14 +6781,14 @@ ia64_h_i_d_extended (void)
     {
       int new_clocks_length = get_max_uid () + 1;
       
-      stops_p = xrecalloc (stops_p, new_clocks_length, clocks_length, 1);
+      stops_p = (char *) xrecalloc (stops_p, new_clocks_length, clocks_length, 1);
       
       if (ia64_tune == PROCESSOR_ITANIUM)
        {
-         clocks = xrecalloc (clocks, new_clocks_length, clocks_length,
-                             sizeof (int));
-         add_cycles = xrecalloc (add_cycles, new_clocks_length, clocks_length,
-                                 sizeof (int));
+         clocks = (int *) xrecalloc (clocks, new_clocks_length, clocks_length,
+                                     sizeof (int));
+         add_cycles = (int *) xrecalloc (add_cycles, new_clocks_length,
+                                         clocks_length, sizeof (int));
        }
       
       clocks_length = new_clocks_length;
@@ -7410,7 +7410,7 @@ get_free_bundle_state (void)
     }
   else
     {
-      result = xmalloc (sizeof (struct bundle_state));
+      result = XNEW (struct bundle_state);
       result->dfa_state = xmalloc (dfa_state_size);
       result->allocated_states_chain = allocated_bundle_states_chain;
       allocated_bundle_states_chain = result;
@@ -7920,8 +7920,7 @@ bundling (FILE *dump, int verbose, rtx prev_head_insn, rtx tail)
   bundling_p = 1;
   dfa_clean_insn_cache ();
   initiate_bundle_state_table ();
-  index_to_bundle_states = xmalloc ((insn_num + 2)
-                                   * sizeof (struct bundle_state *));
+  index_to_bundle_states = XNEWVEC (struct bundle_state *, insn_num + 2);
   /* First (forward) pass -- generation of bundle states.  */
   curr_state = get_free_bundle_state ();
   curr_state->insn = NULL;
@@ -8612,11 +8611,11 @@ ia64_reorg (void)
       PREV_INSN (ia64_nop) = NEXT_INSN (ia64_nop) = NULL_RTX;
       recog_memoized (ia64_nop);
       clocks_length = get_max_uid () + 1;
-      stops_p = xcalloc (1, clocks_length);
+      stops_p = XCNEWVEC (char, clocks_length);
       if (ia64_tune == PROCESSOR_ITANIUM)
        {
-         clocks = xcalloc (clocks_length, sizeof (int));
-         add_cycles = xcalloc (clocks_length, sizeof (int));
+         clocks = XCNEWVEC (int, clocks_length);
+         add_cycles = XCNEWVEC (int, clocks_length);
        }
       if (ia64_tune == PROCESSOR_ITANIUM2)
        {
index 2d20a4b..b66a485 100644 (file)
@@ -1389,7 +1389,7 @@ iq2000_init_machine_status (void)
 {
   struct machine_function *f;
 
-  f = ggc_alloc_cleared (sizeof (struct machine_function));
+  f = GGC_CNEW (struct machine_function);
 
   return f;
 }
index 83b73b2..314feb1 100644 (file)
@@ -1172,7 +1172,7 @@ m68hc11_encode_label (tree decl)
 {
   const char *str = XSTR (XEXP (DECL_RTL (decl), 0), 0);
   int len = strlen (str);
-  char *newstr = alloca (len + 2);
+  char *newstr = XALLOCAVEC (char, len + 2);
 
   newstr[0] = '@';
   strcpy (&newstr[1], str);
index f95e37e..947304f 100644 (file)
@@ -500,7 +500,11 @@ m68k_handle_option (size_t code, const char *arg, int value)
        error ("-mshared-library-id=%s is not between 0 and %d",
               arg, MAX_LIBRARY_ID);
       else
-       asprintf ((char **) &m68k_library_id_string, "%d", (value * -4) - 4);
+        {
+         char *tmp;
+         asprintf (&tmp, "%d", (value * -4) - 4);
+         m68k_library_id_string = tmp;
+       }
       return true;
 
     default:
@@ -5446,8 +5450,7 @@ m68k_sched_md_init_global (FILE *sched_dump ATTRIBUTE_UNUSED,
   {
     rtx insn;
 
-    sched_branch_type = xcalloc (get_max_uid () + 1,
-                                sizeof (*sched_branch_type));
+    sched_branch_type = XCNEWVEC (enum attr_type, get_max_uid () + 1);
 
     for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn))
       {
@@ -5504,8 +5507,7 @@ m68k_sched_md_init_global (FILE *sched_dump ATTRIBUTE_UNUSED,
     case CPU_CFV3:
       max_insn_size = 3;
       sched_ib.records.n_insns = 8;
-      sched_ib.records.adjust = xmalloc (sched_ib.records.n_insns
-                                        * sizeof (*sched_ib.records.adjust));
+      sched_ib.records.adjust = XNEWVEC (int, sched_ib.records.n_insns);
       break;
 
     default:
index 940c833..227f7dc 100644 (file)
@@ -2851,7 +2851,7 @@ mcore_mark_dllexport (tree decl)
   if (mcore_dllexport_name_p (oldname))
     return;  /* Already done.  */
 
-  newname = alloca (strlen (oldname) + 4);
+  newname = XALLOCAVEC (char, strlen (oldname) + 4);
   sprintf (newname, "@e.%s", oldname);
 
   /* We pass newname through get_identifier to ensure it has a unique
@@ -2909,7 +2909,7 @@ mcore_mark_dllimport (tree decl)
       TREE_PUBLIC (decl) = 1;
     }
 
-  newname = alloca (strlen (oldname) + 11);
+  newname = XALLOCAVEC (char, strlen (oldname) + 11);
   sprintf (newname, "@i.__imp_%s", oldname);
 
   /* We pass newname through get_identifier to ensure it has a unique
@@ -3066,7 +3066,7 @@ mcore_unique_section (tree decl, int reloc ATTRIBUTE_UNUSED)
     prefix = ".data$";
   
   len = strlen (name) + strlen (prefix);
-  string = alloca (len + 1);
+  string = XALLOCAVEC (char, len + 1);
   
   sprintf (string, "%s%s", prefix, name);
 
index e8b384e..aa74d0c 100644 (file)
@@ -5833,7 +5833,7 @@ mips_block_move_straight (rtx dest, rtx src, HOST_WIDE_INT length)
   delta = bits / BITS_PER_UNIT;
 
   /* Allocate a buffer for the temporary registers.  */
-  regs = alloca (sizeof (rtx) * length / delta);
+  regs = XALLOCAVEC (rtx, length / delta);
 
   /* Load as many BITS-sized chunks as possible.  Use a normal load if
      the source has enough alignment, otherwise use left/right pairs.  */
@@ -11428,7 +11428,8 @@ struct mips16_rewrite_pool_refs_info {
 static int
 mips16_rewrite_pool_refs (rtx *x, void *data)
 {
-  struct mips16_rewrite_pool_refs_info *info = data;
+  struct mips16_rewrite_pool_refs_info *info =
+    (struct mips16_rewrite_pool_refs_info *) data;
 
   if (force_to_mem_operand (*x, Pmode))
     {
@@ -11603,7 +11604,7 @@ static int
 mips_sim_wait_regs_2 (rtx *x, void *data)
 {
   if (REG_P (*x))
-    mips_sim_wait_reg (data, mips_sim_insn, *x);
+    mips_sim_wait_reg ((struct mips_sim *) data, mips_sim_insn, *x);
   return 0;
 }
 
@@ -11657,7 +11658,7 @@ mips_sim_record_set (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data)
 {
   struct mips_sim *state;
 
-  state = data;
+  state = (struct mips_sim *) data;
   if (REG_P (x))
     {
       unsigned int regno, end_regno;
index 2807d08..fe38bb0 100644 (file)
@@ -241,7 +241,7 @@ mmix_init_expanders (void)
 static struct machine_function *
 mmix_init_machine_status (void)
 {
-  return ggc_alloc_cleared (sizeof (struct machine_function));
+  return GGC_CNEW (struct machine_function);
 }
 
 /* DATA_ALIGNMENT.
@@ -1158,7 +1158,7 @@ mmix_encode_section_info (tree decl, rtx rtl, int first)
 
       const char *str = XSTR (XEXP (rtl, 0), 0);
       int len = strlen (str);
-      char *newstr = alloca (len + 2);
+      char *newstr = XALLOCAVEC (char, len + 2);
       newstr[0] = '@';
       strcpy (newstr + 1, str);
       XSTR (XEXP (rtl, 0), 0) = ggc_alloc_string (newstr, len + 1);
index 009f5fa..0529a86 100644 (file)
@@ -538,7 +538,7 @@ pa_init_builtins (void)
 static struct machine_function *
 pa_init_machine_status (void)
 {
-  return ggc_alloc_cleared (sizeof (machine_function));
+  return GGC_CNEW (machine_function);
 }
 
 /* If FROM is a probable pointer register, mark TO as a probable
@@ -7861,7 +7861,7 @@ hppa_encode_label (rtx sym)
   int len = strlen (str) + 1;
   char *newstr, *p;
 
-  p = newstr = alloca (len + 1);
+  p = newstr = XALLOCAVEC (char, len + 1);
   *p++ = '@';
   strcpy (p, str);
 
index 904587d..4833ad7 100644 (file)
@@ -11525,7 +11525,7 @@ rs6000_got_register (rtx value ATTRIBUTE_UNUSED)
 static struct machine_function *
 rs6000_init_machine_status (void)
 {
-  return ggc_alloc_cleared (sizeof (machine_function));
+  return GGC_CNEW (machine_function);
 }
 \f
 /* These macros test for integers and extract the low-order bits.  */
@@ -12402,7 +12402,7 @@ print_operand_address (FILE *file, rtx x)
              char *newname;
 
              name = XSTR (symref, 0);
-             newname = alloca (strlen (name) + sizeof ("@toc"));
+             newname = XALLOCAVEC (char, strlen (name) + sizeof ("@toc"));
              strcpy (newname, name);
              strcat (newname, "@toc");
              XSTR (symref, 0) = newname;
@@ -17846,7 +17846,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
        toc_hash_table = htab_create_ggc (1021, toc_hash_function,
                                          toc_hash_eq, NULL);
 
-      h = ggc_alloc (sizeof (*h));
+      h = GGC_NEW (struct toc_hash_struct);
       h->key = x;
       h->key_mode = mode;
       h->labelno = labelno;
@@ -19905,7 +19905,7 @@ redefine_groups (FILE *dump, int sched_verbose, rtx prev_head_insn, rtx tail)
 
   /* Initialize.  */
   issue_rate = rs6000_issue_rate ();
-  group_insns = alloca (issue_rate * sizeof (rtx));
+  group_insns = XALLOCAVEC (rtx, issue_rate);
   for (i = 0; i < issue_rate; i++)
     {
       group_insns[i] = 0;
@@ -20501,7 +20501,7 @@ rs6000_elf_encode_section_info (tree decl, rtx rtl, int first)
     {
       rtx sym_ref = XEXP (rtl, 0);
       size_t len = strlen (XSTR (sym_ref, 0));
-      char *str = alloca (len + 2);
+      char *str = XALLOCAVEC (char, len + 2);
       str[0] = '.';
       memcpy (str + 1, XSTR (sym_ref, 0), len + 1);
       XSTR (sym_ref, 0) = ggc_alloc_string (str, len + 1);
@@ -20800,10 +20800,10 @@ machopic_output_stub (FILE *file, const char *symb, const char *stub)
 
 
   length = strlen (symb);
-  symbol_name = alloca (length + 32);
+  symbol_name = XALLOCAVEC (char, length + 32);
   GEN_SYMBOL_NAME_FOR_SYMBOL (symbol_name, symb, length);
 
-  lazy_ptr_name = alloca (length + 32);
+  lazy_ptr_name = XALLOCAVEC (char, length + 32);
   GEN_LAZY_PTR_NAME_FOR_SYMBOL (lazy_ptr_name, symb, length);
 
   if (flag_pic == 2)
@@ -20819,7 +20819,7 @@ machopic_output_stub (FILE *file, const char *symb, const char *stub)
       fprintf (file, "\t.indirect_symbol %s\n", symbol_name);
 
       label++;
-      local_label_0 = alloca (sizeof ("\"L00000000000$spb\""));
+      local_label_0 = XALLOCAVEC (char, sizeof ("\"L00000000000$spb\""));
       sprintf (local_label_0, "\"L%011d$spb\"", label);
 
       fprintf (file, "\tmflr r0\n");
index ff2edec..b9f2317 100644 (file)
@@ -1451,7 +1451,7 @@ s390_narrow_logical_operator (enum rtx_code code, rtx *memop, rtx *immop)
 static struct machine_function *
 s390_init_machine_status (void)
 {
-  return ggc_alloc_cleared (sizeof (struct machine_function));
+  return GGC_CNEW (struct machine_function);
 }
 
 /* Change optimizations to be performed, depending on the
index 56c6c47..4f383da 100644 (file)
@@ -922,7 +922,7 @@ score_block_move_straight (rtx dst, rtx src, HOST_WIDE_INT length)
   length -= leftover;
   reg_count = length / UNITS_PER_WORD;
 
-  regs = alloca (sizeof (rtx) * reg_count);
+  regs = XALLOCAVEC (rtx, reg_count);
   for (i = 0; i < reg_count; i++)
     regs[i] = gen_reg_rtx (SImode);
 
@@ -1006,7 +1006,7 @@ score_block_move_loop_body (rtx dst_reg, HOST_WIDE_INT dst_align,
                             HOST_WIDE_INT length)
 {
   int reg_count = length / UNITS_PER_WORD;
-  rtx *regs = alloca (sizeof (rtx) * reg_count);
+  rtx *regs = XALLOCAVEC (rtx, reg_count);
   int i;
   bool src_unaligned = (src_align < BITS_PER_WORD);
   bool dst_unaligned = (dst_align < BITS_PER_WORD);
index 009ab3a..5e6f574 100644 (file)
@@ -8848,7 +8848,7 @@ sparc_can_output_mi_thunk (const_tree thunk_fndecl ATTRIBUTE_UNUSED,
 static struct machine_function *
 sparc_init_machine_status (void)
 {
-  return ggc_alloc_cleared (sizeof (struct machine_function));
+  return GGC_CNEW (struct machine_function);
 }
 
 /* Locate some local-dynamic symbol still in use by this function
index a5ca463..6e26d76 100644 (file)
@@ -1208,7 +1208,7 @@ xtensa_expand_nonlocal_goto (rtx *operands)
 static struct machine_function *
 xtensa_init_machine_status (void)
 {
-  return ggc_alloc_cleared (sizeof (struct machine_function));
+  return GGC_CNEW (struct machine_function);
 }
 
 
index 899679c..418da24 100644 (file)
@@ -3101,7 +3101,7 @@ static int
 find_auto_inc (rtx *xp, void *data)
 {
   rtx x = *xp;
-  rtx reg = data;
+  rtx reg = (rtx) data;
 
   if (GET_RTX_CLASS (GET_CODE (x)) != RTX_AUTOINC)
     return 0;
index a8c6218..3da40a8 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1242,7 +1242,7 @@ translate_options (int *argcp, const char *const **argvp)
                }
 
              newvsize += spaces * sizeof (const char *);
-             newv =  xrealloc (newv, newvsize);
+             newv =  XRESIZEVAR (const char *, newv, newvsize);
 
              sp = target_option_translations[tott_idx].replacements;
              np = xstrdup (sp);
@@ -3955,7 +3955,7 @@ 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 = xmalloc (strlen (modify_target[j].str)
+                   char *new_name = XNEWVEC (char, strlen (modify_target[j].str)
                                              + strlen (spec_machine));
                    const char *p, *r;
                    char *q;
index c20c337..7135a18 100644 (file)
@@ -3834,7 +3834,7 @@ dbr_schedule (rtx first)
        epilogue_insn = insn;
     }
 
-  uid_to_ruid = xmalloc ((max_uid + 1) * sizeof (int));
+  uid_to_ruid = XNEWVEC (int, max_uid + 1);
   for (i = 0, insn = first; insn; i++, insn = NEXT_INSN (insn))
     uid_to_ruid[INSN_UID (insn)] = i;
 
@@ -3842,7 +3842,7 @@ dbr_schedule (rtx first)
   if (unfilled_firstobj == 0)
     {
       gcc_obstack_init (&unfilled_slots_obstack);
-      unfilled_firstobj = obstack_alloc (&unfilled_slots_obstack, 0);
+      unfilled_firstobj = XOBNEWVAR (&unfilled_slots_obstack, rtx, 0);
     }
 
   for (insn = next_active_insn (first); insn; insn = next_active_insn (insn))
@@ -3917,7 +3917,7 @@ dbr_schedule (rtx first)
   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 = obstack_alloc (&unfilled_slots_obstack, 0);
+  unfilled_firstobj = XOBNEWVAR (&unfilled_slots_obstack, rtx, 0);
 
   if (dump_file)
     {
index 6d9689c..8836a97 100644 (file)
@@ -1636,7 +1636,7 @@ sdbout_start_source_file (unsigned int line ATTRIBUTE_UNUSED,
                          const char *filename ATTRIBUTE_UNUSED)
 {
 #ifdef MIPS_DEBUGGING_INFO
-  struct sdb_file *n = xmalloc (sizeof *n);
+  struct sdb_file *n = XNEW (struct sdb_file);
 
   n->next = current_file;
   n->name = filename;
@@ -1668,7 +1668,7 @@ sdbout_init (const char *input_file_name ATTRIBUTE_UNUSED)
   tree t;
 
 #ifdef MIPS_DEBUGGING_INFO
-  current_file = xmalloc (sizeof *current_file);
+  current_file = XNEW (struct sdb_file);
   current_file->next = NULL;
   current_file->name = input_file_name;
 #endif
index fb99903..3c63e81 100644 (file)
@@ -413,7 +413,7 @@ xcoffout_declare_function (FILE *file, tree decl, const char *name)
   len = strlen (name);
   if (name[len - 1] == ']')
     {
-      char *n = alloca (len - 3);
+      char *n = XALLOCAVEC (char, len - 3);
       memcpy (n, name, len - 4);
       n[len - 4] = '\0';
       name = n;