patches for Irix binutils 2.18

Alan Modra amodra@bigpond.net.au
Tue Oct 21 00:26:00 GMT 2008


On Tue, Oct 21, 2008 at 09:32:28AM +1030, Alan Modra wrote:
> 	* obstack.h (obstack_finish <!__GNUC__>): Cast result to void *.

Since we now have obstack_alloc always evaluating to a void *, there
is no need for these casts.

binutils/
	* windmc.c (res_alloc): Remove unnecessary cast.
	* windres.c (res_alloc, reswr_alloc): Likewise.
gas/
	* config/tc-bfin.c (gencode, allocate): Remove unnecessary cast.
	* config/tc-ns32k.c (bit_fix_new): Likewise.
	* config/tc-m68k.c (md_begin): Likewise.
	* hash.c (hash_insert, hash_jam): Likewise.
	* symbols.c (symbol_create, local_symbol_make): Likewise.
	* frags.c (frag_alloc): Likewise.

Index: ./binutils/windmc.c
===================================================================
RCS file: /cvs/src/src/binutils/windmc.c,v
retrieving revision 1.5
diff -u -p -r1.5 windmc.c
--- ./binutils/windmc.c	30 Jul 2008 04:34:56 -0000	1.5
+++ ./binutils/windmc.c	21 Oct 2008 00:01:41 -0000
@@ -175,7 +175,7 @@ res_init (void)
 void *
 res_alloc (rc_uint_type bytes)
 {
-  return (void *) obstack_alloc (&res_obstack, (size_t) bytes);
+  return obstack_alloc (&res_obstack, (size_t) bytes);
 }
 
 static FILE *
Index: ./binutils/windres.c
===================================================================
RCS file: /cvs/src/src/binutils/windres.c,v
retrieving revision 1.35
diff -u -p -r1.35 windres.c
--- ./binutils/windres.c	9 Jan 2008 10:40:32 -0000	1.35
+++ ./binutils/windres.c	21 Oct 2008 00:01:42 -0000
@@ -157,7 +157,7 @@ res_init (void)
 void *
 res_alloc (rc_uint_type bytes)
 {
-  return (void *) obstack_alloc (&res_obstack, (size_t) bytes);
+  return obstack_alloc (&res_obstack, (size_t) bytes);
 }
 
 /* We also use an obstack to save memory used while writing out a set
@@ -178,7 +178,7 @@ reswr_init (void)
 void *
 reswr_alloc (rc_uint_type bytes)
 {
-  return (void *) obstack_alloc (&reswr_obstack, (size_t) bytes);
+  return obstack_alloc (&reswr_obstack, (size_t) bytes);
 }
 
 /* Open a file using the include directory search list.  */
Index: ./gas/config/tc-bfin.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-bfin.c,v
retrieving revision 1.19
diff -u -p -r1.19 tc-bfin.c
--- ./gas/config/tc-bfin.c	20 Oct 2008 01:03:50 -0000	1.19
+++ ./gas/config/tc-bfin.c	21 Oct 2008 00:01:34 -0000
@@ -960,7 +960,7 @@ note_reloc2 (INSTR_T code, const char *s
 INSTR_T
 gencode (unsigned long x)
 {
-  INSTR_T cell = (INSTR_T) obstack_alloc (&mempool, sizeof (struct bfin_insn));
+  INSTR_T cell = obstack_alloc (&mempool, sizeof (struct bfin_insn));
   memset (cell, 0, sizeof (struct bfin_insn));
   cell->value = (x);
   return cell;
@@ -973,7 +973,7 @@ int count_insns;
 static void *
 allocate (int n)
 {
-  return (void *) obstack_alloc (&mempool, n);
+  return obstack_alloc (&mempool, n);
 }
 
 Expr_Node *
Index: ./gas/config/tc-ns32k.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ns32k.c,v
retrieving revision 1.29
diff -u -p -r1.29 tc-ns32k.c
--- ./gas/config/tc-ns32k.c	17 Oct 2007 16:45:55 -0000	1.29
+++ ./gas/config/tc-ns32k.c	21 Oct 2008 00:01:35 -0000
@@ -880,7 +880,7 @@ bit_fix_new (int size,		/* Length of bit
 {
   bit_fixS *bit_fixP;
 
-  bit_fixP = (bit_fixS *) obstack_alloc (&notes, sizeof (bit_fixS));
+  bit_fixP = obstack_alloc (&notes, sizeof (bit_fixS));
 
   bit_fixP->fx_bit_size = size;
   bit_fixP->fx_bit_offset = offset;
Index: ./gas/config/tc-m68k.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68k.c,v
retrieving revision 1.105
diff -u -p -r1.105 tc-m68k.c
--- ./gas/config/tc-m68k.c	20 Oct 2008 01:03:50 -0000	1.105
+++ ./gas/config/tc-m68k.c	21 Oct 2008 00:01:39 -0000
@@ -4422,7 +4422,7 @@ md_begin (void)
   obstack_begin (&robyn, 4000);
   for (i = 0; i < m68k_numopcodes; i++)
     {
-      hack = slak = (struct m68k_incant *) obstack_alloc (&robyn, sizeof (struct m68k_incant));
+      hack = slak = obstack_alloc (&robyn, sizeof (struct m68k_incant));
       do
 	{
 	  ins = m68k_sorted_opcodes[i];
Index: ./gas/hash.c
===================================================================
RCS file: /cvs/src/src/gas/hash.c,v
retrieving revision 1.22
diff -u -p -r1.22 hash.c
--- ./gas/hash.c	12 Aug 2008 23:39:30 -0000	1.22
+++ ./gas/hash.c	21 Oct 2008 00:01:39 -0000
@@ -237,7 +237,7 @@ hash_insert (struct hash_control *table,
   ++table->insertions;
 #endif
 
-  p = (struct hash_entry *) obstack_alloc (&table->memory, sizeof (*p));
+  p = obstack_alloc (&table->memory, sizeof (*p));
   p->string = key;
   p->hash = hash;
   p->data = value;
@@ -274,7 +274,7 @@ hash_jam (struct hash_control *table, co
       ++table->insertions;
 #endif
 
-      p = (struct hash_entry *) obstack_alloc (&table->memory, sizeof (*p));
+      p = obstack_alloc (&table->memory, sizeof (*p));
       p->string = key;
       p->hash = hash;
       p->data = value;
Index: ./gas/symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.92
diff -u -p -r1.92 symbols.c
--- ./gas/symbols.c	7 Oct 2008 14:21:59 -0000	1.92
+++ ./gas/symbols.c	21 Oct 2008 00:01:41 -0000
@@ -137,7 +137,7 @@ symbol_create (const char *name, /* It i
 
   preserved_copy_of_name = save_symbol_name (name);
 
-  symbolP = (symbolS *) obstack_alloc (&notes, sizeof (symbolS));
+  symbolP = obstack_alloc (&notes, sizeof (symbolS));
 
   /* symbol must be born in some fixed state.  This seems as good as any.  */
   memset (symbolP, 0, sizeof (symbolS));
@@ -197,7 +197,7 @@ local_symbol_make (const char *name, seg
 
   name_copy = save_symbol_name (name);
 
-  ret = (struct local_symbol *) obstack_alloc (&notes, sizeof *ret);
+  ret = obstack_alloc (&notes, sizeof *ret);
   ret->lsy_marker = NULL;
   ret->lsy_name = name_copy;
   ret->lsy_section = section;
Index: ./gas/frags.c
===================================================================
RCS file: /cvs/src/src/gas/frags.c,v
retrieving revision 1.22
diff -u -p -r1.22 frags.c
--- ./gas/frags.c	3 Jul 2007 11:01:03 -0000	1.22
+++ ./gas/frags.c	21 Oct 2008 00:01:41 -0000
@@ -69,7 +69,7 @@ frag_alloc (struct obstack *ob)
   (void) obstack_alloc (ob, 0);
   oalign = obstack_alignment_mask (ob);
   obstack_alignment_mask (ob) = 0;
-  ptr = (fragS *) obstack_alloc (ob, SIZEOF_STRUCT_FRAG);
+  ptr = obstack_alloc (ob, SIZEOF_STRUCT_FRAG);
   obstack_alignment_mask (ob) = oalign;
   memset (ptr, 0, SIZEOF_STRUCT_FRAG);
   return ptr;

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list