This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Fix compile time warnings in tc-mips.c
- From: Nick Clifton <nickc at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Wed, 20 Apr 2005 15:33:57 +0100
- Subject: Fix compile time warnings in tc-mips.c
Hi Guys,
The recent patch improve larger than 32-bit number handling in the
GAS MIPS port produced a few compile time warning messages:
.../gas/config/tc-mips.c: In function `load_register':
.../gas/config/tc-mips.c:3559: warning: right shift count >= width of type
.../gas/config/tc-mips.c: In function `macro':
.../gas/config/tc-mips.c:5804: warning: right shift count >= width of type
.../gas/config/tc-mips.c:6395: warning: right shift count >= width of type
I am applying the patch below to fix this problem, by switching over
to use the sprintf_vma macro to convert the values into readable
text.
Cheers
Nick
gas/ChangeLog
2005-04-20 Nick Clifton <nickc@redhat.com>
* config/tc-mips.c (macro): Use sprintf_vma to convert a > 32 bit
number into a readable string.
(load_register): Likewise.
Index: gas/config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.310
diff -c -3 -p -r1.310 tc-mips.c
*** gas/config/tc-mips.c 18 Apr 2005 14:16:10 -0000 1.310
--- gas/config/tc-mips.c 20 Apr 2005 14:34:13 -0000
*************** load_register (int reg, expressionS *ep,
*** 3555,3563 ****
if (!dbl || HAVE_32BIT_GPRS)
{
! as_bad (_("Number (0x%lx%08lx) larger than 32 bits"),
! (unsigned long) (ep->X_add_number >> 32),
! (unsigned long) (ep->X_add_number & 0xffffffff));
macro_build (ep, "addiu", "t,r,j", reg, 0, BFD_RELOC_LO16);
return;
}
--- 3555,3564 ----
if (!dbl || HAVE_32BIT_GPRS)
{
! char value[32];
!
! sprintf_vma (value, ep->X_add_number);
! as_bad (_("Number (%s) larger than 32 bits"), value);
macro_build (ep, "addiu", "t,r,j", reg, 0, BFD_RELOC_LO16);
return;
}
*************** macro (struct mips_cl_insn *ip)
*** 5800,5808 ****
if (HAVE_32BIT_ADDRESSES
&& !IS_SEXT_32BIT_NUM (offset_expr.X_add_number))
! as_bad (_("Number (0x%lx%08lx) larger than 32 bits"),
! (unsigned long) (offset_expr.X_add_number >> 32),
! (unsigned long) (offset_expr.X_add_number & 0xffffffff));
/* A constant expression in PIC code can be handled just as it
is in non PIC code. */
--- 5801,5812 ----
if (HAVE_32BIT_ADDRESSES
&& !IS_SEXT_32BIT_NUM (offset_expr.X_add_number))
! {
! char value [32];
!
! sprintf_vma (value, offset_expr.X_add_number);
! as_bad (_("Number (%s) larger than 32 bits"), value);
! }
/* A constant expression in PIC code can be handled just as it
is in non PIC code. */
*************** macro (struct mips_cl_insn *ip)
*** 6391,6399 ****
if (HAVE_32BIT_ADDRESSES
&& !IS_SEXT_32BIT_NUM (offset_expr.X_add_number))
! as_bad (_("Number (0x%lx%08lx) larger than 32 bits"),
! (unsigned long) (offset_expr.X_add_number >> 32),
! (unsigned long) (offset_expr.X_add_number & 0xffffffff));
/* Even on a big endian machine $fn comes before $fn+1. We have
to adjust when loading from memory. We set coproc if we must
--- 6395,6406 ----
if (HAVE_32BIT_ADDRESSES
&& !IS_SEXT_32BIT_NUM (offset_expr.X_add_number))
! {
! char value [32];
!
! sprintf_vma (value, offset_expr.X_add_number);
! as_bad (_("Number (%s) larger than 32 bits"), value);
! }
/* Even on a big endian machine $fn comes before $fn+1. We have
to adjust when loading from memory. We set coproc if we must