diff options
-rw-r--r-- | gcc/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/collect2.c | 13 | ||||
-rw-r--r-- | gcc/gcc.c | 78 | ||||
-rw-r--r-- | gcc/java/ChangeLog | 27 | ||||
-rw-r--r-- | gcc/java/class.c | 24 | ||||
-rw-r--r-- | gcc/java/constants.c | 14 | ||||
-rw-r--r-- | gcc/java/decl.c | 6 | ||||
-rw-r--r-- | gcc/java/except.c | 4 | ||||
-rw-r--r-- | gcc/java/expr.c | 4 | ||||
-rw-r--r-- | gcc/java/java-tree.h | 5 | ||||
-rw-r--r-- | gcc/java/jcf-io.c | 9 | ||||
-rw-r--r-- | gcc/java/jcf-parse.c | 24 | ||||
-rw-r--r-- | gcc/java/jcf-path.c | 12 | ||||
-rw-r--r-- | gcc/java/jcf-reader.c | 4 | ||||
-rw-r--r-- | gcc/java/jvgenmain.c | 2 | ||||
-rw-r--r-- | gcc/java/lang.c | 2 | ||||
-rw-r--r-- | gcc/java/verify-impl.c | 6 | ||||
-rw-r--r-- | gcc/objc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 18 | ||||
-rw-r--r-- | gcc/tlink.c | 15 |
20 files changed, 165 insertions, 122 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 78a136d..f36890c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2008-06-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * collect2.c (main, add_to_list): Fix for -Wc++-compat. + * gcc.c (translate_options, init_spec, store_arg, read_specs, + add_to_obstack, file_at_path, find_a_file, execute, + add_preprocessor_option, add_assembler_option, add_linker_option, + process_command, insert_wrapper, do_option_spec, do_self_spec, + spec_path, do_spec_1, is_directory, main, used_arg, + getenv_spec_function): Likewise. + * tlink.c (symbol_hash_lookup, file_hash_lookup, + demangled_hash_lookup, symbol_push, file_push, frob_extension): + Likewise. + 2008-06-19 Kenneth Zadeck <zadeck@naturalbridge.com> * doc/rtl.texi: Updated subreg section. diff --git a/gcc/collect2.c b/gcc/collect2.c index 531b122..dbd5806 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -846,9 +846,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 = xcalloc(sizeof (char *), argc+4)); - ld2 = (const char **)(ld2_argv = xcalloc(sizeof (char *), argc+11)); - object = (const char **)(object_lst = xcalloc(sizeof (char *), argc)); + ld1 = (const char **)(ld1_argv = XCNEWVEC (char *, argc+4)); + ld2 = (const char **)(ld2_argv = XCNEWVEC (char *, argc+11)); + object = (const char **)(object_lst = XCNEWVEC (char *, argc)); #ifdef DEBUG debug = 1; @@ -875,7 +875,7 @@ main (int argc, char **argv) #endif obstack_begin (&temporary_obstack, 0); - temporary_firstobj = obstack_alloc (&temporary_obstack, 0); + temporary_firstobj = (char *) obstack_alloc (&temporary_obstack, 0); #ifndef HAVE_LD_DEMANGLE current_demangling_style = auto_demangling; @@ -893,7 +893,7 @@ main (int argc, char **argv) -fno-exceptions -w */ num_c_args += 5; - c_ptr = (const char **) (c_argv = xcalloc (sizeof (char *), num_c_args)); + c_ptr = (const char **) (c_argv = XCNEWVEC (char *, num_c_args)); if (argc < 2) fatal ("no arguments"); @@ -1676,7 +1676,8 @@ static long sequence_number = 0; static void add_to_list (struct head *head_ptr, const char *name) { - struct id *newid = xcalloc (sizeof (struct id) + strlen (name), 1); + struct id *newid + = (struct id *) xcalloc (sizeof (struct id) + strlen (name), 1); struct id *p; strcpy (newid->name, name); @@ -1212,7 +1212,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 = xmalloc (newvsize); + const char **newv = XNEWVAR (const char *, newvsize); int newindex = 0; i = 0; @@ -1716,8 +1716,7 @@ init_spec (void) notice ("Using built-in specs.\n"); #ifdef EXTRA_SPECS - extra_specs = xcalloc (sizeof (struct spec_list), - ARRAY_SIZE (extra_specs_1)); + extra_specs = XCNEWVEC (struct spec_list, ARRAY_SIZE (extra_specs_1)); for (i = ARRAY_SIZE (extra_specs_1) - 1; i >= 0; i--) { @@ -1980,7 +1979,7 @@ static void store_arg (const char *arg, int delete_always, int delete_failure) { if (argbuf_index + 1 == argbuf_length) - argbuf = xrealloc (argbuf, (argbuf_length *= 2) * sizeof (const char *)); + argbuf = XRESIZEVEC (const char *, argbuf, (argbuf_length *= 2)); argbuf[argbuf_index++] = arg; argbuf[argbuf_index] = 0; @@ -2272,8 +2271,7 @@ read_specs (const char *filename, int main_p) { /* Add this pair to the vector. */ compilers - = xrealloc (compilers, - (n_compilers + 2) * sizeof (struct compiler)); + = XRESIZEVEC (struct compiler, compilers, n_compilers + 2); compilers[n_compilers].suffix = suffix; compilers[n_compilers].spec = spec; @@ -2594,7 +2592,7 @@ struct add_to_obstack_info { static void * add_to_obstack (char *path, void *data) { - struct add_to_obstack_info *info = data; + struct add_to_obstack_info *info = (struct add_to_obstack_info *) data; if (info->check_dir && !is_directory (path, false)) return NULL; @@ -2688,7 +2686,7 @@ struct file_at_path_info { static void * file_at_path (char *path, void *data) { - struct file_at_path_info *info = data; + struct file_at_path_info *info = (struct file_at_path_info *) data; size_t len = strlen (path); memcpy (path + len, info->name, info->name_len); @@ -2747,8 +2745,9 @@ find_a_file (const struct path_prefix *pprefix, const char *name, int mode, info.suffix_len = strlen (info.suffix); info.mode = mode; - return for_each_path (pprefix, do_multi, info.name_len + info.suffix_len, - file_at_path, &info); + return (char*) for_each_path (pprefix, do_multi, + info.name_len + info.suffix_len, + file_at_path, &info); } /* Ranking of prefixes in the sort list. -B prefixes are put before @@ -2867,7 +2866,7 @@ execute (void) n_commands++; /* Get storage for each command. */ - commands = alloca (n_commands * sizeof (struct command)); + commands = (struct command *) alloca (n_commands * sizeof (struct command)); /* Split argbuf into its separate piped processes, and record info about each one. @@ -3029,13 +3028,13 @@ execute (void) struct pex_time *times = NULL; int ret_code = 0; - statuses = alloca (n_commands * sizeof (int)); + statuses = (int *) alloca (n_commands * sizeof (int)); if (!pex_get_status (pex, n_commands, statuses)) pfatal_with_name (_("failed to get exit status")); if (report_times) { - times = alloca (n_commands * sizeof (struct pex_time)); + times = (struct pex_time *) alloca (n_commands * sizeof (struct pex_time)); if (!pex_get_times (pex, n_commands, times)) pfatal_with_name (_("failed to get process times")); } @@ -3295,8 +3294,8 @@ add_preprocessor_option (const char *option, int len) if (! preprocessor_options) preprocessor_options = XNEWVEC (char *, n_preprocessor_options); else - preprocessor_options = xrealloc (preprocessor_options, - n_preprocessor_options * sizeof (char *)); + preprocessor_options = XRESIZEVEC (char *, preprocessor_options, + n_preprocessor_options); preprocessor_options [n_preprocessor_options - 1] = save_string (option, len); @@ -3310,8 +3309,8 @@ add_assembler_option (const char *option, int len) if (! assembler_options) assembler_options = XNEWVEC (char *, n_assembler_options); else - assembler_options = xrealloc (assembler_options, - n_assembler_options * sizeof (char *)); + assembler_options = XRESIZEVEC (char *, assembler_options, + n_assembler_options); assembler_options [n_assembler_options - 1] = save_string (option, len); } @@ -3324,8 +3323,7 @@ add_linker_option (const char *option, int len) if (! linker_options) linker_options = XNEWVEC (char *, n_linker_options); else - linker_options = xrealloc (linker_options, - n_linker_options * sizeof (char *)); + linker_options = XRESIZEVEC (char *, linker_options, n_linker_options); linker_options [n_linker_options - 1] = save_string (option, len); } @@ -3411,14 +3409,14 @@ process_command (int argc, const char **argv) for (baselen = strlen (progname); baselen > 0; baselen--) if (IS_DIR_SEPARATOR (progname[baselen-1])) break; - new_argv0 = xmemdup (progname, baselen, + new_argv0 = (char *) xmemdup (progname, baselen, baselen + concat_length (new_version, new_machine, "-gcc-", NULL) + 1); strcpy (new_argv0 + baselen, new_machine); strcat (new_argv0, "-gcc-"); strcat (new_argv0, new_version); - new_argv = xmemdup (argv, (argc + 1) * sizeof (argv[0]), + new_argv = (char **) xmemdup (argv, (argc + 1) * sizeof (argv[0]), (argc + 1) * sizeof (argv[0])); new_argv[0] = new_argv0; @@ -3494,7 +3492,7 @@ process_command (int argc, const char **argv) if (temp) { const char *startp, *endp; - char *nstore = alloca (strlen (temp) + 3); + char *nstore = (char *) alloca (strlen (temp) + 3); startp = endp = temp; while (1) @@ -3528,7 +3526,7 @@ process_command (int argc, const char **argv) if (temp && *cross_compile == '0') { const char *startp, *endp; - char *nstore = alloca (strlen (temp) + 3); + char *nstore = (char *) alloca (strlen (temp) + 3); startp = endp = temp; while (1) @@ -3561,7 +3559,7 @@ process_command (int argc, const char **argv) if (temp && *cross_compile == '0') { const char *startp, *endp; - char *nstore = alloca (strlen (temp) + 3); + char *nstore = (char *) alloca (strlen (temp) + 3); startp = endp = temp; while (1) @@ -4468,7 +4466,7 @@ insert_wrapper (const char *wrapper) argbuf_length = argbuf_length * 2; while (argbuf_length < argbuf_index + n) argbuf_length *= 2; - argbuf = xrealloc (argbuf, argbuf_length * sizeof (const char *)); + argbuf = XRESIZEVEC (const char *, argbuf, argbuf_length); } for (i = argbuf_index - 1; i >= 0; i--) argbuf[i + n] = argbuf[i]; @@ -4568,7 +4566,7 @@ do_option_spec (const char *name, const char *spec) } /* Replace each %(VALUE) by the specified value. */ - tmp_spec = alloca (strlen (spec) + 1 + tmp_spec = (char *) alloca (strlen (spec) + 1 + value_count * (value_len - strlen ("%(VALUE)"))); tmp_spec_p = tmp_spec; q = spec; @@ -4600,8 +4598,7 @@ do_self_spec (const char *spec) first = n_switches; n_switches += argbuf_index; - switches = xrealloc (switches, - sizeof (struct switchstr) * (n_switches + 1)); + switches = XRESIZEVEC (struct switchstr, switches, n_switches + 1); switches[n_switches] = switches[first]; for (i = 0; i < argbuf_index; i++) @@ -4635,7 +4632,7 @@ struct spec_path_info { static void * spec_path (char *path, void *data) { - struct spec_path_info *info = data; + struct spec_path_info *info = (struct spec_path_info *) data; size_t len = 0; char save = 0; @@ -4803,7 +4800,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) char *buf; while (*p != 0 && *p != '\n') p++; - buf = alloca (p - q + 1); + buf = (char *) alloca (p - q + 1); strncpy (buf, q, p - q); buf[p - q] = 0; error ("%s", buf); @@ -4817,7 +4814,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) char *buf; while (*p != 0 && *p != '\n') p++; - buf = alloca (p - q + 1); + buf = (char *) alloca (p - q + 1); strncpy (buf, q, p - q); buf[p - q] = 0; notice ("%s\n", buf); @@ -4921,7 +4918,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) char *tmp; temp_filename_length = basename_length + suffix_length; - tmp = alloca (temp_filename_length + 1); + tmp = (char *) alloca (temp_filename_length + 1); strncpy (tmp, input_basename, basename_length); strncpy (tmp + basename_length, suffix, suffix_length); tmp[temp_filename_length] = '\0'; @@ -4982,7 +4979,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) { if (t == 0) { - t = xmalloc (sizeof (struct temp_name)); + t = XNEW (struct temp_name); t->next = temp_names; temp_names = t; } @@ -5108,7 +5105,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) for (n_files = 0, i = 0; i < max; i++) n_files += outfiles[i] != NULL; - argv = alloca (sizeof (char *) * (n_files + 1)); + argv = (char **) alloca (sizeof (char *) * (n_files + 1)); /* Copy the strings over. */ for (i = 0, j = 0; i < max; i++) @@ -5426,7 +5423,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) } else { - char *x = alloca (strlen (name) * 2 + 1); + char *x = (char *) alloca (strlen (name) * 2 + 1); char *buf = x; const char *y = name; int flag = 0; @@ -6114,7 +6111,7 @@ is_directory (const char *path1, bool linker) /* Ensure the string ends with "/.". The resulting path will be a directory even if the given path is a symbolic link. */ len1 = strlen (path1); - path = alloca (3 + len1); + path = (char *) alloca (3 + len1); memcpy (path, path1, len1); cp = path + len1; if (!IS_DIR_SEPARATOR (cp[-1])) @@ -6323,7 +6320,7 @@ main (int argc, char **argv) /* Initialize the vector of specs to just the default. This means one element containing 0s, as a terminator. */ - compilers = xmalloc (sizeof default_compilers); + compilers = XNEWVAR (struct compiler, sizeof default_compilers); memcpy (compilers, default_compilers, sizeof default_compilers); n_compilers = n_default_compilers; @@ -6342,7 +6339,7 @@ main (int argc, char **argv) /* We need to check standard_exec_prefix/just_machine_suffix/specs for any override of as, ld and libraries. */ - specs_file = alloca (strlen (standard_exec_prefix) + specs_file = (char *) alloca (strlen (standard_exec_prefix) + strlen (just_machine_suffix) + sizeof ("specs")); strcpy (specs_file, standard_exec_prefix); @@ -7175,7 +7172,8 @@ used_arg (const char *p, int len) if (*q == ';') cnt++; - matches = alloca ((sizeof (struct mswitchstr)) * cnt); + matches + = (struct mswitchstr *) alloca ((sizeof (struct mswitchstr)) * cnt); i = 0; q = multilib_matches; while (*q != '\0') @@ -7827,7 +7825,7 @@ getenv_spec_function (int argc, const char **argv) particularly painful case is when we are reading a variable holding a windows path complete with \ separators. */ len = strlen (value) * 2 + strlen (argv[1]) + 1; - result = xmalloc (len); + result = XNEWVAR (char, len); for (ptr = result; *value; ptr += 2) { ptr[0] = '\\'; diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 1941c96..775b82b 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,30 @@ +2008-06-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * class.c (ident_subst, mangled_classname, unmangle_classname, + gen_indirect_dispatch_tables, add_method_1, + build_fieldref_cache_entry, make_local_function_alias, + layout_class, java_treetreehash_find, java_treetreehash_new, + split_qualified_name): Fix for -Wc++-compat. + * constants.c (set_constant_entry, cpool_for_class): Likewise. + * decl.c (make_binding_level, java_dup_lang_specific_decl, + start_java_method): Likewise. + * except.c (prepare_eh_table_type): Likewise. + * expr.c (type_assertion_hash, note_instructions): Likewise. + * java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC, + MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Likewise. + * jcf-io.c (jcf_filbuf_from_stdio, opendir_in_zip, find_class): + Likewise. + * jcf-parse.c (reverse, java_read_sourcefilenames, + annotation_grow, rewrite_reflection_indexes, java_parse_file, + process_zip_dir): Likewise. + * jcf-path.c (add_entry, add_path, jcf_path_init, + jcf_path_extdirs_arg): Likewise. + * jcf-reader.c (jcf_parse_constant_pool): Likewise. + * jvgenmain.c (do_mangle_classname): Likewise. + * lang.c (put_decl_string): Likewise. + * verify-impl.c (make_state_copy, make_state, add_new_state): + Likewise. + 2008-06-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> * gcj.texi: Expand TABs, remove whitespace from blank lines. diff --git a/gcc/java/class.c b/gcc/java/class.c index dff75ac..bf53b47 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -279,7 +279,7 @@ ident_subst (const char* old_name, int prefix_len = strlen (prefix); int suffix_len = strlen (suffix); int i = prefix_len + old_length + suffix_len + 1; - char *buffer = alloca (i); + char *buffer = (char *) alloca (i); strcpy (buffer, prefix); for (i = 0; i < old_length; i++) @@ -349,7 +349,7 @@ mangled_classname (const char *prefix, tree type) rewriting. */ if (illegal_chars != 0) { - char *buffer = alloca (illegal_chars * 4 + len + 1); + char *buffer = (char *) alloca (illegal_chars * 4 + len + 1); int j; for (i = 0, j = 0; i < len; i++) @@ -413,7 +413,7 @@ unmangle_classname (const char *name, int name_length) do \ { \ const char *typename = IDENTIFIER_POINTER (mangled_classname ("", TYPE)); \ - char *buf = alloca (strlen (typename) + strlen (#NAME "_syms_") + 1); \ + char *buf = (char *) alloca (strlen (typename) + strlen (#NAME "_syms_") + 1); \ tree decl; \ \ sprintf (buf, #NAME "_%s", typename); \ @@ -445,7 +445,7 @@ gen_indirect_dispatch_tables (tree type) const char *typename = IDENTIFIER_POINTER (mangled_classname ("", type)); { tree field = NULL; - char *buf = alloca (strlen (typename) + strlen ("_catch_classes_") + 1); + char *buf = (char *) alloca (strlen (typename) + strlen ("_catch_classes_") + 1); tree catch_class_type = make_node (RECORD_TYPE); sprintf (buf, "_catch_classes_%s", typename); @@ -759,7 +759,7 @@ add_method_1 (tree this_class, int access_flags, tree name, tree function_type) DECL_CONTEXT (fndecl) = this_class; DECL_LANG_SPECIFIC (fndecl) - = ggc_alloc_cleared (sizeof (struct lang_decl)); + = GGC_CNEW (struct lang_decl); DECL_LANG_SPECIFIC (fndecl)->desc = LANG_DECL_FUNC; /* Initialize the static initializer test table. */ @@ -1192,7 +1192,7 @@ build_fieldref_cache_entry (int index, tree fdecl ATTRIBUTE_UNUSED) { tree decl, decl_name; const char *name = IDENTIFIER_POINTER (mangled_classname ("_cpool_", output_class)); - char *buf = alloca (strlen (name) + 20); + char *buf = (char *) alloca (strlen (name) + 20); sprintf (buf, "%s_%d_ref", name, index); decl_name = get_identifier (buf); decl = IDENTIFIER_GLOBAL_VALUE (decl_name); @@ -1367,8 +1367,8 @@ make_local_function_alias (tree method) tree alias; const char *method_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (method)); - char *name = alloca (strlen (method_name) + 2); - char *buf = alloca (strlen (method_name) + 128); + char *name = (char *) alloca (strlen (method_name) + 2); + char *buf = (char *) alloca (strlen (method_name) + 128); /* Only create aliases for local functions. */ if (DECL_EXTERNAL (method)) @@ -2421,7 +2421,7 @@ layout_class (tree this_class) obstack_grow (&temporary_obstack, buffer, strlen (buffer)); } obstack_1grow (&temporary_obstack, '\0'); - report = obstack_finish (&temporary_obstack); + report = XOBFINISH (&temporary_obstack, char *); cyclic_inheritance_report = ggc_strdup (report); obstack_free (&temporary_obstack, report); TYPE_SIZE (this_class) = error_mark_node; @@ -3088,7 +3088,7 @@ java_treetreehash_find (htab_t ht, tree t) { struct treetreehash_entry *e; hashval_t hv = JAVA_TREEHASHHASH_H (t); - e = htab_find_with_hash (ht, t, hv); + e = (struct treetreehash_entry *) htab_find_with_hash (ht, t, hv); if (e == NULL) return NULL; else @@ -3105,7 +3105,7 @@ java_treetreehash_new (htab_t ht, tree t) e = htab_find_slot_with_hash (ht, t, hv, INSERT); if (*e == NULL) { - tthe = (*ht->alloc_f) (1, sizeof (*tthe)); + tthe = (struct treetreehash_entry *) (*ht->alloc_f) (1, sizeof (*tthe)); tthe->key = t; *e = tthe; } @@ -3135,7 +3135,7 @@ split_qualified_name (tree *left, tree *right, tree source) char *p, *base; int l = IDENTIFIER_LENGTH (source); - base = alloca (l + 1); + base = (char *) alloca (l + 1); memcpy (base, IDENTIFIER_POINTER (source), l + 1); /* Breakdown NAME into REMAINDER . IDENTIFIER. */ diff --git a/gcc/java/constants.c b/gcc/java/constants.c index 5294285..f3436cf 100644 --- a/gcc/java/constants.c +++ b/gcc/java/constants.c @@ -44,9 +44,8 @@ set_constant_entry (CPool *cpool, int index, int tag, jword value) if (cpool->data == NULL) { cpool->capacity = 100; - cpool->tags = ggc_alloc_cleared (sizeof(uint8) * cpool->capacity); - cpool->data = ggc_alloc_cleared (sizeof(union cpool_entry) - * cpool->capacity); + cpool->tags = GGC_CNEWVEC (uint8, cpool->capacity); + cpool->data = GGC_CNEWVEC (union cpool_entry, cpool->capacity); cpool->count = 1; } if (index >= cpool->capacity) @@ -55,10 +54,9 @@ set_constant_entry (CPool *cpool, int index, int tag, jword value) cpool->capacity *= 2; if (index >= cpool->capacity) cpool->capacity = index + 10; - cpool->tags = ggc_realloc (cpool->tags, - sizeof(uint8) * cpool->capacity); - cpool->data = ggc_realloc (cpool->data, - sizeof(union cpool_entry) * cpool->capacity); + cpool->tags = GGC_RESIZEVEC (uint8, cpool->tags, cpool->capacity); + cpool->data = GGC_RESIZEVEC (union cpool_entry, cpool->data, + cpool->capacity); /* Make sure GC never sees uninitialized tag values. */ memset (cpool->tags + old_cap, 0, cpool->capacity - old_cap); @@ -335,7 +333,7 @@ cpool_for_class (tree class) if (cpool == NULL) { - cpool = ggc_alloc_cleared (sizeof (struct CPool)); + cpool = GGC_CNEW (struct CPool); TYPE_CPOOL (class) = cpool; } return cpool; diff --git a/gcc/java/decl.c b/gcc/java/decl.c index fcc1c12..8ed8926 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -1254,7 +1254,7 @@ static struct binding_level * make_binding_level (void) { /* NOSTRICT */ - return ggc_alloc_cleared (sizeof (struct binding_level)); + return GGC_CNEW (struct binding_level); } void @@ -1593,7 +1593,7 @@ java_dup_lang_specific_decl (tree node) return; lang_decl_size = sizeof (struct lang_decl); - x = ggc_alloc (lang_decl_size); + x = GGC_NEW (struct lang_decl); memcpy (x, DECL_LANG_SPECIFIC (node), lang_decl_size); DECL_LANG_SPECIFIC (node) = x; } @@ -1720,7 +1720,7 @@ start_java_method (tree fndecl) i = DECL_MAX_LOCALS(fndecl) + DECL_MAX_STACK(fndecl); decl_map = make_tree_vec (i); base_decl_map = make_tree_vec (i); - type_map = xrealloc (type_map, i * sizeof (tree)); + type_map = XRESIZEVEC (tree, type_map, i); #if defined(DEBUG_JAVA_BINDING_LEVELS) fprintf (stderr, "%s:\n", lang_printable_name (fndecl, 2)); diff --git a/gcc/java/except.c b/gcc/java/except.c index 02203e7..01e2fbe 100644 --- a/gcc/java/except.c +++ b/gcc/java/except.c @@ -391,7 +391,7 @@ prepare_eh_table_type (tree type) if (is_compiled_class (type) && !flag_indirect_dispatch) { name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))); - buf = alloca (strlen (name) + 5); + buf = (char *) alloca (strlen (name) + 5); sprintf (buf, "%s_ref", name); decl = build_decl (VAR_DECL, get_identifier (buf), ptr_type_node); TREE_STATIC (decl) = 1; @@ -408,7 +408,7 @@ prepare_eh_table_type (tree type) { utf8_ref = build_utf8_ref (DECL_NAME (TYPE_NAME (type))); name = IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (utf8_ref, 0))); - buf = alloca (strlen (name) + 5); + buf = (char *) alloca (strlen (name) + 5); sprintf (buf, "%s_ref", name); decl = build_decl (VAR_DECL, get_identifier (buf), utf8const_ptr_type); TREE_STATIC (decl) = 1; diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 75c18e5..654a25e 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -430,7 +430,7 @@ type_assertion_eq (const void * k1_p, const void * k2_p) static hashval_t type_assertion_hash (const void *p) { - const type_assertion *k_p = p; + const type_assertion *k_p = (const type_assertion *) p; hashval_t hash = iterative_hash (&k_p->assertion_code, sizeof k_p->assertion_code, 0); @@ -3009,7 +3009,7 @@ note_instructions (JCF *jcf, tree method) JCF_SEEK (jcf, DECL_CODE_OFFSET (method)); byte_ops = jcf->read_ptr; - instruction_bits = xrealloc (instruction_bits, length + 1); + instruction_bits = XRESIZEVAR (char, instruction_bits, length + 1); memset (instruction_bits, 0, length + 1); type_states = VEC_alloc (tree, gc, length + 1); VEC_safe_grow_cleared (tree, gc, type_states, length + 1); diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index 02f93e2..65a7589 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -769,8 +769,7 @@ union lang_tree_node #define MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC(T) \ if (DECL_LANG_SPECIFIC (T) == NULL) \ { \ - DECL_LANG_SPECIFIC ((T)) \ - = ggc_alloc_cleared (sizeof (struct lang_decl)); \ + DECL_LANG_SPECIFIC ((T)) = GGC_CNEW (struct lang_decl); \ DECL_LANG_SPECIFIC (T)->desc = LANG_DECL_VAR; \ } @@ -900,7 +899,7 @@ struct lang_decl GTY(()) #define MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC(T) \ if (TYPE_LANG_SPECIFIC ((T)) == NULL) \ TYPE_LANG_SPECIFIC ((T)) \ - = ggc_alloc_cleared (sizeof (struct lang_type)); + = GGC_CNEW (struct lang_type); #define TYPE_DUMMY(T) (TYPE_LANG_SPECIFIC(T)->dummy_class) diff --git a/gcc/java/jcf-io.c b/gcc/java/jcf-io.c index f639e10..fb8f756 100644 --- a/gcc/java/jcf-io.c +++ b/gcc/java/jcf-io.c @@ -78,8 +78,9 @@ jcf_filbuf_from_stdio (JCF *jcf, int count) JCF_u4 old_read_end = jcf->read_end - jcf->buffer; JCF_u4 old_size = jcf->buffer_end - jcf->buffer; JCF_u4 new_size = (old_size == 0 ? 2000 : 2 * old_size) + count; - unsigned char *new_buffer = jcf->buffer == NULL ? ALLOC (new_size) - : REALLOC (jcf->buffer, new_size); + unsigned char *new_buffer + = jcf->buffer == NULL ? XNEWVAR (unsigned char, new_size) + : XRESIZEVAR (unsigned char, jcf->buffer, new_size); jcf->buffer = new_buffer; jcf->buffer_end = new_buffer + new_size; jcf->read_ptr = new_buffer + old_read_ptr; @@ -115,7 +116,7 @@ opendir_in_zip (const char *zipfile, int is_system) return zipf; } - zipf = ALLOC (sizeof (struct ZipFile) + strlen (zipfile) + 1); + zipf = XNEWVAR (struct ZipFile, sizeof (struct ZipFile) + strlen (zipfile) + 1); zipf->next = SeenZipFiles; zipf->name = (char*)(zipf+1); strcpy (zipf->name, zipfile); @@ -471,7 +472,7 @@ find_class (const char *classname, int classname_length, JCF *jcf) /* Allocate and zero out the buffer, since we don't explicitly put a null pointer when we're copying it below. */ buflen = jcf_path_max_len () + classname_length + 10; - buffer = ALLOC (buflen); + buffer = XNEWVAR (char, buflen); memset (buffer, 0, buflen); for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry)) diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index 11b18a2..c53e871c 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -145,7 +145,7 @@ reverse (const char *s) else { int len = strlen (s); - char *d = xmalloc (len + 1); + char *d = XNEWVAR (char, len + 1); const char *sp; char *dp; @@ -213,11 +213,11 @@ java_read_sourcefilenames (const char *fsource_filename) /* Read the filenames. Put a pointer to each filename into the array FILENAMES. */ { - char *linebuf = alloca (longest_line + 1); + char *linebuf = (char *) alloca (longest_line + 1); int i = 0; int charpos; - filenames = xmalloc (num_files * sizeof (char*)); + filenames = XNEWVEC (char *, num_files); charpos = 0; for (;;) @@ -249,7 +249,7 @@ java_read_sourcefilenames (const char *fsource_filename) } else { - filenames = xmalloc (sizeof (char*)); + filenames = XNEWVEC (char *, 1); filenames[0] = reverse (fsource_filename); num_files = 1; } @@ -391,13 +391,13 @@ annotation_grow (int delta) if (*data == NULL) { - *data = xmalloc (delta); + *data = XNEWVAR (unsigned char, delta); } else { int newlen = *datasize + delta; if (floor_log2 (newlen) != floor_log2 (*datasize)) - *data = xrealloc (*data, 2 << (floor_log2 (newlen))); + *data = XRESIZEVAR (unsigned char, *data, 2 << (floor_log2 (newlen))); } *datasize += delta; return *data + len; @@ -746,7 +746,7 @@ rewrite_reflection_indexes (void *arg) { bitmap_iterator bi; unsigned int offset; - VEC(int, heap) *map = arg; + VEC(int, heap) *map = (VEC(int, heap) *) arg; unsigned char *data = TYPE_REFLECTION_DATA (current_class); if (map) @@ -1731,7 +1731,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED) { count = next - list; avail = 2 * (count + avail); - list = xrealloc (list, avail); + list = XRESIZEVEC (char, list, avail); next = list + count; avail = avail - count; } @@ -1877,7 +1877,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED) if (magic == 0xcafebabe) { CLASS_FILE_P (node) = 1; - current_jcf = ggc_alloc (sizeof (JCF)); + current_jcf = GGC_NEW (JCF); JCF_ZERO (current_jcf); current_jcf->read_state = finput; current_jcf->filbuf = jcf_filbuf_from_stdio; @@ -1895,7 +1895,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED) } else if (magic == (JCF_u4)ZIPMAGIC) { - main_jcf = ggc_alloc (sizeof (JCF)); + main_jcf = GGC_NEW (JCF); JCF_ZERO (main_jcf); main_jcf->read_state = finput; main_jcf->filbuf = jcf_filbuf_from_stdio; @@ -1905,7 +1905,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED) fatal_error ("bad zip/jar file %s", filename); localToFile = SeenZipFiles; /* Register all the classes defined there. */ - process_zip_dir (main_jcf->read_state); + process_zip_dir ((FILE *) main_jcf->read_state); linemap_add (line_table, LC_LEAVE, false, NULL, 0); parse_zip_file_entries (); } @@ -2157,7 +2157,7 @@ process_zip_dir (FILE *finput) class_name = compute_class_name (zdir); file_name = XNEWVEC (char, zdir->filename_length+1); - jcf = ggc_alloc (sizeof (JCF)); + jcf = GGC_NEW (JCF); JCF_ZERO (jcf); strncpy (file_name, class_name_in_zip_dir, zdir->filename_length); diff --git a/gcc/java/jcf-path.c b/gcc/java/jcf-path.c index d0661e7..ca7875c 100644 --- a/gcc/java/jcf-path.c +++ b/gcc/java/jcf-path.c @@ -154,7 +154,7 @@ add_entry (struct entry **entp, const char *filename, int is_system) work more easily. Eww. */ if (! IS_DIR_SEPARATOR (filename[len - 1])) { - char *f2 = alloca (len + 2); + char *f2 = (char *) alloca (len + 2); strcpy (f2, filename); f2[len] = DIR_SEPARATOR; f2[len + 1] = '\0'; @@ -177,7 +177,7 @@ add_path (struct entry **entp, const char *cp, int is_system) if (cp) { - char *buf = alloca (strlen (cp) + 3); + char *buf = (char *) alloca (strlen (cp) + 3); startp = endp = cp; while (1) { @@ -227,7 +227,7 @@ jcf_path_init (void) GET_ENVIRONMENT (cp, "GCC_EXEC_PREFIX"); if (cp) { - try = alloca (strlen (cp) + 50); + try = (char *) alloca (strlen (cp) + 50); /* The exec prefix can be something like /usr/local/bin/../lib/gcc-lib/. We want to change this into a pointer to the share/java directory. We support two @@ -285,7 +285,7 @@ jcf_path_init (void) /* Desperation: use the installed one. */ char *extdirs; add_entry (&sys_dirs, LIBGCJ_ZIP_FILE, 1); - extdirs = alloca (strlen (LIBGCJ_ZIP_FILE) + 1); + extdirs = (char *) alloca (strlen (LIBGCJ_ZIP_FILE) + 1); strcpy (extdirs, LIBGCJ_ZIP_FILE); strcpy (&extdirs[strlen (LIBGCJ_ZIP_FILE) - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")], @@ -329,7 +329,7 @@ jcf_path_extdirs_arg (const char *cp) if (cp) { - char *buf = alloca (strlen (cp) + 3); + char *buf = (char *) alloca (strlen (cp) + 3); startp = endp = cp; while (1) { @@ -358,7 +358,7 @@ jcf_path_extdirs_arg (const char *cp) if (direntp->d_name[0] != '.') { - char *name = alloca (dirname_length + char *name = (char *) alloca (dirname_length + strlen (direntp->d_name) + 2); strcpy (name, buf); if (! IS_DIR_SEPARATOR (name[dirname_length-1])) diff --git a/gcc/java/jcf-reader.c b/gcc/java/jcf-reader.c index 25517d6..c437d16 100644 --- a/gcc/java/jcf-reader.c +++ b/gcc/java/jcf-reader.c @@ -330,8 +330,8 @@ jcf_parse_constant_pool (JCF* jcf) { int i, n; JPOOL_SIZE (jcf) = (JCF_FILL (jcf, 2), JCF_readu2 (jcf)); - jcf->cpool.tags = ggc_alloc (JPOOL_SIZE (jcf)); - jcf->cpool.data = ggc_alloc (sizeof (jword) * JPOOL_SIZE (jcf)); + jcf->cpool.tags = GGC_NEWVAR (uint8, JPOOL_SIZE (jcf)); + jcf->cpool.data = GGC_NEWVAR (union cpool_entry, sizeof (jword) * JPOOL_SIZE (jcf)); jcf->cpool.tags[0] = 0; #ifdef HANDLE_START_CONSTANT_POOL HANDLE_START_CONSTANT_POOL (JPOOL_SIZE (jcf)); diff --git a/gcc/java/jvgenmain.c b/gcc/java/jvgenmain.c index 33d95ec..6b7fa4c 100644 --- a/gcc/java/jvgenmain.c +++ b/gcc/java/jvgenmain.c @@ -177,5 +177,5 @@ do_mangle_classname (const char *string) append_gpp_mangled_name (&ptr [-count], count); obstack_grow (mangle_obstack, "6class$E", strlen ("6class$E")); obstack_1grow (mangle_obstack, '\0'); - return obstack_finish (mangle_obstack); + return XOBFINISH (mangle_obstack, char *); } diff --git a/gcc/java/lang.c b/gcc/java/lang.c index fa98114..71f2478 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -389,7 +389,7 @@ put_decl_string (const char *str, int len) else { decl_buflen *= 2; - decl_buf = xrealloc (decl_buf, decl_buflen); + decl_buf = XRESIZEVAR (char, decl_buf, decl_buflen); } } strcpy (decl_buf + decl_bufpos, str); diff --git a/gcc/java/verify-impl.c b/gcc/java/verify-impl.c index 1efcf68..69fb031 100644 --- a/gcc/java/verify-impl.c +++ b/gcc/java/verify-impl.c @@ -983,7 +983,7 @@ copy_state_with_stack (state *s, state *orig, int max_stack, int max_locals) static state * make_state_copy (state *orig, int max_stack, int max_locals) { - state *s = vfy_alloc (sizeof (state)); + state *s = (state *) vfy_alloc (sizeof (state)); copy_state_with_stack (s, orig, max_stack, max_locals); return s; } @@ -991,7 +991,7 @@ make_state_copy (state *orig, int max_stack, int max_locals) static state * make_state (int max_stack, int max_locals) { - state *s = vfy_alloc (sizeof (state)); + state *s = (state *) vfy_alloc (sizeof (state)); init_state_with_stack (s, max_stack, max_locals); return s; } @@ -1385,7 +1385,7 @@ add_new_state (int npc, state *old_state) debug_print_state (new_state, "New", npc, current_method->max_stack, current_method->max_locals); - nlink = vfy_alloc (sizeof (state_list)); + nlink = (state_list *) vfy_alloc (sizeof (state_list)); nlink->val = new_state; nlink->next = vfr->states[npc]; vfr->states[npc] = nlink; diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 62fb91d..f5869b3 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,10 @@ +2008-06-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * objc-act.c (setup_string_decl, objc_build_string_object, + hash_interface, eq_interface, objc_begin_try_stmt, + encode_method_prototype, build_ivar_list_initializer, + objc_build_encode_expr): Fix for -Wc++-compat. + 2008-05-12 Tomas Bily <tbily@suse.cz> * objc-act.c (objc_generate_write_barrier, objc_finish_message_expr): diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index b19821c..4aef9a0 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -1500,7 +1500,7 @@ setup_string_decl (void) /* %s in format will provide room for terminating null */ length = strlen (STRING_OBJECT_GLOBAL_FORMAT) + strlen (constant_string_class_name); - name = xmalloc (length); + name = XNEWVEC (char, length); sprintf (name, STRING_OBJECT_GLOBAL_FORMAT, constant_string_class_name); constant_string_global_id = get_identifier (name); @@ -1929,12 +1929,12 @@ objc_build_string_object (tree string) /* Perhaps we already constructed a constant string just like this one? */ key.literal = string; loc = htab_find_slot (string_htab, &key, INSERT); - desc = *loc; + desc = (struct string_descriptor *) *loc; if (!desc) { tree var; - *loc = desc = ggc_alloc (sizeof (*desc)); + *loc = desc = GGC_NEW (struct string_descriptor); desc->literal = string; /* GNU: (NXConstantString *) & ((__builtin_ObjCString) { NULL, string, length }) */ @@ -3290,14 +3290,14 @@ static GTY ((param_is (struct interface_tuple))) htab_t interface_htab; static hashval_t hash_interface (const void *p) { - const struct interface_tuple *d = p; + const struct interface_tuple *d = (const struct interface_tuple *) p; return IDENTIFIER_HASH_VALUE (d->id); } static int eq_interface (const void *p1, const void *p2) { - const struct interface_tuple *d = p1; + const struct interface_tuple *d = (const struct interface_tuple *) p1; return d->id == p2; } @@ -3751,7 +3751,7 @@ next_sjlj_build_try_catch_finally (void) void objc_begin_try_stmt (location_t try_locus, tree body) { - struct objc_try_context *c = xcalloc (1, sizeof (*c)); + struct objc_try_context *c = XCNEW (struct objc_try_context); c->outer = cur_try_context; c->try_body = body; c->try_locus = try_locus; @@ -4348,7 +4348,7 @@ encode_method_prototype (tree method_decl) finish_encoding: obstack_1grow (&util_obstack, '\0'); - result = get_identifier (obstack_finish (&util_obstack)); + result = get_identifier (XOBFINISH (&util_obstack, char *)); obstack_free (&util_obstack, util_firstobj); return result; } @@ -5160,7 +5160,7 @@ build_ivar_list_initializer (tree type, tree field_decl) ivar = tree_cons (NULL_TREE, - add_objc_string (get_identifier (obstack_finish (&util_obstack)), + add_objc_string (get_identifier (XOBFINISH (&util_obstack, char *)), meth_var_types), ivar); obstack_free (&util_obstack, util_firstobj); @@ -6690,7 +6690,7 @@ objc_build_encode_expr (tree type) encode_type (type, obstack_object_size (&util_obstack), OBJC_ENCODE_INLINE_DEFS); obstack_1grow (&util_obstack, 0); /* null terminate string */ - string = obstack_finish (&util_obstack); + string = XOBFINISH (&util_obstack, const char *); /* Synthesize a string that represents the encoded struct/union. */ result = my_build_string (strlen (string) + 1, string); diff --git a/gcc/tlink.c b/gcc/tlink.c index 53c51dc..51f3717 100644 --- a/gcc/tlink.c +++ b/gcc/tlink.c @@ -127,7 +127,7 @@ symbol_hash_lookup (const char *string, int create) *e = v = XCNEW (struct symbol_hash_entry); v->key = xstrdup (string); } - return *e; + return (struct symbol_hash_entry *) *e; } static htab_t file_table; @@ -147,7 +147,7 @@ file_hash_lookup (const char *string) *e = v = XCNEW (struct file_hash_entry); v->key = xstrdup (string); } - return *e; + return (struct file_hash_entry *) *e; } static htab_t demangled_table; @@ -169,7 +169,7 @@ demangled_hash_lookup (const char *string, int create) *e = v = XCNEW (struct demangled_hash_entry); v->key = xstrdup (string); } - return *e; + return (struct demangled_hash_entry *) *e; } /* Stack code. */ @@ -193,8 +193,8 @@ struct file_stack_entry *file_stack; static void symbol_push (symbol *p) { - struct symbol_stack_entry *ep = obstack_alloc - (&symbol_stack_obstack, sizeof (struct symbol_stack_entry)); + struct symbol_stack_entry *ep + = XOBNEW (&symbol_stack_obstack, struct symbol_stack_entry); ep->value = p; ep->next = symbol_stack; symbol_stack = ep; @@ -221,8 +221,7 @@ file_push (file *p) if (p->tweaking) return; - ep = obstack_alloc - (&file_stack_obstack, sizeof (struct file_stack_entry)); + ep = XOBNEW (&file_stack_obstack, struct file_stack_entry); ep->value = p; ep->next = file_stack; file_stack = ep; @@ -298,7 +297,7 @@ frob_extension (const char *s, const char *ext) p = s + strlen (s); obstack_grow (&temporary_obstack, s, p - s); - return obstack_copy0 (&temporary_obstack, ext, strlen (ext)); + return (char *) obstack_copy0 (&temporary_obstack, ext, strlen (ext)); } static char * |