* 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.
java:
* 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.
objc:
* 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.
From-SVN: r136980
+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.
/* 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;
#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;
-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");
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);
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;
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--)
{
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;
{
/* 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;
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;
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);
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
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.
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"));
}
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);
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);
}
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);
}
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;
if (temp)
{
const char *startp, *endp;
- char *nstore = alloca (strlen (temp) + 3);
+ char *nstore = (char *) alloca (strlen (temp) + 3);
startp = endp = temp;
while (1)
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)
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)
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];
}
/* 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;
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++)
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;
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);
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);
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';
{
if (t == 0)
{
- t = xmalloc (sizeof (struct temp_name));
+ t = XNEW (struct temp_name);
t->next = temp_names;
temp_names = t;
}
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++)
}
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;
/* 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]))
/* 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;
/* 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);
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')
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] = '\\';
+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.
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++)
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++)
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); \
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);
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. */
{
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);
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))
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;
{
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
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;
}
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. */
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)
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);
if (cpool == NULL)
{
- cpool = ggc_alloc_cleared (sizeof (struct CPool));
+ cpool = GGC_CNEW (struct CPool);
TYPE_CPOOL (class) = cpool;
}
return cpool;
make_binding_level (void)
{
/* NOSTRICT */
- return ggc_alloc_cleared (sizeof (struct binding_level));
+ return GGC_CNEW (struct binding_level);
}
void
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;
}
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));
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;
{
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;
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);
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);
#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; \
}
#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)
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;
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);
/* 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))
else
{
int len = strlen (s);
- char *d = xmalloc (len + 1);
+ char *d = XNEWVAR (char, len + 1);
const char *sp;
char *dp;
/* 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 (;;)
}
else
{
- filenames = xmalloc (sizeof (char*));
+ filenames = XNEWVEC (char *, 1);
filenames[0] = reverse (fsource_filename);
num_files = 1;
}
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;
{
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)
{
count = next - list;
avail = 2 * (count + avail);
- list = xrealloc (list, avail);
+ list = XRESIZEVEC (char, list, avail);
next = list + count;
avail = avail - count;
}
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;
}
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;
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 ();
}
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);
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';
if (cp)
{
- char *buf = alloca (strlen (cp) + 3);
+ char *buf = (char *) alloca (strlen (cp) + 3);
startp = endp = cp;
while (1)
{
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
/* 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")],
if (cp)
{
- char *buf = alloca (strlen (cp) + 3);
+ char *buf = (char *) alloca (strlen (cp) + 3);
startp = endp = cp;
while (1)
{
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]))
{
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));
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 *);
}
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);
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;
}
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;
}
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;
+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):
/* %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);
/* 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 }) */
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;
}
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;
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;
}
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);
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);
*e = v = XCNEW (struct symbol_hash_entry);
v->key = xstrdup (string);
}
- return *e;
+ return (struct symbol_hash_entry *) *e;
}
static htab_t file_table;
*e = v = XCNEW (struct file_hash_entry);
v->key = xstrdup (string);
}
- return *e;
+ return (struct file_hash_entry *) *e;
}
static htab_t demangled_table;
*e = v = XCNEW (struct demangled_hash_entry);
v->key = xstrdup (string);
}
- return *e;
+ return (struct demangled_hash_entry *) *e;
}
\f
/* Stack code. */
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;
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;
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 *