[binutils-gdb] gas bfd_reloc_code_real_type

Alan Modra amodra@sourceware.org
Wed Jul 9 00:06:10 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7b13f65ccbed9fdc6ac70751a2103b7d89d4f9fb

commit 7b13f65ccbed9fdc6ac70751a2103b7d89d4f9fb
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Jul 9 08:58:11 2025 +0930

    gas bfd_reloc_code_real_type
    
    Enumeration constants are integer types, so there should be no need to
    cast such constants to int in expressions.  (Perhaps some older gccs
    warned, I checked back to gcc-4.5.)  Remove some of those unnecessary
    casts.  Also remove unnecessary casts to bfd_reloc_code_real_type.

Diff:
---
 gas/cgen.c                | 12 +++-----
 gas/config/tc-alpha.c     |  8 ++----
 gas/config/tc-arc.c       |  9 ++----
 gas/config/tc-arm.c       |  9 +++---
 gas/config/tc-epiphany.c  |  6 ++--
 gas/config/tc-frv.c       |  6 ++--
 gas/config/tc-iq2000.c    |  4 +--
 gas/config/tc-m32c.c      |  4 +--
 gas/config/tc-m32r.c      |  4 +--
 gas/config/tc-mep.c       |  4 +--
 gas/config/tc-mips.c      | 73 +++++++++++++++++++++++------------------------
 gas/config/tc-mn10300.c   |  2 +-
 gas/config/tc-mt.c        |  4 +--
 gas/config/tc-ppc.c       |  6 ++--
 gas/config/tc-s390.c      |  7 ++---
 gas/config/tc-v850.c      |  7 ++---
 gas/config/tc-xstormy16.c |  4 +--
 17 files changed, 78 insertions(+), 91 deletions(-)

diff --git a/gas/cgen.c b/gas/cgen.c
index 030c2f0bebd..8fbb531035c 100644
--- a/gas/cgen.c
+++ b/gas/cgen.c
@@ -248,9 +248,7 @@ gas_cgen_record_fixup (fragS *frag, int where, const CGEN_INSN *insn,
      but it is the operand that has a pc relative relocation.  */
   fixP = fix_new (frag, where, length / 8, symbol, offset,
 		  CGEN_OPERAND_ATTR_VALUE (operand, CGEN_OPERAND_PCREL_ADDR),
-		  (bfd_reloc_code_real_type)
-		    ((int) BFD_RELOC_UNUSED
-		     + (int) operand->type));
+		  BFD_RELOC_UNUSED + operand->type);
   fixP->fx_cgen.insn = insn;
   fixP->fx_cgen.opinfo = opinfo;
   fixP->fx_cgen.field = NULL;
@@ -283,9 +281,7 @@ gas_cgen_record_fixup_exp (fragS *frag, int where, const CGEN_INSN *insn,
      but it is the operand that has a pc relative relocation.  */
   fixP = fix_new_exp (frag, where, length / 8, exp,
 		      CGEN_OPERAND_ATTR_VALUE (operand, CGEN_OPERAND_PCREL_ADDR),
-		      (bfd_reloc_code_real_type)
-		        ((int) BFD_RELOC_UNUSED
-			 + (int) operand->type));
+		      BFD_RELOC_UNUSED + operand->type);
   fixP->fx_cgen.insn = insn;
   fixP->fx_cgen.opinfo = opinfo;
   fixP->fx_cgen.field = NULL;
@@ -859,9 +855,9 @@ gas_cgen_md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
   if (fixP->fx_subsy != (symbolS *) NULL)
     as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex"));
 
-  if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+  if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
     {
-      int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+      int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
       const CGEN_OPERAND *operand = cgen_operand_lookup_by_num (cd, opindex);
       const char *errmsg;
       bfd_reloc_code_real_type reloc_type;
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index e66e8d6a85c..2d66986560f 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -1777,8 +1777,7 @@ emit_insn (struct alpha_insn *insn)
       else
 	{
 	  reloc_howto_type *reloc_howto =
-              bfd_reloc_type_lookup (stdoutput,
-                                     (bfd_reloc_code_real_type) fixup->reloc);
+	    bfd_reloc_type_lookup (stdoutput, fixup->reloc);
 	  gas_assert (reloc_howto);
 
 	  size = bfd_get_reloc_size (reloc_howto);
@@ -1800,7 +1799,7 @@ emit_insn (struct alpha_insn *insn)
 	}
 
       fixP = fix_new_exp (frag_now, f - frag_now->fr_literal, size,
-			  &fixup->exp, pcrel, (bfd_reloc_code_real_type) fixup->reloc);
+			  &fixup->exp, pcrel, fixup->reloc);
 
       /* Turn off complaints that the addend is too large for some fixups,
          and copy in the sequence number for the explicit relocations.  */
@@ -2138,8 +2137,7 @@ assemble_insn (const struct alpha_opcode *opcode,
       else if (reloc < BFD_RELOC_UNUSED && reloc > 0)
 	{
 	  reloc_howto_type *reloc_howto
-              = bfd_reloc_type_lookup (stdoutput,
-                                       (bfd_reloc_code_real_type) reloc);
+	    = bfd_reloc_type_lookup (stdoutput, reloc);
 	  if (reloc_operand == NULL
 	      || reloc_howto->bitsize != reloc_operand->bits)
 	    {
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index 30d6cb9c50d..ff14e91f8a4 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -1457,8 +1457,7 @@ apply_fixups (struct arc_insn *insn, fragS *fragP, int fix)
       else
 	{
 	  reloc_howto_type *reloc_howto =
-	    bfd_reloc_type_lookup (stdoutput,
-				   (bfd_reloc_code_real_type) fixup->reloc);
+	    bfd_reloc_type_lookup (stdoutput, fixup->reloc);
 	  gas_assert (reloc_howto);
 
 	  /* FIXME! the reloc size is wrong in the BFD file.
@@ -4058,8 +4057,7 @@ assemble_insn (const struct arc_opcode *opcode,
 	    {
 	      /* sanity checks.  */
 	      reloc_howto_type *reloc_howto
-		= bfd_reloc_type_lookup (stdoutput,
-					 (bfd_reloc_code_real_type) reloc);
+		= bfd_reloc_type_lookup (stdoutput, reloc);
 	      unsigned reloc_bitsize = reloc_howto->bitsize;
 	      if (reloc_howto->rightshift)
 		reloc_bitsize -= reloc_howto->rightshift;
@@ -4083,8 +4081,7 @@ assemble_insn (const struct arc_opcode *opcode,
 	  else
 	    {
 	      reloc_howto_type *reloc_howto =
-		bfd_reloc_type_lookup (stdoutput,
-				       (bfd_reloc_code_real_type) fixup->reloc);
+		bfd_reloc_type_lookup (stdoutput, fixup->reloc);
 	      pcrel = reloc_howto->pc_relative;
 	    }
 	  fixup->pcrel = pcrel;
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 13afe8d3e48..c6045a1ff80 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -3844,9 +3844,8 @@ s_arm_elf_cons (int nbytes)
 	    emit_expr (&exp, (unsigned int) nbytes);
 	  else
 	    {
-	      reloc_howto_type *howto = (reloc_howto_type *)
-		  bfd_reloc_type_lookup (stdoutput,
-					 (bfd_reloc_code_real_type) reloc);
+	      reloc_howto_type *howto = bfd_reloc_type_lookup (stdoutput,
+							       reloc);
 	      int size = bfd_get_reloc_size (howto);
 
 	      if (reloc == BFD_RELOC_ARM_PLT32)
@@ -22218,8 +22217,8 @@ fix_new_arm (fragS *	   frag,
       break;
 
     default:
-      new_fix = (fixS *) fix_new (frag, where, size, make_expr_symbol (exp), 0,
-				  pc_rel, (enum bfd_reloc_code_real) reloc);
+      new_fix = fix_new (frag, where, size, make_expr_symbol (exp), 0,
+			 pc_rel, reloc);
       break;
     }
 
diff --git a/gas/config/tc-epiphany.c b/gas/config/tc-epiphany.c
index 4a027e9f31d..64d70f4cb5d 100644
--- a/gas/config/tc-epiphany.c
+++ b/gas/config/tc-epiphany.c
@@ -251,7 +251,7 @@ epiphany_apply_fix (fixS *fixP, valueT *valP, segT seg)
   if (fixP->fx_addsy == (symbolS *) NULL)
     fixP->fx_done = 1;
 
-  if (((int) fixP->fx_r_type < (int) BFD_RELOC_UNUSED)
+  if ((fixP->fx_r_type < BFD_RELOC_UNUSED)
       && fixP->fx_done)
     {
       /* Install EPIPHANY-dependent relocations HERE because nobody else
@@ -1025,10 +1025,10 @@ epiphany_fix_adjustable (fixS *fixP)
 {
  bfd_reloc_code_real_type reloc_type;
 
-  if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+  if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
     {
       const CGEN_INSN *insn = fixP->fx_cgen.insn;
-      int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+      int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
       const CGEN_OPERAND *operand =
 	cgen_operand_lookup_by_num (gas_cgen_cpu_desc, opindex);
 
diff --git a/gas/config/tc-frv.c b/gas/config/tc-frv.c
index 2c33c90f783..2c84812b5c7 100644
--- a/gas/config/tc-frv.c
+++ b/gas/config/tc-frv.c
@@ -1523,10 +1523,10 @@ frv_fix_adjustable (fixS *fixP)
 {
   bfd_reloc_code_real_type reloc_type;
 
-  if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+  if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
     {
       const CGEN_INSN *insn = NULL;
-      int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+      int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
       const CGEN_OPERAND *operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex);
       reloc_type = md_cgen_lookup_reloc (insn, operand, fixP);
     }
@@ -1705,7 +1705,7 @@ frv_frob_file_section (bfd *abfd, asection *sec, void *ptr ATTRIBUTE_UNUSED)
 	}
       else
 	{
-	  opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED;
+	  opindex = fixp->fx_r_type - BFD_RELOC_UNUSED;
 	  operand = cgen_operand_lookup_by_num (cd, opindex);
 	  reloc = md_cgen_lookup_reloc (insn, operand, fixp);
 	}
diff --git a/gas/config/tc-iq2000.c b/gas/config/tc-iq2000.c
index 1957235dfc8..e7e123574d1 100644
--- a/gas/config/tc-iq2000.c
+++ b/gas/config/tc-iq2000.c
@@ -728,10 +728,10 @@ iq2000_fix_adjustable (fixS * fixP)
 {
   bfd_reloc_code_real_type reloc_type;
 
-  if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+  if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
     {
       const CGEN_INSN *insn = NULL;
-      int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+      int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
       const CGEN_OPERAND *operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex);
 
       reloc_type = md_cgen_lookup_reloc (insn, operand, fixP);
diff --git a/gas/config/tc-m32c.c b/gas/config/tc-m32c.c
index 2eddf16034f..de2f86c87e2 100644
--- a/gas/config/tc-m32c.c
+++ b/gas/config/tc-m32c.c
@@ -1136,9 +1136,9 @@ m32c_fix_adjustable (fixS * fixP)
 
   /* We need the symbol name for the VTABLE entries.  */
   reloc = fixP->fx_r_type;
-  if (reloc > (int)BFD_RELOC_UNUSED)
+  if (reloc > BFD_RELOC_UNUSED)
     {
-      reloc -= (int)BFD_RELOC_UNUSED;
+      reloc -= BFD_RELOC_UNUSED;
       switch (reloc)
 	{
 	case M32C_OPERAND_DSP_32_S16:
diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c
index e9d9cc930ec..6946b2e50c8 100644
--- a/gas/config/tc-m32r.c
+++ b/gas/config/tc-m32r.c
@@ -2128,10 +2128,10 @@ m32r_fix_adjustable (fixS *fixP)
 {
   bfd_reloc_code_real_type reloc_type;
 
-  if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+  if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
     {
       const CGEN_INSN *insn = NULL;
-      int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+      int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
       const CGEN_OPERAND *operand =
 	cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex);
 
diff --git a/gas/config/tc-mep.c b/gas/config/tc-mep.c
index 5e534210e5b..d35a8639c49 100644
--- a/gas/config/tc-mep.c
+++ b/gas/config/tc-mep.c
@@ -2051,10 +2051,10 @@ mep_fix_adjustable (fixS *fixP)
 {
   bfd_reloc_code_real_type reloc_type;
 
-  if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+  if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
     {
       const CGEN_INSN *insn = NULL;
-      int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+      int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
       const CGEN_OPERAND *operand
 	= cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex);
       reloc_type = md_cgen_lookup_reloc (insn, operand, fixP);
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 5e602a47a4e..9f4e01dd64a 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -7728,17 +7728,16 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
       && delayed_branch_p (ip))
     {
       relaxed_branch = true;
-      add_relaxed_insn (ip, (relaxed_branch_length
-			     (NULL, NULL,
-			      uncond_branch_p (ip) ? -1
-			      : branch_likely_p (ip) ? 1
-			      : 0)), 4,
-			RELAX_BRANCH_ENCODE
-			(AT, mips_pic != NO_PIC,
-			 uncond_branch_p (ip),
-			 branch_likely_p (ip),
-			 pinfo & INSN_WRITE_GPR_31,
-			 0),
+      add_relaxed_insn (ip,
+			relaxed_branch_length (NULL, NULL,
+					       uncond_branch_p (ip) ? -1
+					       : branch_likely_p (ip) ? 1
+					       : 0),
+			4,
+			RELAX_BRANCH_ENCODE (AT, mips_pic != NO_PIC,
+					     uncond_branch_p (ip),
+					     branch_likely_p (ip),
+					     pinfo & INSN_WRITE_GPR_31, 0),
 			address_expr->X_add_symbol,
 			address_expr->X_add_number);
       *reloc_type = BFD_RELOC_UNUSED;
@@ -7814,15 +7813,15 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
 	  offset = 0;
 	}
       add_relaxed_insn (ip, 12, 0,
-			RELAX_MIPS16_ENCODE
-			(*reloc_type - BFD_RELOC_UNUSED,
-			 mips_opts.ase & ASE_MIPS16E2,
-			 mips_pic != NO_PIC,
-			 HAVE_32BIT_SYMBOLS,
-			 mips_opts.warn_about_macros,
-			 require_unextended, require_extended,
-			 delayed_branch_p (&history[0]),
-			 history[0].mips16_absolute_jump_p),
+			RELAX_MIPS16_ENCODE (*reloc_type - BFD_RELOC_UNUSED,
+					     mips_opts.ase & ASE_MIPS16E2,
+					     mips_pic != NO_PIC,
+					     HAVE_32BIT_SYMBOLS,
+					     mips_opts.warn_about_macros,
+					     require_unextended,
+					     require_extended,
+					     delayed_branch_p (&history[0]),
+					     history[0].mips16_absolute_jump_p),
 			symbol, offset);
     }
   else if (mips_opts.mips16 && insn_length (ip) == 2)
@@ -8438,7 +8437,7 @@ match_insn (struct mips_cl_insn *insn, const struct mips_opcode *opcode,
 	    case 'D':
 	    case 'E':
 	      if (!forced_insn_length)
-		*offset_reloc = (int) BFD_RELOC_UNUSED + c;
+		*offset_reloc = BFD_RELOC_UNUSED + c;
 	      else if (c == 'D')
 		*offset_reloc = BFD_RELOC_MICROMIPS_10_PCREL_S1;
 	      else
@@ -8566,7 +8565,7 @@ match_mips16_insn (struct mips_cl_insn *insn, const struct mips_opcode *opcode,
 		}
 	    }
 	  else if (relax_char)
-	    *offset_reloc = (int) BFD_RELOC_UNUSED + relax_char;
+	    *offset_reloc = BFD_RELOC_UNUSED + relax_char;
 
 	  check_completed_insn (&arg);
 	  return true;
@@ -8988,11 +8987,11 @@ macro_read_relocs (va_list *args, bfd_reloc_code_real_type *r)
 
   next = va_arg (*args, int);
   if (next >= 0)
-    r[0] = (bfd_reloc_code_real_type) next;
+    r[0] = next;
   else
     {
       for (i = 0; i < 3; i++)
-	r[i] = (bfd_reloc_code_real_type) va_arg (*args, int);
+	r[i] = va_arg (*args, int);
       /* This function is only used for 16-bit relocation fields.
 	 To make the macro code simpler, treat an unrelocated value
 	 in the same way as BFD_RELOC_LO16.  */
@@ -9240,7 +9239,7 @@ mips16_macro_build (expressionS *ep, const char *name, const char *fmt,
 	    gas_assert (ep != NULL);
 
 	    if (ep->X_op != O_constant)
-	      *r = (int) BFD_RELOC_UNUSED + c;
+	      *r = BFD_RELOC_UNUSED + c;
 	    else if (calculate_reloc (*r, ep->X_add_number, &value))
 	      {
 		mips16_immed (NULL, 0, c, *r, value, 0, &insn.insn_opcode);
@@ -11120,7 +11119,7 @@ macro (struct mips_cl_insn *ip, char *str)
 	}
       else if (!mips_big_got && !HAVE_NEWABI)
 	{
-	  int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT16;
+	  int lw_reloc_type = BFD_RELOC_MIPS_GOT16;
 
 	  /* If this is a reference to an external symbol, and there
 	     is no constant, we want
@@ -11157,7 +11156,7 @@ macro (struct mips_cl_insn *ip, char *str)
 	      if (mips_pic == SVR4_PIC
 		  && breg == 0
 		  && (call || tempreg == PIC_CALL_REG))
-		lw_reloc_type = (int) BFD_RELOC_MIPS_CALL16;
+		lw_reloc_type = BFD_RELOC_MIPS_CALL16;
 
 	      relax_start (offset_expr.X_add_symbol);
 	      macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg,
@@ -11319,9 +11318,9 @@ macro (struct mips_cl_insn *ip, char *str)
       else if (mips_big_got && !HAVE_NEWABI)
 	{
 	  int gpdelay;
-	  int lui_reloc_type = (int) BFD_RELOC_MIPS_GOT_HI16;
-	  int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT_LO16;
-	  int local_reloc_type = (int) BFD_RELOC_MIPS_GOT16;
+	  int lui_reloc_type = BFD_RELOC_MIPS_GOT_HI16;
+	  int lw_reloc_type = BFD_RELOC_MIPS_GOT_LO16;
+	  int local_reloc_type = BFD_RELOC_MIPS_GOT16;
 
 	  /* This is the large GOT case.  If this is a reference to an
 	     external symbol, and there is no constant, we want
@@ -11371,8 +11370,8 @@ macro (struct mips_cl_insn *ip, char *str)
 	  if (expr1.X_add_number == 0 && breg == 0
 	      && (call || tempreg == PIC_CALL_REG))
 	    {
-	      lui_reloc_type = (int) BFD_RELOC_MIPS_CALL_HI16;
-	      lw_reloc_type = (int) BFD_RELOC_MIPS_CALL_LO16;
+	      lui_reloc_type = BFD_RELOC_MIPS_CALL_HI16;
+	      lw_reloc_type = BFD_RELOC_MIPS_CALL_LO16;
 	    }
 	  macro_build (&offset_expr, "lui", LUI_FMT, tempreg, lui_reloc_type);
 	  macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t",
@@ -11474,8 +11473,8 @@ macro (struct mips_cl_insn *ip, char *str)
 	}
       else if (mips_big_got && HAVE_NEWABI)
 	{
-	  int lui_reloc_type = (int) BFD_RELOC_MIPS_GOT_HI16;
-	  int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT_LO16;
+	  int lui_reloc_type = BFD_RELOC_MIPS_GOT_HI16;
+	  int lw_reloc_type = BFD_RELOC_MIPS_GOT_LO16;
 	  int add_breg_early = 0;
 
 	  /* This is the large GOT case.  If this is a reference to an
@@ -11517,8 +11516,8 @@ macro (struct mips_cl_insn *ip, char *str)
 	  if (expr1.X_add_number == 0 && breg == 0
 	      && (call || tempreg == PIC_CALL_REG))
 	    {
-	      lui_reloc_type = (int) BFD_RELOC_MIPS_CALL_HI16;
-	      lw_reloc_type = (int) BFD_RELOC_MIPS_CALL_LO16;
+	      lui_reloc_type = BFD_RELOC_MIPS_CALL_HI16;
+	      lw_reloc_type = BFD_RELOC_MIPS_CALL_LO16;
 	    }
 	  macro_build (&offset_expr, "lui", LUI_FMT, tempreg, lui_reloc_type);
 	  macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t",
@@ -12532,7 +12531,7 @@ macro (struct mips_cl_insn *ip, char *str)
 	}
       else if (!mips_big_got)
 	{
-	  int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT16;
+	  int lw_reloc_type = BFD_RELOC_MIPS_GOT16;
 
 	  /* If this is a reference to an external symbol, we want
 	       lw	$tempreg,<sym>($gp)	(BFD_RELOC_MIPS_GOT16)
diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c
index c4cf8040055..3c8834e2c0f 100644
--- a/gas/config/tc-mn10300.c
+++ b/gas/config/tc-mn10300.c
@@ -2145,7 +2145,7 @@ md_assemble (char *str)
 
 	      fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset,
 				  reloc_size / 8, &fixups[i].exp, pcrel,
-				  ((bfd_reloc_code_real_type) reloc));
+				  reloc);
 
 	      if (pcrel)
 		fixP->fx_offset += offset;
diff --git a/gas/config/tc-mt.c b/gas/config/tc-mt.c
index 0cfc82dedb0..9dd884f42f9 100644
--- a/gas/config/tc-mt.c
+++ b/gas/config/tc-mt.c
@@ -461,10 +461,10 @@ mt_apply_fix (fixS *fixP, valueT *valueP, segT seg)
 bool
 mt_fix_adjustable (fixS * fixP)
 {
-  if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+  if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
     {
       const CGEN_INSN *insn = NULL;
-      int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+      int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
       const CGEN_OPERAND *operand;
 
       operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex);
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index bb5d387317b..5a93b41786f 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -2298,7 +2298,7 @@ ppc_elf_suffix (char **str_p, expressionS *exp_p)
 	  }
 	*str_p = str;
 
-	if (reloc == (int) BFD_RELOC_PPC64_TOC
+	if (reloc == BFD_RELOC_PPC64_TOC
 	    && exp_p->X_op == O_symbol
 	    && strcmp (S_GET_NAME (exp_p->X_add_symbol), ".TOC.") == 0)
 	  {
@@ -2311,7 +2311,7 @@ ppc_elf_suffix (char **str_p, expressionS *exp_p)
 	    && (ppc_cpu & PPC_OPCODE_POWER10) == 0)
 	  reloc = BFD_RELOC_PPC64_REL24_P9NOTOC;
 
-	return (bfd_reloc_code_real_type) reloc;
+	return reloc;
       }
 
   return BFD_RELOC_NONE;
@@ -2779,7 +2779,7 @@ ppc_xcoff_suffix (char **str_p)
 	&& (ppc_obj64 ? ptr->valid64 : ptr->valid32))
       {
 	*str_p = str;
-	return (bfd_reloc_code_real_type) ptr->reloc;
+	return ptr->reloc;
       }
 
   return BFD_RELOC_NONE;
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index 6e9dca02984..4ddee63dd9e 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -1906,8 +1906,7 @@ md_gather_operands (char *str,
 	fixP = fix_new_exp (frag_now, f - frag_now->fr_literal, 4,
 			    &fixups[i].exp,
 			    (operand->flags & S390_OPERAND_PCREL) != 0,
-			    ((bfd_reloc_code_real_type)
-			     (fixups[i].opindex + (int) BFD_RELOC_UNUSED)));
+			    fixups[i].opindex + BFD_RELOC_UNUSED);
       /* s390_insert_operand () does the range checking.  */
       if (operand->flags & S390_OPERAND_PCREL)
 	fixP->fx_no_overflow = 1;
@@ -2490,12 +2489,12 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
   else
     fixP->fx_done = 1;
 
-  if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+  if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
     {
       const struct s390_operand *operand;
       int opindex;
 
-      opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+      opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
       operand = &s390_operands[opindex];
 
       if (fixP->fx_done)
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index a5198562899..85a59ac034d 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -3310,8 +3310,7 @@ md_assemble (char *str)
 		       f - frag_now->fr_literal, 4,
 		       & fixups[i].exp,
 		       (operand->flags & V850_PCREL) != 0,
-		       (bfd_reloc_code_real_type) (fixups[i].opindex
-						   + (int) BFD_RELOC_UNUSED));
+		       fixups[i].opindex + BFD_RELOC_UNUSED);
 	}
     }
 
@@ -3439,14 +3438,14 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
       fixP->fx_addnumber = value;
     }
 
-  if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+  if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
     {
       int opindex;
       const struct v850_operand *operand;
       unsigned long insn;
       const char *errmsg = NULL;
 
-      opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+      opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
       operand = &v850_operands[opindex];
 
       /* Fetch the instruction, insert the fully resolved operand
diff --git a/gas/config/tc-xstormy16.c b/gas/config/tc-xstormy16.c
index 83bf87386a6..f7807f5049d 100644
--- a/gas/config/tc-xstormy16.c
+++ b/gas/config/tc-xstormy16.c
@@ -481,9 +481,9 @@ xstormy16_md_apply_fix (fixS *   fixP,
   if (fixP->fx_subsy != (symbolS *) NULL)
     as_bad_subtract (fixP);
 
-  if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+  if (fixP->fx_r_type >= BFD_RELOC_UNUSED)
     {
-      int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+      int opindex = fixP->fx_r_type - BFD_RELOC_UNUSED;
       const CGEN_OPERAND *operand = cgen_operand_lookup_by_num (cd, opindex);
       const char *errmsg;
       bfd_reloc_code_real_type reloc_type;


More information about the Binutils-cvs mailing list