aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ld/ChangeLog11
-rw-r--r--ld/ldexp.c24
-rw-r--r--ld/ldlang.c27
-rw-r--r--ld/lexsup.c2
4 files changed, 36 insertions, 28 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index d4cb36d..d4eb3fb 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,16 @@
2019-08-10 Alan Modra <amodra@gmail.com>
+ * ldexp.c (exp_intop, exp_bigintop, exp_relop, exp_binop, exp_trinop),
+ (exp_unop, exp_nameop, exp_assop, exp_assert): Remove casts of
+ stat_alloc return value.
+ * ldlang.c (new_statement, new_afile, sort_def_symbol),
+ (lang_memory_region_lookup, lang_memory_region_alias),
+ (ldlang_add_undef, ldlang_add_require_defined, insert_pad),
+ (lang_add_gc_name, lang_new_phdr): Likewise.
+ * lexsup.c (set_segment_start): Likewise.
+
+2019-08-10 Alan Modra <amodra@gmail.com>
+
* ldlang.h (lang_input_statement_type): Make next
and next_real_file a lang_input_statement_type pointer.
(lang_statement_append): Delete prototype.
diff --git a/ld/ldexp.c b/ld/ldexp.c
index daf0f2e..d7d253e 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -198,7 +198,7 @@ new_abs (bfd_vma value)
etree_type *
exp_intop (bfd_vma value)
{
- etree_type *new_e = (etree_type *) stat_alloc (sizeof (new_e->value));
+ etree_type *new_e = stat_alloc (sizeof (new_e->value));
new_e->type.node_code = INT;
new_e->type.filename = ldlex_filename ();
new_e->type.lineno = lineno;
@@ -211,7 +211,7 @@ exp_intop (bfd_vma value)
etree_type *
exp_bigintop (bfd_vma value, char *str)
{
- etree_type *new_e = (etree_type *) stat_alloc (sizeof (new_e->value));
+ etree_type *new_e = stat_alloc (sizeof (new_e->value));
new_e->type.node_code = INT;
new_e->type.filename = ldlex_filename ();
new_e->type.lineno = lineno;
@@ -226,7 +226,7 @@ exp_bigintop (bfd_vma value, char *str)
etree_type *
exp_relop (asection *section, bfd_vma value)
{
- etree_type *new_e = (etree_type *) stat_alloc (sizeof (new_e->rel));
+ etree_type *new_e = stat_alloc (sizeof (new_e->rel));
new_e->type.node_code = REL;
new_e->type.filename = ldlex_filename ();
new_e->type.lineno = lineno;
@@ -1277,8 +1277,8 @@ exp_value_fold (etree_type *tree)
etree_type *
exp_binop (int code, etree_type *lhs, etree_type *rhs)
{
- etree_type *new_e = (etree_type *) stat_alloc (MAX (sizeof (new_e->binary),
- sizeof (new_e->value)));
+ etree_type *new_e = stat_alloc (MAX (sizeof (new_e->binary),
+ sizeof (new_e->value)));
new_e->type.node_code = code;
new_e->type.filename = lhs->type.filename;
new_e->type.lineno = lhs->type.lineno;
@@ -1297,8 +1297,8 @@ exp_binop (int code, etree_type *lhs, etree_type *rhs)
etree_type *
exp_trinop (int code, etree_type *cond, etree_type *lhs, etree_type *rhs)
{
- etree_type *new_e = (etree_type *) stat_alloc (MAX (sizeof (new_e->trinary),
- sizeof (new_e->value)));
+ etree_type *new_e = stat_alloc (MAX (sizeof (new_e->trinary),
+ sizeof (new_e->value)));
new_e->type.node_code = code;
new_e->type.filename = cond->type.filename;
new_e->type.lineno = cond->type.lineno;
@@ -1316,8 +1316,8 @@ exp_trinop (int code, etree_type *cond, etree_type *lhs, etree_type *rhs)
etree_type *
exp_unop (int code, etree_type *child)
{
- etree_type *new_e = (etree_type *) stat_alloc (MAX (sizeof (new_e->unary),
- sizeof (new_e->value)));
+ etree_type *new_e = stat_alloc (MAX (sizeof (new_e->unary),
+ sizeof (new_e->value)));
new_e->unary.type.node_code = code;
new_e->unary.type.filename = child->type.filename;
new_e->unary.type.lineno = child->type.lineno;
@@ -1335,7 +1335,7 @@ exp_unop (int code, etree_type *child)
etree_type *
exp_nameop (int code, const char *name)
{
- etree_type *new_e = (etree_type *) stat_alloc (sizeof (new_e->name));
+ etree_type *new_e = stat_alloc (sizeof (new_e->name));
new_e->name.type.node_code = code;
new_e->name.type.filename = ldlex_filename ();
@@ -1354,7 +1354,7 @@ exp_assop (const char *dst,
{
etree_type *n;
- n = (etree_type *) stat_alloc (sizeof (n->assign));
+ n = stat_alloc (sizeof (n->assign));
n->assign.type.node_code = '=';
n->assign.type.filename = src->type.filename;
n->assign.type.lineno = src->type.lineno;
@@ -1396,7 +1396,7 @@ exp_assert (etree_type *exp, const char *message)
{
etree_type *n;
- n = (etree_type *) stat_alloc (sizeof (n->assert_s));
+ n = stat_alloc (sizeof (n->assert_s));
n->assert_s.type.node_code = '!';
n->assert_s.type.filename = exp->type.filename;
n->assert_s.type.lineno = exp->type.lineno;
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 3ec534e..303aa67 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -1061,7 +1061,7 @@ new_statement (enum statement_enum type,
{
lang_statement_union_type *new_stmt;
- new_stmt = (lang_statement_union_type *) stat_alloc (size);
+ new_stmt = stat_alloc (size);
new_stmt->header.type = type;
new_stmt->header.next = NULL;
lang_statement_append (list, new_stmt, &new_stmt->header.next);
@@ -1088,11 +1088,10 @@ new_afile (const char *name,
lang_has_input_file = TRUE;
if (add_to_list)
- p = (lang_input_statement_type *) new_stat (lang_input_statement, stat_ptr);
+ p = new_stat (lang_input_statement, stat_ptr);
else
{
- p = (lang_input_statement_type *)
- stat_alloc (sizeof (lang_input_statement_type));
+ p = stat_alloc (sizeof (lang_input_statement_type));
p->header.type = lang_input_statement_enum;
p->header.next = NULL;
}
@@ -1345,8 +1344,7 @@ lang_memory_region_lookup (const char *const name, bfd_boolean create)
einfo (_("%P:%pS: warning: memory region `%s' not declared\n"),
NULL, name);
- new_region = (lang_memory_region_type *)
- stat_alloc (sizeof (lang_memory_region_type));
+ new_region = stat_alloc (sizeof (lang_memory_region_type));
new_region->name_list.name = xstrdup (name);
new_region->name_list.next = NULL;
@@ -1402,7 +1400,7 @@ lang_memory_region_alias (const char *alias, const char *region_name)
NULL, region_name, alias);
/* Add alias to region name list. */
- n = (lang_memory_region_name *) stat_alloc (sizeof (lang_memory_region_name));
+ n = stat_alloc (sizeof (lang_memory_region_name));
n->name = xstrdup (alias);
n->next = region->name_list.next;
region->name_list.next = n;
@@ -2341,7 +2339,7 @@ sort_def_symbol (struct bfd_link_hash_entry *hash_entry,
get_userdata (hash_entry->u.def.section));
if (!ud)
{
- ud = (input_section_userdata_type *) stat_alloc (sizeof (*ud));
+ ud = stat_alloc (sizeof (*ud));
get_userdata (hash_entry->u.def.section) = ud;
ud->map_symbol_def_tail = &ud->map_symbol_def_head;
ud->map_symbol_def_count = 0;
@@ -3606,7 +3604,7 @@ ldlang_add_undef (const char *const name, bfd_boolean cmdline)
ldlang_undef_chain_list_type *new_undef;
undef_from_cmdline = undef_from_cmdline || cmdline;
- new_undef = (ldlang_undef_chain_list_type *) stat_alloc (sizeof (*new_undef));
+ new_undef = stat_alloc (sizeof (*new_undef));
new_undef->next = ldlang_undef_chain_list_head;
ldlang_undef_chain_list_head = new_undef;
@@ -3672,7 +3670,7 @@ ldlang_add_require_defined (const char *const name)
struct require_defined_symbol *ptr;
ldlang_add_undef (name, TRUE);
- ptr = (struct require_defined_symbol *) stat_alloc (sizeof (*ptr));
+ ptr = stat_alloc (sizeof (*ptr));
ptr->next = require_defined_symbol_list;
ptr->name = strdup (name);
require_defined_symbol_list = ptr;
@@ -3706,7 +3704,7 @@ check_input_sections
(lang_statement_union_type *s,
lang_output_section_statement_type *output_section_statement)
{
- for (; s != (lang_statement_union_type *) NULL; s = s->header.next)
+ for (; s != NULL; s = s->header.next)
{
switch (s->header.type)
{
@@ -4894,8 +4892,7 @@ insert_pad (lang_statement_union_type **ptr,
else
{
/* Make a new padding statement, linked into existing chain. */
- pad = (lang_statement_union_type *)
- stat_alloc (sizeof (lang_padding_statement_type));
+ pad = stat_alloc (sizeof (lang_padding_statement_type));
pad->header.next = *ptr;
*ptr = pad;
pad->header.type = lang_padding_statement_enum;
@@ -7373,7 +7370,7 @@ lang_add_gc_name (const char *name)
if (name == NULL)
return;
- sym = (struct bfd_sym_chain *) stat_alloc (sizeof (*sym));
+ sym = stat_alloc (sizeof (*sym));
sym->next = link_info.gc_sym_list;
sym->name = name;
@@ -8030,7 +8027,7 @@ lang_new_phdr (const char *name,
struct lang_phdr *n, **pp;
bfd_boolean hdrs;
- n = (struct lang_phdr *) stat_alloc (sizeof (struct lang_phdr));
+ n = stat_alloc (sizeof (struct lang_phdr));
n->next = NULL;
n->name = name;
n->type = exp_get_vma (type, 0, "program header type");
diff --git a/ld/lexsup.c b/ld/lexsup.c
index d4f1981..1c15ac2 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -1734,7 +1734,7 @@ set_segment_start (const char *section, char *valstr)
}
/* There was no existing value so we must create a new segment
entry. */
- seg = (segment_type *) stat_alloc (sizeof (*seg));
+ seg = stat_alloc (sizeof (*seg));
seg->name = name;
seg->value = val;
seg->used = FALSE;