gas alloc casts

All of the various memory allocation function return a "void *"
pointer, which needs no cast to assign to other pointer types.
diff --git a/gas/cond.c b/gas/cond.c
index 27898df..2e3b3fd 100644
--- a/gas/cond.c
+++ b/gas/cond.c
@@ -110,8 +110,7 @@
       cframe.ignoring = ! (test_defined ^ is_defined);
     }
 
-  current_cframe =
-    (struct conditional_frame *) obstack_alloc (&cond_obstack, sizeof cframe);
+  current_cframe = obstack_alloc (&cond_obstack, sizeof cframe);
   memcpy (current_cframe, &cframe, sizeof cframe);
 
   if (LISTING_SKIP_COND ()
@@ -168,8 +167,7 @@
      using an undefined result.  No big deal.  */
   initialize_cframe (&cframe);
   cframe.ignoring = cframe.dead_tree || ! t;
-  current_cframe =
-    (struct conditional_frame *) obstack_alloc (&cond_obstack, sizeof cframe);
+  current_cframe = obstack_alloc (&cond_obstack, sizeof cframe);
   memcpy (current_cframe, & cframe, sizeof cframe);
 
   if (LISTING_SKIP_COND ()
@@ -205,8 +203,7 @@
       cframe.ignoring = (test_blank == !is_eol);
     }
 
-  current_cframe =
-    (struct conditional_frame *) obstack_alloc (&cond_obstack, sizeof cframe);
+  current_cframe = obstack_alloc (&cond_obstack, sizeof cframe);
   memcpy (current_cframe, &cframe, sizeof cframe);
 
   if (LISTING_SKIP_COND ()
@@ -286,8 +283,7 @@
 
   initialize_cframe (&cframe);
   cframe.ignoring = cframe.dead_tree || ! (res ^ arg);
-  current_cframe =
-    (struct conditional_frame *) obstack_alloc (&cond_obstack, sizeof cframe);
+  current_cframe = obstack_alloc (&cond_obstack, sizeof cframe);
   memcpy (current_cframe, &cframe, sizeof cframe);
   
  if (LISTING_SKIP_COND ()
@@ -481,8 +477,7 @@
 
   initialize_cframe (&cframe);
   cframe.ignoring = cframe.dead_tree || ! (res ^ arg);
-  current_cframe =
-    (struct conditional_frame *) obstack_alloc (&cond_obstack, sizeof cframe);
+  current_cframe = obstack_alloc (&cond_obstack, sizeof cframe);
   memcpy (current_cframe, &cframe, sizeof cframe);
 
   if (LISTING_SKIP_COND ()
diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c
index a926548..41cc2da 100644
--- a/gas/config/obj-coff.c
+++ b/gas/config/obj-coff.c
@@ -369,10 +369,10 @@
 coff_obj_symbol_new_hook (symbolS *symbolP)
 {
   size_t sz = (OBJ_COFF_MAX_AUXENTRIES + 1) * sizeof (combined_entry_type);
-  char *s  = notes_alloc (sz);
+  combined_entry_type *s  = notes_alloc (sz);
 
   memset (s, 0, sz);
-  coffsymbol (symbol_get_bfdsym (symbolP))->native = (combined_entry_type *) s;
+  coffsymbol (symbol_get_bfdsym (symbolP))->native = s;
   coffsymbol (symbol_get_bfdsym (symbolP))->native->is_sym = true;
 
   S_SET_DATA_TYPE (symbolP, T_NULL);
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index e2425fe..ff915b5 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -205,7 +205,7 @@
   if (name_length > strlen (S_GET_NAME (sym)))
     {
       obstack_grow (&notes, s, name_length + 1);
-      S_SET_NAME (sym, (const char *) obstack_finish (&notes));
+      S_SET_NAME (sym, obstack_finish (&notes));
     }
   else
     strcpy ((char *) S_GET_NAME (sym), s);
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index dd66e00..32fe7b8 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -5632,7 +5632,7 @@
   gas_assert (res >= 0);
 
   /* Allocate space on the obstack and format the result.  */
-  ptr = (char *) obstack_alloc (stack, res + 1);
+  ptr = obstack_alloc (stack, res + 1);
   res = vsnprintf (ptr, (res + 1), fmt, args);
   gas_assert (res >= 0);
 
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index 83f03c3..aa3a0b2 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -4971,7 +4971,7 @@
   gas_assert (s2);
   len += strlen (s2) + 1;
 
-  p = (char *) xmalloc (len);
+  p = xmalloc (len);
 
   if (s1)
     {
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index f6f4eb9..9a1ef1b 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -3701,7 +3701,7 @@
 
   name_length = strlen (name) + 1;   /* +1 for \0.  */
   obstack_grow (&notes, name, name_length);
-  preserved_copy_of_name = (char *) obstack_finish (&notes);
+  preserved_copy_of_name = obstack_finish (&notes);
 
 #ifdef tc_canonicalize_symbol_name
   preserved_copy_of_name =
diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c
index d4caa9e..0a635f4 100644
--- a/gas/config/tc-bfin.c
+++ b/gas/config/tc-bfin.c
@@ -937,7 +937,7 @@
 {
 
 
-  Expr_Node *node = (Expr_Node *) allocate (sizeof (Expr_Node));
+  Expr_Node *node = allocate (sizeof (Expr_Node));
   node->type = type;
   node->value = value;
   node->Left_Child = Left_Child;
@@ -1857,8 +1857,8 @@
   symbolS *sym;
 
   loopsym = exp->value.s_value;
-  lbeginsym = (char *) xmalloc (strlen (loopsym) + strlen ("__BEGIN") + 5);
-  lendsym = (char *) xmalloc (strlen (loopsym) + strlen ("__END") + 5);
+  lbeginsym = xmalloc (strlen (loopsym) + strlen ("__BEGIN") + 5);
+  lendsym = xmalloc (strlen (loopsym) + strlen ("__END") + 5);
 
   lbeginsym[0] = 0;
   lendsym[0] = 0;
@@ -1902,7 +1902,7 @@
   const char *suffix = begin ? "__BEGIN" : "__END";
 
   loopsym = exp->value.s_value;
-  label_name = (char *) xmalloc (strlen (loopsym) + strlen (suffix) + 5);
+  label_name = xmalloc (strlen (loopsym) + strlen (suffix) + 5);
 
   label_name[0] = 0;
 
diff --git a/gas/config/tc-csky.c b/gas/config/tc-csky.c
index 7eaf7a9..9a7749e 100644
--- a/gas/config/tc-csky.c
+++ b/gas/config/tc-csky.c
@@ -7861,8 +7861,7 @@
 csky_stack_size (int arg ATTRIBUTE_UNUSED)
 {
   expressionS exp;
-  stack_size_entry *sse
-    = (stack_size_entry *) xcalloc (1, sizeof (stack_size_entry));
+  stack_size_entry *sse = xcalloc (1, sizeof (stack_size_entry));
 
   expression (&exp);
   if (exp.X_op == O_symbol)
diff --git a/gas/config/tc-kvx.c b/gas/config/tc-kvx.c
index 5582650..501ce1d 100644
--- a/gas/config/tc-kvx.c
+++ b/gas/config/tc-kvx.c
@@ -1644,7 +1644,7 @@
   valueT image;
   arelent *rel;
 
-  rel = (arelent *) xmalloc (sizeof (arelent));
+  rel = xmalloc (sizeof (arelent));
 
   rel->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
   if (rel->howto == NULL)
diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c
index 06fb601..a91b12e 100644
--- a/gas/config/tc-loongarch.c
+++ b/gas/config/tc-loongarch.c
@@ -483,7 +483,7 @@
 							    &entry, INSERT);
   if (slot == NULL)
     return NULL;
-  *slot = (align_sec_sym *) xmalloc (sizeof (align_sec_sym));
+  *slot = xmalloc (sizeof (align_sec_sym));
   if (*slot == NULL)
     return NULL;
   **slot = entry;
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 9b1ee22..84ef184 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -3384,7 +3384,7 @@
       SKIP_SPACE_TABS (s);
     }
   mips_add_token (&token, OT_END);
-  return (struct mips_operand_token *) obstack_finish (&mips_operand_tokens);
+  return obstack_finish (&mips_operand_tokens);
 }
 
 /* Return TRUE if opcode MO is valid on the currently selected ISA, ASE
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index f5740f8..6b8bde9 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -1886,15 +1886,13 @@
 			  symbolS *symbol, bfd_vma target)
 {
   riscv_pcrel_hi_fixup entry = {sec, address, symbol, target};
-  riscv_pcrel_hi_fixup **slot =
-	(riscv_pcrel_hi_fixup **) htab_find_slot (p, &entry, INSERT);
+  void **slot = htab_find_slot (p, &entry, INSERT);
   if (slot == NULL)
     return false;
 
-  *slot = (riscv_pcrel_hi_fixup *) xmalloc (sizeof (riscv_pcrel_hi_fixup));
-  if (*slot == NULL)
-    return false;
-  **slot = entry;
+  riscv_pcrel_hi_fixup *pent = xmalloc (sizeof (*pent));
+  *slot = pent;
+  *pent = entry;
   return true;
 }
 
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index 040e397..9afda6b 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -2522,7 +2522,7 @@
     {
       if (*pnum_args == 0)
 	{
-	  arg_strings[0] = (char *) xmalloc (2);
+	  arg_strings[0] = xmalloc (2);
 	  strcpy (arg_strings[0], "0");
 	  *pnum_args = 1;
 	}
diff --git a/gas/ecoff.c b/gas/ecoff.c
index 27724bb..235bb80 100644
--- a/gas/ecoff.c
+++ b/gas/ecoff.c
@@ -1524,7 +1524,7 @@
 
 #ifdef MALLOC_CHECK
   if (vp->object_size > 1)
-    new_links->datum = (page_type *) xcalloc (1, vp->object_size);
+    new_links->datum = xcalloc (1, vp->object_size);
   else
 #endif
     new_links->datum = allocate_page ();
@@ -4715,7 +4715,7 @@
 static page_type *
 allocate_cluster (unsigned long npages)
 {
-  page_type *value = (page_type *) xmalloc (npages * PAGE_USIZE);
+  page_type *value = xmalloc (npages * PAGE_USIZE);
 
 #ifdef ECOFF_DEBUG
   if (debug > 3)
diff --git a/gas/frags.c b/gas/frags.c
index 59699ae..0ad1240 100644
--- a/gas/frags.c
+++ b/gas/frags.c
@@ -81,7 +81,7 @@
   (void) obstack_alloc (ob, 0);
   oalign = obstack_alignment_mask (ob);
   obstack_alignment_mask (ob) = 0;
-  ptr = (fragS *) obstack_alloc (ob, extra + SIZEOF_STRUCT_FRAG);
+  ptr = obstack_alloc (ob, extra + SIZEOF_STRUCT_FRAG);
   obstack_alignment_mask (ob) = oalign;
   memset (ptr, 0, SIZEOF_STRUCT_FRAG);
   totalfrags++;
diff --git a/gas/read.c b/gas/read.c
index 874802e..a00fa97 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -6348,7 +6348,7 @@
       /* JF this next line is so demand_copy_C_string will return a
 	 null terminated string.  */
       obstack_1grow (&notes, '\0');
-      retval = (char *) obstack_finish (&notes);
+      retval = obstack_finish (&notes);
     }
   else
     {
@@ -6567,7 +6567,7 @@
 	}
 
       obstack_1grow (&notes, '\0');
-      filename = (char *) obstack_finish (&notes);
+      filename = obstack_finish (&notes);
       while (!is_end_of_stmt (*input_line_pointer))
 	++input_line_pointer;
     }
diff --git a/gas/subsegs.c b/gas/subsegs.c
index bc80c85..8a5f7ac 100644
--- a/gas/subsegs.c
+++ b/gas/subsegs.c
@@ -132,7 +132,7 @@
     {
       /* This should be the only code that creates a frchainS.  */
 
-      newP = (frchainS *) obstack_alloc (&frchains, sizeof (frchainS));
+      newP = obstack_alloc (&frchains, sizeof (frchainS));
       newP->frch_subseg = subseg;
       newP->fix_root = NULL;
       newP->fix_tail = NULL;
diff --git a/gas/write.c b/gas/write.c
index 93ec614..353b11c 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -142,7 +142,7 @@
 
   n_fixups++;
 
-  fixP = (fixS *) obstack_alloc (&notes, sizeof (fixS));
+  fixP = obstack_alloc (&notes, sizeof (fixS));
 
   fixP->fx_frag = frag;
   fixP->fx_where = where;