This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] MIPS gas: better warning output
- From: Thiemo Seufer <ica2_ts at csv dot ica dot uni-stuttgart dot de>
- To: binutils at sources dot redhat dot com
- Date: Fri, 31 May 2002 02:38:32 +0200
- Subject: [PATCH] MIPS gas: better warning output
Hi All,
This enhances some warning messages about too large opcode arguments.
All these tests check for small positive numbers, so I check for
'unsigned long' values in order to catch negative numbers and to
provide better data than a needlessly truncated value in the message.
Thiemo
2002-05-31 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
/gas/ChangeLog
* config/tc-mips.c (mips_ip): Use unsigned long values for
warning output.
diff -BurpN source-orig/gas/config/tc-mips.c source/gas/config/tc-mips.c
--- source-orig/gas/config/tc-mips.c Fri May 31 01:49:55 2002
+++ source/gas/config/tc-mips.c Fri May 31 00:19:45 2002
@@ -8021,8 +8030,8 @@ mips_ip (str, ip)
check_absolute_expr (ip, &imm_expr);
if ((unsigned long) imm_expr.X_add_number > 31)
{
- as_warn (_("Improper shift amount (%ld)"),
- (long) imm_expr.X_add_number);
+ as_warn (_("Improper shift amount (%lu)"),
+ (unsigned long) imm_expr.X_add_number);
imm_expr.X_add_number &= OP_MASK_SHAMT;
}
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_SHAMT;
@@ -8063,10 +8072,10 @@ mips_ip (str, ip)
case 'c': /* break code */
my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr);
- if ((unsigned) imm_expr.X_add_number > 1023)
+ if ((unsigned long) imm_expr.X_add_number > 1023)
{
- as_warn (_("Illegal break code (%ld)"),
- (long) imm_expr.X_add_number);
+ as_warn (_("Illegal break code (%lu)"),
+ (unsigned long) imm_expr.X_add_number);
imm_expr.X_add_number &= OP_MASK_CODE;
}
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_CODE;
@@ -8077,10 +8086,10 @@ mips_ip (str, ip)
case 'q': /* lower break code */
my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr);
- if ((unsigned) imm_expr.X_add_number > 1023)
+ if ((unsigned long) imm_expr.X_add_number > 1023)
{
- as_warn (_("Illegal lower break code (%ld)"),
- (long) imm_expr.X_add_number);
+ as_warn (_("Illegal lower break code (%lu)"),
+ (unsigned long) imm_expr.X_add_number);
imm_expr.X_add_number &= OP_MASK_CODE2;
}
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_CODE2;
@@ -8091,9 +8100,9 @@ mips_ip (str, ip)
case 'B': /* 20-bit syscall/break code. */
my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr);
- if ((unsigned) imm_expr.X_add_number > OP_MASK_CODE20)
- as_warn (_("Illegal 20-bit code (%ld)"),
- (long) imm_expr.X_add_number);
+ if ((unsigned long) imm_expr.X_add_number > OP_MASK_CODE20)
+ as_warn (_("Illegal 20-bit code (%lu)"),
+ (unsigned long) imm_expr.X_add_number);
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_CODE20;
imm_expr.X_op = O_absent;
s = expr_end;
@@ -8104,8 +8113,8 @@ mips_ip (str, ip)
check_absolute_expr (ip, &imm_expr);
if ((unsigned long) imm_expr.X_add_number >= (1 << 25))
{
- as_warn (_("Coproccesor code > 25 bits (%ld)"),
- (long) imm_expr.X_add_number);
+ as_warn (_("Coproccesor code > 25 bits (%lu)"),
+ (unsigned long) imm_expr.X_add_number);
imm_expr.X_add_number &= ((1 << 25) - 1);
}
ip->insn_opcode |= imm_expr.X_add_number;
@@ -8116,9 +8125,9 @@ mips_ip (str, ip)
case 'J': /* 19-bit wait code. */
my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr);
- if ((unsigned) imm_expr.X_add_number > OP_MASK_CODE19)
- as_warn (_("Illegal 19-bit code (%ld)"),
- (long) imm_expr.X_add_number);
+ if ((unsigned long) imm_expr.X_add_number > OP_MASK_CODE19)
+ as_warn (_("Illegal 19-bit code (%lu)"),
+ (unsigned long) imm_expr.X_add_number);
ip->insn_opcode |= imm_expr.X_add_number << OP_SH_CODE19;
imm_expr.X_op = O_absent;
s = expr_end;
@@ -8129,8 +8138,8 @@ mips_ip (str, ip)
check_absolute_expr (ip, &imm_expr);
if (imm_expr.X_add_number != 0 && imm_expr.X_add_number != 1)
{
- as_warn (_("Invalid performance register (%ld)"),
- (long) imm_expr.X_add_number);
+ as_warn (_("Invalid performance register (%lu)"),
+ (unsigned long) imm_expr.X_add_number);
imm_expr.X_add_number &= OP_MASK_PERFREG;
}
ip->insn_opcode |= (imm_expr.X_add_number << OP_SH_PERFREG);