This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: cast constants to Valtype
- From: csilvers at google dot com (Craig Silverstein)
- To: binutils at sourceware dot org
- Date: Wed, 18 Jun 2008 15:32:52 -0700 (PDT)
- Subject: PATCH: cast constants to Valtype
I've just committed this patch, which quiets a warning in gcc 4.2.2
(possibly only with certain warning flags?):
powerpc.cc:631: warning: overflow in implicit constant conversion
craig
--cut here--
2008-06-18 Craig Silverstein <csilvers@google.com>
* powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
constant 0xFFFF to type Valtype.
(Powerpc_relocate_functions::rel16_ha): Likewise.
Index: powerpc.cc
===================================================================
RCS file: /cvs/src/src/gold/powerpc.cc,v
retrieving revision 1.2
diff -u -r1.2 powerpc.cc
--- powerpc.cc 13 Jun 2008 17:15:52 -0000 1.2
+++ powerpc.cc 18 Jun 2008 22:30:36 -0000
@@ -605,8 +605,8 @@
reloc += 0x10000;
reloc >>= 16;
- val &= ~0xffff;
- reloc &= 0xffff;
+ val &= ~static_cast<Valtype>(0xffff);
+ reloc &= static_cast<Valtype>(0xffff);
elfcpp::Swap<16, true>::writeval(wv, val | reloc);
}
@@ -628,8 +628,8 @@
reloc += 0x10000;
reloc >>= 16;
- val &= ~0xffff;
- reloc &= 0xffff;
+ val &= ~static_cast<Valtype>(0xffff);
+ reloc &= static_cast<Valtype>(0xffff);
elfcpp::Swap<16, true>::writeval(wv, val | reloc);
}
@@ -684,8 +684,8 @@
reloc += 0x10000;
reloc >>= 16;
- val &= ~0xffff;
- reloc &= 0xffff;
+ val &= ~static_cast<Valtype>(0xffff);
+ reloc &= static_cast<Valtype>(0xffff);
elfcpp::Swap<16, true>::writeval(wv, val | reloc);
}