This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Avoid signed/unsigned warnings in tc-arm.c
- From: Khem Raj <kraj at mvista dot com>
- To: Zack Weinberg <zack at codesourcery dot com>
- Cc: binutils at sourceware dot org
- Date: Thu, 23 Jun 2005 14:44:21 -0700
- Subject: Re: PATCH: Avoid signed/unsigned warnings in tc-arm.c
- References: <42BB119F.1040908@mvista.com> <42BB17EE.6000608@codesourcery.com>
Zack Weinberg wrote:
Khem Raj wrote:
Hi
This patch gets rid of few warnings in tc-arm.c while compiling gas with
gcc 4.0. The build was failing becasue warnings are treated as errors
while compiling this file
Is it ok?
No. Don't just blindly insert casts; change the types of variables/fields so
that they are consistent.
zw
OK. Here is revised patch based on Zack's comments. How about this one?
? diff
? doc/as.info
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gas/ChangeLog,v
retrieving revision 1.2578
diff -u -r1.2578 ChangeLog
--- ChangeLog 23 Jun 2005 11:40:28 -0000 1.2578
+++ ChangeLog 23 Jun 2005 21:41:11 -0000
@@ -1,3 +1,10 @@
+2005-06-23 Khem Raj <kraj@mvista.com>
+
+ * config/tc-arm.c (md_assemble):Avoid signed/unsigned argument
+ warnings.
+ (parse_operands):Likewise.
+ (parse_address):Likewise.
+
2005-06-23 Ben Elliston <bje@gnu.org>
* config/m68k-parse.h: Use ISO C90.
Index: config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.210
diff -u -r1.210 tc-arm.c
--- config/tc-arm.c 13 Jun 2005 15:34:37 -0000 1.210
+++ config/tc-arm.c 23 Jun 2005 21:41:11 -0000
@@ -225,8 +225,8 @@
struct
{
- unsigned reg;
- unsigned imm;
+ int reg;
+ int imm;
unsigned present : 1; /* operand present */
unsigned isreg : 1; /* operand was a register */
unsigned immisreg : 1; /* .imm field is a second register */
@@ -3567,7 +3567,7 @@
structure. Returns SUCCESS or FAIL depending on whether the
specified grammar matched. */
static int
-parse_operands (char *str, const char *pattern)
+parse_operands (char *str, unsigned const char *pattern)
{
unsigned const char *upat = pattern;
char *backtrack_pos = 0;
@@ -5015,7 +5015,7 @@
static void
do_shift (void)
{
- unsigned int Rm = (inst.operands[1].present
+ int Rm = (inst.operands[1].present
? inst.operands[1].reg
: inst.operands[0].reg);