Fix compile time warnings generated when compiling with clang.
authorNick Clifton <nickc@redhat.com>
Wed, 23 Sep 2015 17:05:16 +0000 (18:05 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 23 Sep 2015 17:05:16 +0000 (18:05 +0100)
bfd * bout.c (b_out_slurp_reloc_table): Cast constant to unsigned in
order to avoid problems with left shifting negative values.
(abs32code): Likewise.
* mach-o.c (FILE_ALIGN): Likewise.
* coff-rs6000.c (xcoff_debug_sections): Delete unused static
array.
* elf32-visium.c (visium_reloc_map): Likewise.
* elf32-arm.c (elf32_arm_final_link_relocate): Remove useless
calls to abs function.
* elf32-frv.c (_frvfdpic_relax_tls_entries): Likewise.
* elf32-score.c (score_elf_final_link_relocate): Likewise.
* elf32-score7.c (score_elf_final_link_relocate): Likewise.
* elf32-i860.c (i860_howto_pc26_reloc): Use multiplication instead
of shifting to create a negative mask.
* elf32-msp430.c (elf_backend_special_sections): Define.
* elfxx-mips.c (got_ofst_reloc_p): Delete unused function.
(got_hi16_reloc_p): Delete unused function.
* ppcboot.c (ppcboot_bfd_print_private_bfd_data): Fix test of
partition name.

gas * config/tc-ppc.c (insn_validate): Cast PPC_OPSHIFT_INV to an int.

opcode * ppc.h (PPC_OPSHIFT_INV): Use an unsigned constant when left
shifting.

ld * emultempl/elf32.em (ehdr_start_empty): New static variable.
(before_allocation): Use it to initialise ehdr_start_save.
* emultempl/pe.em (write_build_id): Remove useless double
parenthesis.
* emultempl/pep.em (write_build_id): Likewise.

opcodes * bfin-dis.c (fmtconst): Remove unnecessary call to the abs
function.
* tic30-dis.c (print_branch): Likewise.
* cgen-asm.c (cgen_parse_signed_integer): Cast integer to signed
value before left shifting.
* fr30-ibld.c (fr30_cgen_extract_operand): Likewise.
* hppa-dis.c (print_insn_hppa): Likewise.
* mips-dis.c (mips_cp0sel_names_mipsr5900): Delete unused static
array.
* msp430-dis.c (msp430_singleoperand): Likewise.
(msp430_doubleoperand): Likewise.
(print_insn_msp430): Likewise.
* nds32-asm.c (parse_operand): Likewise.
* sh-opc.h (MASK): Likewise.
* v850-dis.c (get_operand_value): Likewise.

32 files changed:
bfd/ChangeLog
bfd/bout.c
bfd/coff-rs6000.c
bfd/elf32-arm.c
bfd/elf32-frv.c
bfd/elf32-i860.c
bfd/elf32-msp430.c
bfd/elf32-score.c
bfd/elf32-score7.c
bfd/elf32-visium.c
bfd/elfxx-mips.c
bfd/mach-o.c
bfd/ppcboot.c
gas/ChangeLog
gas/config/tc-ppc.c
include/opcode/ChangeLog
include/opcode/ppc.h
ld/ChangeLog
ld/emultempl/elf32.em
ld/emultempl/pe.em
ld/emultempl/pep.em
opcodes/ChangeLog
opcodes/bfin-dis.c
opcodes/cgen-asm.c
opcodes/fr30-ibld.c
opcodes/hppa-dis.c
opcodes/mips-dis.c
opcodes/msp430-dis.c
opcodes/nds32-asm.c
opcodes/sh-opc.h
opcodes/tic30-dis.c
opcodes/v850-dis.c

index bdae109a06ddfa3c6e14e003b74cdd804a573b71..c0672115d22d8831a7ceb613c4a341e74f2f30c8 100644 (file)
@@ -1,3 +1,25 @@
+2015-09-23  Nick Clifton  <nickc@redhat.com>
+
+       * bout.c (b_out_slurp_reloc_table): Cast constant to unsigned in
+       order to avoid problems with left shifting negative values.
+       (abs32code): Likewise.
+       * mach-o.c (FILE_ALIGN): Likewise.
+       * coff-rs6000.c (xcoff_debug_sections): Delete unused static
+       array.
+       * elf32-visium.c (visium_reloc_map): Likewise.
+       * elf32-arm.c (elf32_arm_final_link_relocate): Remove useless
+       calls to abs function.
+       * elf32-frv.c (_frvfdpic_relax_tls_entries): Likewise.
+       * elf32-score.c (score_elf_final_link_relocate): Likewise.
+       * elf32-score7.c (score_elf_final_link_relocate): Likewise.
+       * elf32-i860.c (i860_howto_pc26_reloc): Use multiplication instead
+       of shifting to create a negative mask.
+       * elf32-msp430.c (elf_backend_special_sections): Define.
+       * elfxx-mips.c (got_ofst_reloc_p): Delete unused function.
+       (got_hi16_reloc_p): Delete unused function.
+       * ppcboot.c (ppcboot_bfd_print_private_bfd_data): Fix test of
+       partition name.
+
 2015-09-23  Nick Clifton  <nickc@redhat.com>
 
        PR binutils/15835
index f356b96badc12b34556eb299f02be18d22c657ed..d6f188bfa98a1f81b33b505ce3e02cc11a3b1854 100644 (file)
@@ -783,7 +783,7 @@ b_out_slurp_reloc_table (bfd *abfd, sec_ptr asect, asymbol **symbols)
        /* Sign-extend symnum from 24 bits to whatever host uses.  */
        s = symnum;
        if (s & (1 << 23))
-         s |= (~0) << 24;
+         s |= (~0U) << 24;
 
        cache_ptr->sym_ptr_ptr = (asymbol **)NULL;
        switch (s)
@@ -1069,7 +1069,7 @@ abs32code (bfd *abfd,
      jump we were going to.  */
   gap = value - (dot - shrink);
 
-  if (-1 << 23 < (long)gap && (long)gap < 1 << 23)
+  if ((long)(-1UL << 23) < (long)gap && (long)gap < 1L << 23)
     {
       /* Change the reloc type from 32bitcode possible 24, to 24bit
         possible 32.  */
index 95430c3f8882db09de45e81a1e552444b7dde970..b7098a1d9c3b77d8d7849b275686a60a85c73e31 100644 (file)
@@ -402,34 +402,6 @@ _bfd_xcoff_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED,
 {
   return FALSE;
 }
-
-static const struct dwarf_debug_section xcoff_debug_sections[] =
-{
-  { ".dwabrev",                NULL },
-  { ".dwarnge",                NULL },
-  { NULL,      NULL }, /* .debug_frame */
-  { ".dwinfo",         NULL },
-  { ".dwline",         NULL },
-  { NULL,      NULL }, /* .debug_loc */
-  { NULL,      NULL }, /* .debug_macinfo */
-  { NULL,      NULL }, /* .debug_macro */
-  { ".dwpbnms",                NULL },
-  { ".dwpbtyp",                NULL },
-  { ".dwrnges",                NULL },
-  { NULL,      NULL }, /* .debug_static_func */
-  { NULL,      NULL }, /* .debug_static_vars */
-  { ".dwstr",  NULL },
-  { NULL,      NULL }, /* .debug_types */
-  /* GNU DWARF 1 extensions */
-  { NULL,      NULL }, /* .debug_sfnames */
-  { NULL,      NULL }, /* .debug_srcinfo */
-  /* SGI/MIPS DWARF 2 extensions */
-  { NULL,      NULL }, /* .debug_funcnames */
-  { NULL,      NULL }, /* .debug_typenames */
-  { NULL,      NULL }, /* .debug_varnames */
-  { NULL,      NULL }, /* .debug_weaknames */
-  { NULL,      NULL },
-};
 \f
 void
 _bfd_xcoff_swap_sym_in (bfd *abfd, void * ext1, void * in1)
index bd41fd0ec918e18d0dc2867fe7889bdab421c017..aa01a59e9a2d787ce4ba40243fdadf752ecca97a 100644 (file)
@@ -8816,7 +8816,7 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
                          + input_section->output_offset
                          + rel->r_offset);
 
-       value = abs (relocation);
+       value = relocation;
 
        if (value >= 0x1000)
          return bfd_reloc_overflow;
@@ -8851,7 +8851,7 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
                          + input_section->output_offset
                          + rel->r_offset);
 
-       value = abs (relocation);
+       value = relocation;
 
        /* We do not check for overflow of this reloc.  Although strictly
           speaking this is incorrect, it appears to be necessary in order
@@ -8888,7 +8888,7 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
                          + input_section->output_offset
                          + rel->r_offset);
 
-       value = abs (relocation);
+       value = relocation;
 
        if (value >= 0x1000)
          return bfd_reloc_overflow;
@@ -10125,8 +10125,8 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
 
        /* Calculate the value of the relevant G_n, in encoded
           constant-with-rotation format.  */
-       g_n = calculate_group_reloc_mask (abs (signed_value), group,
-                                         &residual);
+       g_n = calculate_group_reloc_mask (signed_value < 0 ? - signed_value : signed_value,
+                                         group, &residual);
 
        /* Check for overflow if required.  */
        if ((r_type == R_ARM_ALU_PC_G0
@@ -10139,7 +10139,8 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
            (*_bfd_error_handler)
              (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
              input_bfd, input_section,
-             (long) rel->r_offset, abs (signed_value), howto->name);
+              (long) rel->r_offset, signed_value < 0 ? - signed_value : signed_value,
+              howto->name);
            return bfd_reloc_overflow;
          }
 
@@ -10219,15 +10220,16 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
 
        /* Calculate the value of the relevant G_{n-1} to obtain
           the residual at that stage.  */
-       calculate_group_reloc_mask (abs (signed_value), group - 1, &residual);
+       calculate_group_reloc_mask (signed_value < 0 ? - signed_value : signed_value,
+                                   group - 1, &residual);
 
        /* Check for overflow.  */
        if (residual >= 0x1000)
          {
            (*_bfd_error_handler)
              (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
-             input_bfd, input_section,
-             (long) rel->r_offset, abs (signed_value), howto->name);
+              input_bfd, input_section,
+              (long) rel->r_offset, labs (signed_value), howto->name);
            return bfd_reloc_overflow;
          }
 
@@ -10303,15 +10305,16 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
 
        /* Calculate the value of the relevant G_{n-1} to obtain
           the residual at that stage.  */
-       calculate_group_reloc_mask (abs (signed_value), group - 1, &residual);
+       calculate_group_reloc_mask (signed_value < 0 ? - signed_value : signed_value,
+                                   group - 1, &residual);
 
        /* Check for overflow.  */
        if (residual >= 0x100)
          {
            (*_bfd_error_handler)
              (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
-             input_bfd, input_section,
-             (long) rel->r_offset, abs (signed_value), howto->name);
+              input_bfd, input_section,
+              (long) rel->r_offset, labs (signed_value), howto->name);
            return bfd_reloc_overflow;
          }
 
@@ -10387,7 +10390,8 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
 
        /* Calculate the value of the relevant G_{n-1} to obtain
           the residual at that stage.  */
-       calculate_group_reloc_mask (abs (signed_value), group - 1, &residual);
+       calculate_group_reloc_mask (signed_value < 0 ? - signed_value : signed_value,
+                                   group - 1, &residual);
 
        /* Check for overflow.  (The absolute value to go in the place must be
           divisible by four and, after having been divided by four, must
@@ -10397,7 +10401,7 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
            (*_bfd_error_handler)
              (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
              input_bfd, input_section,
-             (long) rel->r_offset, abs (signed_value), howto->name);
+             (long) rel->r_offset, labs (signed_value), howto->name);
            return bfd_reloc_overflow;
          }
 
index 1dd2e8cac5699ea4d2fbc84ac3980b40b9487b64..cd37856801d54da9849d67d7aaa3060cba0310dd 100644 (file)
@@ -4640,7 +4640,7 @@ _frvfdpic_relax_tls_entries (struct frvfdpic_relocs_info *entry,
                            + 32768) < (bfd_vma)65536))
          || (entry->symndx != -1
              && (elf_hash_table (dinfo->info)->tls_sec->size
-                 + abs (entry->addend) < 32768 + FRVFDPIC_TLS_BIAS))))
+                 + entry->addend < 32768 + FRVFDPIC_TLS_BIAS))))
     {
       if (! changed)
        {
index 8577f581aadd0115d361649ece9e6f031e772c5c..f3c7210cf0d7bfcc5b1a5df705aca777f484d31b 100644 (file)
@@ -74,7 +74,7 @@ i860_howto_pc26_reloc (bfd *abfd ATTRIBUTE_UNUSED,
 
   /* Check for target out of range.  */
   if ((bfd_signed_vma)relocation > (0x3ffffff << 2)
-      || (bfd_signed_vma)relocation < (-0x4000000 << 2))
+      || (bfd_signed_vma)relocation < (-0x4000000 * 4))
     return bfd_reloc_outofrange;
 
   addr = (bfd_byte *) data + reloc_entry->address;
@@ -137,7 +137,7 @@ i860_howto_pc16_reloc (bfd *abfd,
 
   /* Check for target out of range.  */
   if ((bfd_signed_vma)relocation > (0x7fff << 2)
-      || (bfd_signed_vma)relocation < (-0x8000 << 2))
+      || (bfd_signed_vma)relocation < (-0x8000 * 4))
     return bfd_reloc_outofrange;
 
   addr = (bfd_byte *) data + reloc_entry->address;
index 8e87b67e4f5d70df6b7342d75f2214c6f77b97ed..e77565e5408f1bc001180c5d55bd61a12ce52d12 100644 (file)
@@ -2629,4 +2629,7 @@ static const struct bfd_elf_special_section msp430_ti_elf_special_sections[] =
   { NULL, 0,                                0, 0,                      0 }
 };
 
+#undef  elf_backend_special_sections
+#define elf_backend_special_sections           msp430_ti_elf_special_sections
+
 #include "elf32-target.h"
index ce9c3777559620ee7a99b9ee978544a1512587fd..1d558c0273f553a4ee15f5d4d82a3e8d4722c194 100644 (file)
@@ -2165,7 +2165,7 @@ score_elf_final_link_relocate (reloc_howto_type *howto,
       if ((offset & 0x1000000) != 0)
         offset |= 0xfe000000;
       value += offset;
-      abs_value = abs (value - rel_addr);
+      abs_value = value - rel_addr;
       if ((abs_value & 0xfe000000) != 0)
         return bfd_reloc_overflow;
       addend = (addend & ~howto->src_mask)
@@ -2241,7 +2241,7 @@ score_elf_final_link_relocate (reloc_howto_type *howto,
       if ((offset & 0x800) != 0)        /* Offset is negative.  */
         offset |= 0xfffff000;
       value += offset;
-      abs_value = abs (value - rel_addr);
+      abs_value = value - rel_addr;
       if ((abs_value & 0xfffff000) != 0)
         return bfd_reloc_overflow;
       addend = (addend & ~howto->src_mask) | (value & howto->src_mask);
index b0e75bb9cae7f250652c597584a9459fdd4d6e3c..5adf9f4817ba8349dab9d7382b4d95ca431aef25 100644 (file)
@@ -2065,7 +2065,7 @@ score_elf_final_link_relocate (reloc_howto_type *howto,
       if ((offset & 0x1000000) != 0)
         offset |= 0xfe000000;
       value += offset;
-      abs_value = abs (value - rel_addr);
+      abs_value = value - rel_addr;
       if ((abs_value & 0xfe000000) != 0)
         return bfd_reloc_overflow;
       addend = (addend & ~howto->src_mask)
@@ -2095,7 +2095,7 @@ score_elf_final_link_relocate (reloc_howto_type *howto,
       if ((offset & 0x800) != 0)        /* Offset is negative.  */
         offset |= 0xfffff000;
       value += offset;
-      abs_value = abs (value - rel_addr);
+      abs_value = value - rel_addr;
       if ((abs_value & 0xfffff000) != 0)
         return bfd_reloc_overflow;
       addend = (addend & ~howto->src_mask) | (value & howto->src_mask);
index 637d72bc2f2d17a9edcfbc15287caae3e2915322..52267c3d885479dfba2c5047b8daa9a0822d7e54 100644 (file)
@@ -276,32 +276,6 @@ static reloc_howto_type visium_elf_vtentry_howto =
         0,                        /* dst_mask */
         FALSE);                   /* pcrel_offset */
 
-/* Map BFD reloc types to VISIUM ELF reloc types.  */
-struct visium_reloc_map
-{
-  bfd_reloc_code_real_type bfd_reloc_val;
-  unsigned int visium_reloc_val;
-};
-
-static const struct visium_reloc_map visium_reloc_map[] = {
-  {BFD_RELOC_NONE,             R_VISIUM_NONE},
-  {BFD_RELOC_8,                R_VISIUM_8},
-  {BFD_RELOC_16,               R_VISIUM_16},
-  {BFD_RELOC_32,               R_VISIUM_32},
-  {BFD_RELOC_8_PCREL,          R_VISIUM_8_PCREL},
-  {BFD_RELOC_16_PCREL,         R_VISIUM_16_PCREL},
-  {BFD_RELOC_32_PCREL,         R_VISIUM_32_PCREL},
-  {BFD_RELOC_VISIUM_REL16,     R_VISIUM_PC16},
-  {BFD_RELOC_VISIUM_HI16,      R_VISIUM_HI16},
-  {BFD_RELOC_VISIUM_LO16,      R_VISIUM_LO16},
-  {BFD_RELOC_VISIUM_IM16,      R_VISIUM_IM16},
-  {BFD_RELOC_VISIUM_HI16_PCREL,        R_VISIUM_HI16_PCREL},
-  {BFD_RELOC_VISIUM_LO16_PCREL,        R_VISIUM_LO16_PCREL},
-  {BFD_RELOC_VISIUM_IM16_PCREL,        R_VISIUM_IM16_PCREL},
-  {BFD_RELOC_VTABLE_INHERIT,   R_VISIUM_GNU_VTINHERIT},
-  {BFD_RELOC_VTABLE_ENTRY,     R_VISIUM_GNU_VTENTRY},
-};
-
 /* Return the parity bit for INSN shifted to its final position.  */
 
 static bfd_vma
index 4689b21463302a3c452846c2835686bec66e8d11..12d7a03d63119f4ae1344b67d81f8eb94a3f888d 100644 (file)
@@ -2156,18 +2156,6 @@ got_page_reloc_p (unsigned int r_type)
   return r_type == R_MIPS_GOT_PAGE || r_type == R_MICROMIPS_GOT_PAGE;
 }
 
-static inline bfd_boolean
-got_ofst_reloc_p (unsigned int r_type)
-{
-  return r_type == R_MIPS_GOT_OFST || r_type == R_MICROMIPS_GOT_OFST;
-}
-
-static inline bfd_boolean
-got_hi16_reloc_p (unsigned int r_type)
-{
-  return r_type == R_MIPS_GOT_HI16 || r_type == R_MICROMIPS_GOT_HI16;
-}
-
 static inline bfd_boolean
 got_lo16_reloc_p (unsigned int r_type)
 {
index e6cbe2319bf8e35ecfe4752a0b79169ff55d81ca..5b122c59376af71018efff05c57ac67c150cbf76 100644 (file)
@@ -35,7 +35,7 @@
 #define bfd_mach_o_mkobject bfd_mach_o_gen_mkobject
 
 #define FILE_ALIGN(off, algn) \
-  (((off) + ((file_ptr) 1 << (algn)) - 1) & ((file_ptr) -1 << (algn)))
+  (((off) + ((file_ptr) 1 << (algn)) - 1) & ((file_ptr) -1U << (algn)))
 
 static bfd_boolean
 bfd_mach_o_read_dyld_content (bfd *abfd, bfd_mach_o_dyld_info_command *cmd);
index 12fad624a7c54596f6b81c1ed090cf45edbdb6f7..c3fb4feb92cf41569cfc9b547ada827eddb56866 100644 (file)
@@ -402,7 +402,7 @@ ppcboot_bfd_print_private_bfd_data (bfd *abfd, void * farg)
   if (tdata->header.os_id)
     fprintf (f, "OS_ID               = 0x%.2x\n", tdata->header.os_id);
 
-  if (tdata->header.partition_name)
+  if (tdata->header.partition_name[0])
     fprintf (f, _("Partition name      = \"%s\"\n"), tdata->header.partition_name);
 
   for (i = 0; i < 4; i++)
index fe1ed7446ad0106c6acbd39f3e65f5c1faac4a37..606dcf0742bf702d8b52e99ca7848cfb6174a25b 100644 (file)
@@ -1,3 +1,7 @@
+2015-09-23  Nick Clifton  <nickc@redhat.com>
+
+       * config/tc-ppc.c (insn_validate): Cast PPC_OPSHIFT_INV to an int.
+
 2015-09-22  Nick Clifton  <nickc@redhat.com>
 
        * config/tc-rx.c (nop_7): Recode using MAX.
index 6e48f7a487f2c23dcb2d0a5e8a82787115aa2fc6..b6b4412f2861b7304ba83c1e08861ae1a4208aea 100644 (file)
@@ -1457,7 +1457,7 @@ insn_validate (const struct powerpc_opcode *op)
       else
         {
          const struct powerpc_operand *operand = &powerpc_operands[*o];
-         if (operand->shift != PPC_OPSHIFT_INV)
+         if (operand->shift != (int) PPC_OPSHIFT_INV)
            {
              unsigned long mask;
 
index d81b604616f04ffbf104575129f26cb735d21d7f..44fc32cb93aae6ef6c8bba0efd63953d0c7ebddb 100644 (file)
@@ -1,3 +1,8 @@
+2015-09-23  Nick Clifton  <nickc@redhat.com>
+
+       * ppc.h (PPC_OPSHIFT_INV): Use an unsigned constant when left
+       shifting.
+
 2015-09-22  Nick Clifton  <nickc@redhat.com>
 
        * rx.h (enum RX_Size): Add RX_Bad_Size entry.
index 6106dec426707753a0de62203187051c5019afe0..8f87e684815af1a895a47096463cdbbc84c13fbb 100644 (file)
@@ -286,7 +286,7 @@ extern const unsigned int num_powerpc_operands;
 /* Use with the shift field of a struct powerpc_operand to indicate
      that BITM and SHIFT cannot be used to determine where the operand
      goes in the insn.  */
-#define PPC_OPSHIFT_INV (-1 << 31)
+#define PPC_OPSHIFT_INV (-1U << 31)
 
 /* Values defined for the flags field of a struct powerpc_operand.  */
 
index 93a852a6de0f50d7e1aba38377e8dcfbbc7a9347..3b69e31e1751ba1db63e5e10cb1b81d8d672ba77 100644 (file)
@@ -1,3 +1,11 @@
+2015-09-23  Nick Clifton  <nickc@redhat.com>
+
+       * emultempl/elf32.em (ehdr_start_empty): New static variable.
+       (before_allocation): Use it to initialise ehdr_start_save.
+       * emultempl/pe.em (write_build_id): Remove useless double
+       parenthesis.
+       * emultempl/pep.em (write_build_id): Likewise.
+
 2015-09-22  H.J. Lu  <hongjiu.lu@intel.com>
 
        * emultempl/alphaelf.em (alpha_after_parse): Call
index b7ddca38062ee50c667697a126f4de3e46f31379..ea6d48c701b1a61c30ca229a9eacba72e627705b 100644 (file)
@@ -1449,6 +1449,11 @@ gld${EMULATION_NAME}_append_to_separated_string (char **to, char *op_arg)
     }
 }
 
+#if defined(__GNUC__) && GCC_VERSION < 4006
+  /* Work around a GCC uninitialized warning bug fixed in GCC 4.6.  */
+static struct bfd_link_hash_entry ehdr_start_empty;
+#endif
+
 /* This is called after the sections have been attached to output
    sections, but before any sizes or addresses have been set.  */
 
@@ -1461,7 +1466,7 @@ gld${EMULATION_NAME}_before_allocation (void)
   struct elf_link_hash_entry *ehdr_start = NULL;
 #if defined(__GNUC__) && GCC_VERSION < 4006
   /* Work around a GCC uninitialized warning bug fixed in GCC 4.6.  */
-  struct bfd_link_hash_entry ehdr_start_save = ehdr_start_save;
+  struct bfd_link_hash_entry ehdr_start_save = ehdr_start_empty;
 #else
   struct bfd_link_hash_entry ehdr_start_save;
 #endif
index 72e2f114064fd475d7ee9c612c7ae747912363b4..04a7f5cd7f81b850404053a425beedc76ed4d0a7 100644 (file)
@@ -1312,7 +1312,7 @@ write_build_id (bfd *abfd)
       struct bfd_link_order *l = NULL;
       for (l = asec->map_head.link_order; l != NULL; l = l->next)
         {
-          if ((l->type == bfd_indirect_link_order))
+          if (l->type == bfd_indirect_link_order)
             {
               if (l->u.indirect.section == t->build_id.sec)
                 {
@@ -1364,7 +1364,7 @@ write_build_id (bfd *abfd)
   if (bfd_seek (abfd, asec->filepos + link_order->offset, SEEK_SET) != 0)
     return 0;
 
-  if ((bfd_bwrite (contents, size, abfd) != size))
+  if (bfd_bwrite (contents, size, abfd) != size)
     return 0;
 
   /* Construct the CodeView record.  */
index c82e496d425309f60968c32614b6bfcfe342fc10..0b740c3ccd0b1acaa9aa30d0558d932a29fa6373 100644 (file)
@@ -1276,7 +1276,7 @@ write_build_id (bfd *abfd)
       struct bfd_link_order *l = NULL;
       for (l = asec->map_head.link_order; l != NULL; l = l->next)
         {
-          if ((l->type == bfd_indirect_link_order))
+          if (l->type == bfd_indirect_link_order)
             {
               if (l->u.indirect.section == t->build_id.sec)
                 {
@@ -1328,7 +1328,7 @@ write_build_id (bfd *abfd)
   if (bfd_seek (abfd, asec->filepos + link_order->offset, SEEK_SET) != 0)
     return 0;
 
-  if ((bfd_bwrite (contents, size, abfd) != size))
+  if (bfd_bwrite (contents, size, abfd) != size)
     return 0;
 
   /* Construct the CodeView record.  */
index 942cdcd23c8b3047d9741320c2a2c88a415daeda..b0982990c3a2ce822e3eab0ad24f0bad1f902e26 100644 (file)
@@ -1,3 +1,21 @@
+2015-09-23  Nick Clifton  <nickc@redhat.com>
+
+       * bfin-dis.c (fmtconst): Remove unnecessary call to the abs
+       function.
+       * tic30-dis.c (print_branch): Likewise.
+       * cgen-asm.c (cgen_parse_signed_integer): Cast integer to signed
+       value before left shifting.
+       * fr30-ibld.c (fr30_cgen_extract_operand): Likewise.
+       * hppa-dis.c (print_insn_hppa): Likewise.
+       * mips-dis.c (mips_cp0sel_names_mipsr5900): Delete unused static
+       array.
+       * msp430-dis.c (msp430_singleoperand): Likewise.
+       (msp430_doubleoperand): Likewise.
+       (print_insn_msp430): Likewise.
+       * nds32-asm.c (parse_operand): Likewise.
+       * sh-opc.h (MASK): Likewise.
+       * v850-dis.c (get_operand_value): Likewise.
+
 2015-09-22  Nick Clifton  <nickc@redhat.com>
 
        * rx-decode.opc (bwl): Use RX_Bad_Size.
index bf2052e3ed137041864aea75a6e2c9ea5d56835e..54fac225341417c212c10cf7e80d84745458de1c 100644 (file)
@@ -167,7 +167,7 @@ fmtconst (const_forms_t cf, TIword x, bfd_vma pc, disassemble_info *outf)
   else
     {
       if (constant_formats[cf].issigned && x < 0)
-       sprintf (buf, "-0x%x", abs (x));
+       sprintf (buf, "-0x%lx", (unsigned long)(- x));
       else
        sprintf (buf, "0x%lx", (unsigned long) x);
     }
index f4f81d76ab3674a986403cca8865904805557213..69b9be8923fd598a51c937983d2677b0b3238da5 100644 (file)
@@ -280,7 +280,7 @@ cgen_parse_signed_integer (CGEN_CPU_DESC cd,
          && value > 0
          && (value & 0x80000000)
          && ((value >> 31) == 1))
-       value |= -1 << 31;
+       value |= ((bfd_vma) -1) << 31;
 
       *valuep = value;
     }
index 177a12baba35e12459fc917243a70334626e3e44..ed6ecd486ae74039f3ead637266ae90af8714fb5 100644 (file)
@@ -874,7 +874,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 16, total_length, pc, & value);
-        value = ((value) | (((-1) << (4))));
+        value = ((value) | (((-1UL) << (4))));
         fields->f_m4 = value;
       }
       break;
index 4be0f3ca41600bacfb4efa037cdd67677cf81676..8562952206b288ef7e4df99b4b319a053c29ba7f 100644 (file)
@@ -1103,7 +1103,7 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info)
                    int disp;
 
                    if (sign)
-                     disp = (-1 << 10) | imm10;
+                     disp = (-1U << 10) | imm10;
                    else
                      disp = imm10;
 
@@ -1119,7 +1119,7 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info)
                    int disp;
 
                    if (sign)
-                     disp = (-1 << 11) | imm11;
+                     disp = (-1U << 11) | imm11;
                    else
                      disp = imm11;
 
index d1573c0afc34a5e5fcacb40493242dc610aedef6..820092024af270f50218ed3fb73a7134b280042f 100644 (file)
@@ -157,18 +157,6 @@ static const char * const mips_cp0_names_r5900[32] =
   "c0_taglo",     "c0_taghi",     "c0_errorepc",  "$31"
 };
 
-static const struct mips_cp0sel_name mips_cp0sel_names_mipsr5900[] =
-{
-  { 24, 2, "c0_iab"                    },
-  { 24, 3, "c0_iabm"           },
-  { 24, 4, "c0_dab"                    },
-  { 24, 5, "c0_dabm"           },
-  { 24, 6, "c0_dvb"                    },
-  { 24, 7, "c0_dvbm"           },
-  { 25, 1, "c0_perfcnt,1"      },
-  { 25, 2, "c0_perfcnt,2"      }
-};
-
 static const char * const mips_cp0_names_mips3264[32] =
 {
   "c0_index",     "c0_random",    "c0_entrylo0",  "c0_entrylo1",
index a398ca43c73a55e07493568f13d40fbf2dd18302..ec8b6dc6a73648762b6ec0ad4b31efd4b52e2996 100644 (file)
@@ -229,10 +229,10 @@ msp430_singleoperand (disassemble_info *info,
                {
                  dst |= extended_dst << 16;
                  if (dst & 0x80000)
-                   dst |= -1 << 20;
+                   dst |= -1U << 20;
                }
              else if (dst & 0x8000)
-               dst |= -1 << 16;
+               dst |= -1U << 16;
              sprintf (op, "%d(r%d)", dst, regd);
            }
        }
@@ -273,7 +273,7 @@ msp430_singleoperand (disassemble_info *info,
                {
                  dst |= extended_dst << 16;
                  if (dst & 0x80000)
-                   dst |= -1 << 20;
+                   dst |= -1U << 20;
                  sprintf (op, "#%d", dst);
                  if (dst > 9 || dst < 0)
                    sprintf (comm, "#0x%05x", dst);
@@ -328,10 +328,10 @@ msp430_singleoperand (disassemble_info *info,
                {
                  dst |= extended_dst << 16;
                  if (dst & 0x80000)
-                   dst |= -1 << 20;
+                   dst |= -1U << 20;
                }
              else if (dst & 0x8000)
-               dst |= -1 << 16;
+               dst |= -1U << 16;
              sprintf (op, "%d(r%d)", dst, regd);
              if (dst > 9 || dst < 0)
                sprintf (comm, "%05x", dst);
@@ -431,7 +431,7 @@ msp430_doubleoperand (disassemble_info *info,
                {
                  dst |= extended_dst << 16;
                  if (dst & 0x80000)
-                   dst |= -1 << 20;
+                   dst |= -1U << 20;
                  sprintf (op1, "0x%05x", dst & 0xfffff);
                  sprintf (comm1, "PC rel. 0x%05lx",
                           (long)((addr + 2 + dst) & 0xfffff));
@@ -462,10 +462,10 @@ msp430_doubleoperand (disassemble_info *info,
                {
                  dst |= extended_dst << 16;
                  if (dst & 0x80000)
-                   dst |= -1 << 20;
+                   dst |= -1U << 20;
                }
              else if (dst & 0x8000)
-               dst |= -1 << 16;
+               dst |= -1U << 16;
              cmd_len += 4;
              *cycles = 6;
              sprintf (op1, "%d(r%d)", dst, regd);
@@ -523,7 +523,7 @@ msp430_doubleoperand (disassemble_info *info,
            {
              dst |= extended_src << 16;
              if (dst & 0x80000)
-               dst |= -1 << 20;
+               dst |= -1U << 20;
              sprintf (op1, "#%d", dst);
              if (dst > 9 || dst < 0)
                sprintf (comm1, "0x%05x", dst & 0xfffff);
@@ -547,7 +547,7 @@ msp430_doubleoperand (disassemble_info *info,
            {
              dst |= extended_src << 16;
              if (dst & 0x80000)
-               dst |= -1 << 20;
+               dst |= -1U << 20;
              sprintf (op1, "0x%05x", dst & 0xfffff);
              sprintf (comm1, "PC rel. 0x%05lx",
                       (long) ((addr + 2 + dst) & 0xfffff));
@@ -584,10 +584,10 @@ msp430_doubleoperand (disassemble_info *info,
            {
              dst |= extended_src << 16;
              if (dst & 0x80000)
-               dst |= -1 << 20;
+               dst |= -1U << 20;
            }
          else if (dst & 0x8000)
-           dst |= -1 << 16;
+           dst |= -1U << 16;
          sprintf (op1, "%d(r%d)", dst, regs);
          if (dst > 9 || dst < -9)
            sprintf (comm1, "0x%05x", dst);
@@ -629,7 +629,7 @@ msp430_doubleoperand (disassemble_info *info,
            {
              dst |= extended_dst << 16;
              if (dst & 0x80000)
-               dst |= -1 << 20;
+               dst |= -1U << 20;
              sprintf (op2, "0x%05x", dst & 0xfffff);
              sprintf (comm2, "PC rel. 0x%05lx",
                       (long)((addr + cmd_len + dst) & 0xfffff));
@@ -653,14 +653,14 @@ msp430_doubleoperand (disassemble_info *info,
          dst = msp430dis_opcode (addr + cmd_len, info);
          cmd_len += 2;
          if (dst & 0x8000)
-           dst |= -1 << 16;
+           dst |= -1U << 16;
          if (dst > 9 || dst < 0)
            sprintf (comm2, "0x%04x", PS (dst));
          if (extension_word)
            {
              dst |= extended_dst << 16;
              if (dst & 0x80000)
-               dst |= -1 << 20;
+               dst |= -1U << 20;
              if (dst > 9 || dst < 0)
                sprintf (comm2, "0x%05x", dst & 0xfffff);
            }
@@ -759,7 +759,7 @@ msp430_branchinstr (disassemble_info *info,
          dst = msp430dis_opcode (addr + 2, info);
          cmd_len += 2;
          if (dst & 0x8000)
-           dst |= -1 << 16;
+           dst |= -1U << 16;
          sprintf (op1, "%d(r%d)", dst, regs);
        }
     }
@@ -1013,7 +1013,7 @@ print_insn_msp430 (bfd_vma addr, disassemble_info *info)
                  reg = n;
                  n = msp430dis_opcode (addr + 2, info);
                  if (n & 0x8000)
-                   n |= -1 << 16;
+                   n |= -1U << 16;
                  sprintf (op1, "%d(r%d)", n, reg);
                  if (n > 9 || n < 0)
                    {
@@ -1040,7 +1040,7 @@ print_insn_msp430 (bfd_vma addr, disassemble_info *info)
                  sprintf (op1, "r%d", n);
                  n = msp430dis_opcode (addr + 2, info);
                  if (n & 0x8000)
-                   n |= -1 << 16;
+                   n |= -1U << 16;
                  sprintf (op2, "%d(r%d)", n, reg);
                  if (n > 9 || n < 0)
                    {
@@ -1057,7 +1057,7 @@ print_insn_msp430 (bfd_vma addr, disassemble_info *info)
                  n <<= 16;
                  n |= msp430dis_opcode (addr + 2, info);
                  if (n & 0x80000)
-                   n |= -1 << 20;
+                   n |= -1U << 20;
                  sprintf (op1, "#%d", n);
                  if (n > 9 || n < 0)
                    sprintf (comm1, "0x%05x", n);
index 406cc7cf5a27eece6edc76983abe93bed1df676d..d9f8766c9da601b8caa4779e494ad3c4f476e794 100644 (file)
@@ -2086,7 +2086,7 @@ done:
     {
       /* Sign-ext the value.  */
       if (((value >> 32) == 0) && (value & 0x80000000))
-       value |= (int64_t) -1 << 31;
+       value |= (int64_t) -1U << 31;
 
 
       /* Shift the value to positive domain.  */
index 70ed8897aad77b0cdea974885e9feb5f54c0df7a..5863aa962553fe7331bd3758bfce85c836cb245f 100644 (file)
@@ -201,10 +201,10 @@ typedef enum
 sh_dsp_reg_nums;
 
 /* Return a mask with bits LO to HI (inclusive) set.  */
-#define MASK(LO,HI)  (  LO < 1   ? ((1 << (HI + 1)) - 1) \
-                     : HI > 30  ? (-1 << LO) \
-                     : LO == HI ? (1 << LO) \
-                     :            (((1 << (HI + 1)) - 1) & (-1 << LO)))
+#define MASK(LO,HI)  (  LO < 1   ? ((1U << (HI + 1)) - 1) \
+                     : HI > 30  ? (-1U << LO)   \
+                     : LO == HI ? (1U << LO) \
+                     :            (((1U << (HI + 1)) - 1) & (-1U << LO)))
 
 #define arch_sh1_base      (1 << 0)
 #define arch_sh2_base      (1 << 1)
index 907743423c96db0fd82df68cc1b049697adc59dd..623feffe7da7df4eee97e6669ccaeb66fb7bab14 100644 (file)
@@ -669,9 +669,9 @@ print_branch (disassemble_info *info,
       if (address == 0)
        info->fprintf_func (info->stream, " <%s>", sym->name);
       else
-       info->fprintf_func (info->stream, " <%s %c %d>", sym->name,
+       info->fprintf_func (info->stream, " <%s %c %lu>", sym->name,
                            ((short) address < 0) ? '-' : '+',
-                           abs (address));
+                           address);
     }
   return 1;
 }
index d10f3e06c78483e8128149b9fdb3b840d54db2b2..0c50e5103035e7ce81216fb36cf87cad8c8877f8 100644 (file)
@@ -152,7 +152,7 @@ get_operand_value (const struct v850_operand *operand,
          if (operand->flags & V850E_IMMEDIATE16HI)
            value <<= 16;
          else if (value & 0x8000)
-           value |= (-1L << 16);
+           value |= (-1UL << 16);
 
          return value;
        }
This page took 0.065158 seconds and 4 git commands to generate.