> I suppose it could be argued that we should
> be using these warnings and make
> our code clean, but was it our intent to throw the switch now?
I think it just came with the merge.
I have updated your patch. With it the branch bootstraps again. Looks good?
> --Bill
>
Cheers,
--
Rafael Avila de Espindola
Google Ireland Ltd.
Gordon House
Barrow Street
Dublin 4
Ireland
Registered in Dublin, Ireland
Registration Number: 368047
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 340bed4..21eef39 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -788,7 +788,8 @@ prefix_from_string (const char *p, struct path_prefix *pprefix)
static void
add_lto_object (struct lto_object_list *list, const char *name)
{
- struct lto_object * cell = xmalloc(sizeof(struct lto_object));
+ struct lto_object * cell
+ = (struct lto_object *) xmalloc(sizeof(struct lto_object));
cell->name = name;
cell->next = NULL;
@@ -884,7 +885,7 @@ maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst,
arguments added below. */
num_lto_c_args += 8;
- lto_c_argv = xcalloc (sizeof (char *), num_lto_c_args);
+ lto_c_argv = (char **) xcalloc (sizeof (char *), num_lto_c_args);
lto_c_ptr = (const char **) lto_c_argv;
*lto_c_ptr++ = c_file_name;
diff --git a/gcc/lto-function-in.c b/gcc/lto-function-in.c
index e5f79eb..ce4f243 100644
--- a/gcc/lto-function-in.c
+++ b/gcc/lto-function-in.c
@@ -242,7 +242,8 @@ input_type_ref_1 (struct data_in *data_in, struct lto_input_block *ib)
struct lto_input_block lib;
#ifdef LTO_STREAM_DEBUGGING
- struct lto_input_block *current = lto_debug_context.current_data;
+ struct lto_input_block *current
+ = (struct lto_input_block *) lto_debug_context.current_data;
struct lto_input_block debug;
int current_indent = lto_debug_context.indent;
@@ -399,9 +400,9 @@ canon_file_name (const char *string)
if (*slot == NULL)
{
size_t len = strlen (string);
- char * saved_string = xmalloc (len + 1);
+ char * saved_string = (char *) xmalloc (len + 1);
struct string_slot *new_slot
- = xmalloc (sizeof (struct string_slot));
+ = (struct string_slot *) xmalloc (sizeof (struct string_slot));
strcpy (saved_string, string);
new_slot->s = saved_string;
@@ -657,7 +658,8 @@ input_expr_operand (struct lto_input_block *ib, struct data_in *data_in,
struct lto_input_block lib;
#ifdef LTO_STREAM_DEBUGGING
- struct lto_input_block *current = lto_debug_context.current_data;
+ struct lto_input_block *current
+ = (struct lto_input_block *) lto_debug_context.current_data;
struct lto_input_block debug;
int current_indent = lto_debug_context.indent;
@@ -712,7 +714,8 @@ input_expr_operand (struct lto_input_block *ib, struct data_in *data_in,
struct lto_input_block lib;
#ifdef LTO_STREAM_DEBUGGING
- struct lto_input_block *current = lto_debug_context.current_data;
+ struct lto_input_block *current
+ = (struct lto_input_block *) lto_debug_context.current_data;
struct lto_input_block debug;
int current_indent = lto_debug_context.indent;
@@ -770,7 +773,8 @@ input_expr_operand (struct lto_input_block *ib, struct data_in *data_in,
struct lto_input_block lib;
#ifdef LTO_STREAM_DEBUGGING
- struct lto_input_block *current = lto_debug_context.current_data;
+ struct lto_input_block *current
+ = (struct lto_input_block *) lto_debug_context.current_data;
struct lto_input_block debug;
int current_indent = lto_debug_context.indent;
@@ -1187,7 +1191,7 @@ input_labels (struct lto_input_block *ib, struct data_in *data_in,
code, the unnamed labels have a negative index. Their position
in the array can be found by subtracting that index from the
number of named labels. */
- data_in->labels = xcalloc (named_count + unnamed_count, sizeof (tree));
+ data_in->labels = (tree *) xcalloc (named_count + unnamed_count, sizeof (tree));
for (i = 0; i < named_count; i++)
{
unsigned int name_index = lto_input_uleb128 (ib);
@@ -1211,9 +1215,9 @@ input_local_vars_index (struct lto_input_block *ib, struct data_in *data_in,
unsigned int count)
{
unsigned int i;
- data_in->local_decls_index = xcalloc (count, sizeof (unsigned int));
+ data_in->local_decls_index = (int *) xcalloc (count, sizeof (unsigned int));
#ifdef LTO_STREAM_DEBUGGING
- data_in->local_decls_index_d = xcalloc (count, sizeof (unsigned int));
+ data_in->local_decls_index_d = (int *) xcalloc (count, sizeof (unsigned int));
#endif
for (i = 0; i < count; i++)
@@ -1259,7 +1263,8 @@ input_local_tree (struct lto_input_block *ib, struct data_in *data_in,
struct lto_input_block lib;
#ifdef LTO_STREAM_DEBUGGING
- struct lto_input_block *current = lto_debug_context.current_data;
+ struct lto_input_block *current
+ = (struct lto_input_block *) lto_debug_context.current_data;
struct lto_input_block debug;
int current_indent = lto_debug_context.indent;
@@ -1641,8 +1646,8 @@ input_local_vars (struct lto_input_block *ib, struct data_in *data_in,
int i;
unsigned int tag;
- data_in->local_decl_indexes = xcalloc (count, sizeof (int));
- data_in->local_decls = xcalloc (count, sizeof (tree*));
+ data_in->local_decl_indexes = (int *) xcalloc (count, sizeof (int));
+ data_in->local_decls = (tree *) xcalloc (count, sizeof (tree*));
memset (data_in->local_decl_indexes, -1, count * sizeof (int));
@@ -1981,7 +1986,7 @@ input_function (tree fn_decl, struct data_in *data_in,
/* Fix up the call stmts that are mentioned in the cgraph_edges. */
renumber_gimple_stmt_uids ();
- stmts = xcalloc (gimple_stmt_max_uid(fn), sizeof (tree));
+ stmts = (tree *) xcalloc (gimple_stmt_max_uid(fn), sizeof (tree));
FOR_ALL_BB (bb)
{
block_stmt_iterator bsi;
diff --git a/gcc/lto-function-out.c b/gcc/lto-function-out.c
index deea6d5..f6242cd 100644
--- a/gcc/lto-function-out.c
+++ b/gcc/lto-function-out.c
@@ -132,7 +132,7 @@ static void
string_slot_free (void *p)
{
struct string_slot *slot = (struct string_slot *)p;
- free ((void *)slot->s);
+ free (CONST_CAST (void *, (const void *) slot->s));
free (slot);
}
@@ -159,20 +159,21 @@ clear_line_info (struct output_block *ob)
struct output_block *
create_output_block (enum lto_section_type section_type)
{
- struct output_block *ob = xcalloc (1, sizeof (struct output_block));
+ struct output_block *ob
+ = (struct output_block *) xcalloc (1, sizeof (struct output_block));
ob->section_type = section_type;
ob->decl_state = lto_get_out_decl_state ();
- ob->main_stream = xcalloc (1, sizeof (struct lto_output_stream));
- ob->string_stream = xcalloc (1, sizeof (struct lto_output_stream));
+ ob->main_stream = (struct lto_output_stream *) xcalloc (1, sizeof (struct lto_output_stream));
+ ob->string_stream = (struct lto_output_stream *) xcalloc (1, sizeof (struct lto_output_stream));
if (section_type == LTO_section_function_body)
{
- ob->local_decl_index_stream = xcalloc (1, sizeof (struct lto_output_stream));
- ob->local_decl_stream = xcalloc (1, sizeof (struct lto_output_stream));
- ob->named_label_stream = xcalloc (1, sizeof (struct lto_output_stream));
- ob->ssa_names_stream = xcalloc (1, sizeof (struct lto_output_stream));
- ob->cfg_stream = xcalloc (1, sizeof (struct lto_output_stream));
+ ob->local_decl_index_stream = (struct lto_output_stream *) xcalloc (1, sizeof (struct lto_output_stream));
+ ob->local_decl_stream = (struct lto_output_stream *) xcalloc (1, sizeof (struct lto_output_stream));
+ ob->named_label_stream = (struct lto_output_stream *) xcalloc (1, sizeof (struct lto_output_stream));
+ ob->ssa_names_stream = (struct lto_output_stream *) xcalloc (1, sizeof (struct lto_output_stream));
+ ob->cfg_stream = (struct lto_output_stream *) xcalloc (1, sizeof (struct lto_output_stream));
}
#ifdef LTO_STREAM_DEBUGGING
lto_debug_context.out = lto_debug_out_fun;
@@ -272,9 +273,9 @@ output_string (struct output_block *ob,
struct lto_output_stream *string_stream = ob->string_stream;
unsigned int start = string_stream->total_size;
struct string_slot *new_slot
- = xmalloc (sizeof (struct string_slot));
+ = (struct string_slot *) xmalloc (sizeof (struct string_slot));
unsigned int i;
- char *new_string = xmalloc (len);
+ char *new_string = (char *) xmalloc (len);
memcpy (new_string, string, len);
new_slot->s = new_string;
@@ -665,7 +666,8 @@ output_label_ref (struct output_block *ob, tree label)
slot = htab_find_slot (ob->label_hash_table, &d_slot, INSERT);
if (*slot == NULL)
{
- struct lto_decl_slot *new_slot = xmalloc (sizeof (struct lto_decl_slot));
+ struct lto_decl_slot *new_slot
+ = (struct lto_decl_slot *) xmalloc (sizeof (struct lto_decl_slot));
/* Named labels are given positive integers and unnamed labels are
given negative indexes. */
@@ -2023,7 +2025,8 @@ produce_asm (struct output_block *ob, tree fn)
header.debug_main_size = -1;
#endif
- header_stream = xcalloc (1, sizeof (struct lto_output_stream));
+ header_stream = ((struct lto_output_stream *)
+ xcalloc (1, sizeof (struct lto_output_stream)));
lto_output_data_stream (header_stream, &header, sizeof header);
lto_write_stream (header_stream);
free (header_stream);
@@ -2980,7 +2983,7 @@ output_tree (struct output_block *ob, tree expr)
}
global_index = ob->next_main_index++;
- new_slot = xmalloc (sizeof (struct lto_decl_slot));
+ new_slot = (struct lto_decl_slot *) xmalloc (sizeof (struct lto_decl_slot));
new_slot->t = expr;
new_slot->slot_num = global_index;
*slot = new_slot;
diff --git a/gcc/lto-section-out.c b/gcc/lto-section-out.c
index 2fdb169..8b43d90 100644
--- a/gcc/lto-section-out.c
+++ b/gcc/lto-section-out.c
@@ -130,7 +130,6 @@ lto_eq_type_slot_node (const void *p1, const void *p2)
}
-/* ### */
/* Returns a hash code for P. */
hashval_t
@@ -141,7 +140,6 @@ lto_hash_global_slot_node (const void *p)
}
-/* ### */
/* Returns nonzero if P1 and P2 are equal. */
int
@@ -325,7 +323,7 @@ lto_output_data_stream (struct lto_output_stream *obs, const void *data,
obs->current_pointer += copy;
obs->total_size += copy;
obs->left_in_block -= copy;
- data = (char *)data + copy;
+ data = (const char *) data + copy;
len -= copy;
}
}
@@ -465,7 +463,8 @@ lto_output_decl_index (struct lto_output_stream *obs, htab_t table,
slot = htab_find_slot (table, &d_slot, INSERT);
if (*slot == NULL)
{
- struct lto_decl_slot *new_slot = xmalloc (sizeof (struct lto_decl_slot));
+ struct lto_decl_slot *new_slot
+ = (struct lto_decl_slot *) xmalloc (sizeof (struct lto_decl_slot));
int index = (*next_index)++;
new_slot->t = name;
@@ -593,12 +592,14 @@ lto_output_type_ref_index (struct lto_out_decl_state *decl_state,
struct lto_simple_output_block *
lto_create_simple_output_block (enum lto_section_type section_type)
{
- struct lto_simple_output_block *ob
- = xcalloc (1, sizeof (struct lto_simple_output_block));
+ struct lto_simple_output_block *ob
+ = ((struct lto_simple_output_block *)
+ xcalloc (1, sizeof (struct lto_simple_output_block)));
ob->section_type = section_type;
ob->decl_state = lto_get_out_decl_state ();
- ob->main_stream = xcalloc (1, sizeof (struct lto_output_stream));
+ ob->main_stream = ((struct lto_output_stream *)
+ xcalloc (1, sizeof (struct lto_output_stream)));
#ifdef LTO_STREAM_DEBUGGING
lto_debug_context.out = lto_debug_out_fun;
@@ -640,7 +641,8 @@ lto_destroy_simple_output_block (struct lto_simple_output_block *ob)
header.debug_main_size = -1;
#endif
- header_stream = xcalloc (1, sizeof (struct lto_output_stream));
+ header_stream = ((struct lto_output_stream *)
+ xcalloc (1, sizeof (struct lto_output_stream)));
lto_output_data_stream (header_stream, &header, sizeof header);
lto_write_stream (header_stream);
free (header_stream);
@@ -673,7 +675,8 @@ lto_get_out_decl_state (void)
if (!out_state)
{
- out_state = xcalloc (1, sizeof (struct lto_out_decl_state));
+ out_state = ((struct lto_out_decl_state *)
+ xcalloc (1, sizeof (struct lto_out_decl_state)));
out_state->field_decl_hash_table
= htab_create (37, lto_hash_decl_slot_node, lto_eq_decl_slot_node,
@@ -714,7 +717,8 @@ preload_common_node (struct output_block *ob, tree t)
/* If well-known trees are not unique, we don't create duplicate entries. */
if (*slot == NULL)
{
- struct lto_decl_slot *new_slot = xmalloc (sizeof (struct lto_decl_slot));
+ struct lto_decl_slot *new_slot
+ = (struct lto_decl_slot *) xmalloc (sizeof (struct lto_decl_slot));
unsigned index = ob->next_main_index++;
new_slot->t = t;
new_slot->slot_num = index;
@@ -800,7 +804,8 @@ write_global_references (struct output_block *ob, VEC(tree,heap) *v)
int index;
struct lto_output_stream *ref_stream;
- ref_stream = xcalloc (1, sizeof (struct lto_output_stream));
+ ref_stream = ((struct lto_output_stream *)
+ xcalloc (1, sizeof (struct lto_output_stream)));
for (index = 0; VEC_iterate(tree, v, index, t); index++)
{
void **slot;
@@ -891,7 +896,8 @@ produce_asm_for_decls (void)
header.debug_main_size = ob->debug_main_stream->total_size;
#endif
- header_stream = xcalloc (1, sizeof (struct lto_output_stream));
+ header_stream = ((struct lto_output_stream *)
+ xcalloc (1, sizeof (struct lto_output_stream)));
lto_output_data_stream (header_stream, &header, sizeof header);
lto_write_stream (header_stream);
free (header_stream);
diff --git a/gcc/lto-section-out.h b/gcc/lto-section-out.h
index cef051f..ac4ff5d 100644
--- a/gcc/lto-section-out.h
+++ b/gcc/lto-section-out.h
@@ -54,7 +54,7 @@ struct lto_output_stream
#ifdef LTO_STREAM_DEBUGGING
#define LTO_SET_DEBUGGING_STREAM(STREAM,CONTEXT) \
do { \
- ob-> STREAM = xcalloc (1, sizeof (struct lto_output_stream)); \
+ ob-> STREAM = (struct lto_output_stream *) xcalloc (1, sizeof (struct lto_output_stream)); \
lto_debug_context. CONTEXT = ob-> STREAM; \
lto_debug_context.current_data = ob-> STREAM; \
lto_debug_context.stream_name = #CONTEXT; \