This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
egcs-19980608: MIPS warning patches
- To: egcs-patches at cygnus dot com
- Subject: egcs-19980608: MIPS warning patches
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Fri, 12 Jun 1998 10:21:28 -0400 (EDT)
- Cc: wilson at cygnus dot com
These are some warning fixes for the MIPS. Okay to install?
--Kaveh
Fri Jun 12 09:39:51 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* mips.c (small_int): Mark parameter `mode' with ATTRIBUTE_UNUSED.
(large_int): Likewise.
(pc_or_label_operand): Likewise.
(call_insn_operand): Likewise.
(consttable_operand): Likewise.
(m16_uimm3_b): Likewise.
(m16_simm4_1): Likewise.
(m16_nsimm4_1): Likewise.
(m16_simm5_1): Likewise.
(m16_nsimm5_1): Likewise.
(m16_uimm5_4): Likewise.
(m16_nuimm5_4): Likewise.
(m16_simm8_1): Likewise.
(m16_nsimm8_1): Likewise.
(m16_uimm8_1): Likewise.
(m16_nuimm8_1): Likewise.
(m16_uimm8_m1_1): Likewise.
(m16_uimm8_4): Likewise.
(m16_nuimm8_4): Likewise.
(m16_simm8_8): Likewise.
(m16_nsimm8_8): Likewise.
(m16_usym8_4): Likewise.
(m16_usym5_4): Likewise.
(mips_move_1word): Change type of variable `i' from int to size_t.
(mips_move_2words): Likewise.
(output_block_move): Mark parameter `libname' with ATTRIBUTE_UNUSED.
(function_arg_advance): Use HOST_PTR_PRINTF to print an address.
(function_arg): Likewise.
(function_arg_partial_nregs): Mark parameter `named' with
ATTRIBUTE_UNUSED.
(override_options): Use ISDIGIT instead of isdigit.
(mips_output_external): Mark parameter `file' with ATTRIBUTE_UNUSED.
(final_prescan_insn): Likewise for parameters `opvec' and `noperands'.
(save_restore_insns): Cast HOST_WIDE_INT arguments passed to
function `fatal' to long before printing. Use
HOST_WIDE_INT_PRINT_DEC in fprintf. Both changes done several
times in this function.
(function_prologue): Mark parameter `size' with ATTRIBUTE_UNUSED.
(function_epilogue): Likewise for parameters `file' and `size'.
Print an int with "%d" not "%ld".
(mips_select_rtx_section): Mark parameter `x' with ATTRIBUTE_UNUSED.
(mips_function_value): Likewise for parameter `func'.
(function_arg_pass_by_reference): Likewise for parameters `cum'
and `named'.
(extend_operator): Likewise for parameter `mode'
(highpart_shift_operator): Likewise.
* mips.md (mul_acc_si): Remove unused variable `macc'.
diff -rup orig/egcs-19980608/gcc/config/mips/mips.c egcs-19980608/gcc/config/mips/mips.c
--- orig/egcs-19980608/gcc/config/mips/mips.c Mon Jun 8 14:30:24 1998
+++ egcs-19980608/gcc/config/mips/mips.c Thu Jun 11 20:31:07 1998
@@ -473,7 +473,7 @@ arith32_operand (op, mode)
int
small_int (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return (GET_CODE (op) == CONST_INT && SMALL_INT (op));
}
@@ -484,7 +484,7 @@ small_int (op, mode)
int
large_int (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
HOST_WIDE_INT value;
@@ -927,7 +927,7 @@ cmp_op (op, mode)
int
pc_or_label_operand (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
if (op == pc_rtx)
return 1;
@@ -946,7 +946,7 @@ pc_or_label_operand (op, mode)
int
call_insn_operand (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return (CONSTANT_ADDRESS_P (op)
|| (GET_CODE (op) == REG && op != arg_pointer_rtx
@@ -1129,7 +1129,7 @@ se_nonimmediate_operand (op, mode)
int
consttable_operand (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return CONSTANT_P (op);
}
@@ -1191,7 +1191,7 @@ m16_check_op (op, low, high, mask)
int
m16_uimm3_b (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, 0x1, 0x8, 0);
}
@@ -1199,7 +1199,7 @@ m16_uimm3_b (op, mode)
int
m16_simm4_1 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, - 0x8, 0x7, 0);
}
@@ -1207,7 +1207,7 @@ m16_simm4_1 (op, mode)
int
m16_nsimm4_1 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, - 0x7, 0x8, 0);
}
@@ -1215,7 +1215,7 @@ m16_nsimm4_1 (op, mode)
int
m16_simm5_1 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, - 0x10, 0xf, 0);
}
@@ -1223,7 +1223,7 @@ m16_simm5_1 (op, mode)
int
m16_nsimm5_1 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, - 0xf, 0x10, 0);
}
@@ -1231,7 +1231,7 @@ m16_nsimm5_1 (op, mode)
int
m16_uimm5_4 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, (- 0x10) << 2, 0xf << 2, 3);
}
@@ -1239,7 +1239,7 @@ m16_uimm5_4 (op, mode)
int
m16_nuimm5_4 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, (- 0xf) << 2, 0x10 << 2, 3);
}
@@ -1247,7 +1247,7 @@ m16_nuimm5_4 (op, mode)
int
m16_simm8_1 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, - 0x80, 0x7f, 0);
}
@@ -1255,7 +1255,7 @@ m16_simm8_1 (op, mode)
int
m16_nsimm8_1 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, - 0x7f, 0x80, 0);
}
@@ -1263,7 +1263,7 @@ m16_nsimm8_1 (op, mode)
int
m16_uimm8_1 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, 0x0, 0xff, 0);
}
@@ -1271,7 +1271,7 @@ m16_uimm8_1 (op, mode)
int
m16_nuimm8_1 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, - 0xff, 0x0, 0);
}
@@ -1279,7 +1279,7 @@ m16_nuimm8_1 (op, mode)
int
m16_uimm8_m1_1 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, - 0x1, 0xfe, 0);
}
@@ -1287,7 +1287,7 @@ m16_uimm8_m1_1 (op, mode)
int
m16_uimm8_4 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, 0x0, 0xff << 2, 3);
}
@@ -1295,7 +1295,7 @@ m16_uimm8_4 (op, mode)
int
m16_nuimm8_4 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, (- 0xff) << 2, 0x0, 3);
}
@@ -1303,7 +1303,7 @@ m16_nuimm8_4 (op, mode)
int
m16_simm8_8 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, (- 0x80) << 3, 0x7f << 3, 7);
}
@@ -1311,7 +1311,7 @@ m16_simm8_8 (op, mode)
int
m16_nsimm8_8 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
return m16_check_op (op, (- 0x7f) << 3, 0x80 << 3, 7);
}
@@ -1325,7 +1325,7 @@ m16_nsimm8_8 (op, mode)
int
m16_usym8_4 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
if (GET_CODE (op) == SYMBOL_REF
&& SYMBOL_REF_FLAG (op)
@@ -1352,7 +1352,7 @@ m16_usym8_4 (op, mode)
int
m16_usym5_4 (op, mode)
rtx op;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
if (GET_CODE (op) == SYMBOL_REF
&& SYMBOL_REF_FLAG (op)
@@ -1764,7 +1764,7 @@ mips_move_1word (operands, insn, unsigne
if (ret != (char *)0 && MEM_VOLATILE_P (op1))
{
- int i = strlen (ret);
+ size_t i = strlen (ret);
if (i > sizeof (volatile_buffer) - sizeof ("%{%}"))
abort ();
@@ -1988,7 +1988,7 @@ mips_move_1word (operands, insn, unsigne
if (ret != 0 && MEM_VOLATILE_P (op0))
{
- int i = strlen (ret);
+ size_t i = strlen (ret);
if (i > sizeof (volatile_buffer) - sizeof ("%{%}"))
abort ();
@@ -2321,7 +2321,7 @@ mips_move_2words (operands, insn)
if (ret != 0 && MEM_VOLATILE_P (op1))
{
- int i = strlen (ret);
+ size_t i = strlen (ret);
if (i > sizeof (volatile_buffer) - sizeof ("%{%}"))
abort ();
@@ -2432,7 +2432,7 @@ mips_move_2words (operands, insn)
if (ret != 0 && MEM_VOLATILE_P (op0))
{
- int i = strlen (ret);
+ size_t i = strlen (ret);
if (i > sizeof (volatile_buffer) - sizeof ("%{%}"))
abort ();
@@ -3535,9 +3535,9 @@ output_block_move (insn, operands, num_r
void
init_cumulative_args (cum, fntype, libname)
- CUMULATIVE_ARGS *cum; /* argument info to initialize */
- tree fntype; /* tree ptr for function decl */
- rtx libname; /* SYMBOL_REF of library name or 0 */
+ CUMULATIVE_ARGS *cum; /* argument info to initialize */
+ tree fntype; /* tree ptr for function decl */
+ rtx libname ATTRIBUTE_UNUSED; /* SYMBOL_REF of library name or 0 */
{
static CUMULATIVE_ARGS zero_cum;
tree param, next_param;
@@ -3585,10 +3585,14 @@ function_arg_advance (cum, mode, type, n
int named; /* whether or not the argument was named */
{
if (TARGET_DEBUG_E_MODE)
- fprintf (stderr,
- "function_adv({gp reg found = %d, arg # = %2d, words = %2d}, %4s, 0x%.8x, %d )\n\n",
- cum->gp_reg_found, cum->arg_number, cum->arg_words,
- GET_MODE_NAME (mode), type, named);
+ {
+ fprintf (stderr,
+ "function_adv({gp reg found = %d, arg # = %2d, words = %2d}, %4s, ",
+ cum->gp_reg_found, cum->arg_number, cum->arg_words,
+ GET_MODE_NAME (mode));
+ fprintf (stderr, HOST_PTR_PRINTF, type);
+ fprintf (stderr, ", %d )\n\n", named);
+ }
cum->arg_number++;
switch (mode)
@@ -3664,10 +3668,15 @@ function_arg (cum, mode, type, named)
|| TREE_CODE (type) == QUAL_UNION_TYPE));
if (TARGET_DEBUG_E_MODE)
- fprintf (stderr,
- "function_arg( {gp reg found = %d, arg # = %2d, words = %2d}, %4s, 0x%.8x, %d ) = ",
- cum->gp_reg_found, cum->arg_number, cum->arg_words,
- GET_MODE_NAME (mode), type, named);
+ {
+ fprintf (stderr,
+ "function_arg( {gp reg found = %d, arg # = %2d, words = %2d}, %4s, ",
+ cum->gp_reg_found, cum->arg_number, cum->arg_words,
+ GET_MODE_NAME (mode));
+ fprintf (stderr, HOST_PTR_PRINTF, type);
+ fprintf (stderr, ", %d ) = ", named);
+ }
+
cum->last_arg_fp = 0;
switch (mode)
@@ -3899,7 +3908,7 @@ function_arg_partial_nregs (cum, mode, t
CUMULATIVE_ARGS *cum; /* current arg information */
enum machine_mode mode; /* current arg mode */
tree type; /* type of the argument or 0 if lib support */
- int named; /* != 0 for normal args, == 0 for ... args */
+ int named ATTRIBUTE_UNUSED;/* != 0 for normal args, == 0 for ... args */
{
if ((mode == BLKmode
|| GET_MODE_CLASS (mode) != MODE_COMPLEX_INT
@@ -3992,7 +4001,7 @@ override_options ()
if (mips_isa_string == 0)
mips_isa = MIPS_ISA_DEFAULT;
- else if (isdigit (*mips_isa_string))
+ else if (ISDIGIT (*mips_isa_string))
{
mips_isa = atoi (mips_isa_string);
if (mips_isa == 16)
@@ -4954,7 +4963,7 @@ print_operand_address (file, addr)
int
mips_output_external (file, decl, name)
- FILE *file;
+ FILE *file ATTRIBUTE_UNUSED;
tree decl;
char *name;
{
@@ -5166,8 +5175,8 @@ mips_output_lineno (stream, line)
void
final_prescan_insn (insn, opvec, noperands)
rtx insn;
- rtx opvec[];
- int noperands;
+ rtx opvec[] ATTRIBUTE_UNUSED;
+ int noperands ATTRIBUTE_UNUSED;
{
if (dslots_number_nops > 0)
{
@@ -5664,7 +5673,7 @@ save_restore_insns (store_p, large_reg,
if (gp_offset < 0 || end_offset < 0)
fatal ("gp_offset (%ld) or end_offset (%ld) is less than zero.",
- gp_offset, end_offset);
+ (long) gp_offset, (long) end_offset);
/* If we see a large frame in mips16 mode, we save the registers
before adjusting the stack pointer, and load them afterward. */
@@ -5742,13 +5751,16 @@ save_restore_insns (store_p, large_reg,
RTX_FRAME_RELATED_P (insn) = 1;
}
else
- fprintf (file, "\tli\t%s,0x%.08lx\t# %ld\n\t%s\t%s,%s,%s\n",
- reg_names[MIPS_TEMP2_REGNUM],
- base_offset, base_offset,
- Pmode == DImode ? "daddu" : "addu",
- reg_names[MIPS_TEMP2_REGNUM],
- reg_names[MIPS_TEMP2_REGNUM],
- reg_names[STACK_POINTER_REGNUM]);
+ {
+ fprintf (file, "\tli\t%s,0x%.08lx\t# ",
+ reg_names[MIPS_TEMP2_REGNUM], base_offset);
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC, base_offset);
+ fprintf (file, "\n\t%s\t%s,%s,%s\n",
+ Pmode == DImode ? "daddu" : "addu",
+ reg_names[MIPS_TEMP2_REGNUM],
+ reg_names[MIPS_TEMP2_REGNUM],
+ reg_names[STACK_POINTER_REGNUM]);
+ }
}
/* When we restore the registers in MIPS16 mode, then if we are
@@ -5841,13 +5853,14 @@ save_restore_insns (store_p, large_reg,
reg_names[r], reg_names[regno]);
}
}
- fprintf (file, "\t%s\t%s,%ld(%s)\n",
+ fprintf (file, "\t%s\t%s,",
(TARGET_64BIT
? (store_p) ? "sd" : "ld"
: (store_p) ? "sw" : "lw"),
- reg_names[r],
- gp_offset - base_offset,
- reg_names[REGNO(base_reg_rtx)]);
+ reg_names[r]);
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC,
+ gp_offset - base_offset);
+ fprintf (file, "(%s)\n", reg_names[REGNO(base_reg_rtx)]);
if (! store_p
&& TARGET_MIPS16
&& regno != GP_REG_FIRST + 31
@@ -5875,7 +5888,7 @@ save_restore_insns (store_p, large_reg,
if (fp_offset < 0 || end_offset < 0)
fatal ("fp_offset (%ld) or end_offset (%ld) is less than zero.",
- fp_offset, end_offset);
+ (long) fp_offset, (long) end_offset);
else if (fp_offset < 32768)
base_reg_rtx = stack_pointer_rtx, base_offset = 0;
@@ -5955,13 +5968,16 @@ save_restore_insns (store_p, large_reg,
RTX_FRAME_RELATED_P (insn) = 1;
}
else
- fprintf (file, "\tli\t%s,0x%.08lx\t# %ld\n\t%s\t%s,%s,%s\n",
- reg_names[MIPS_TEMP2_REGNUM],
- base_offset, base_offset,
- Pmode == DImode ? "daddu" : "addu",
- reg_names[MIPS_TEMP2_REGNUM],
- reg_names[MIPS_TEMP2_REGNUM],
- reg_names[STACK_POINTER_REGNUM]);
+ {
+ fprintf (file, "\tli\t%s,0x%.08lx\t# ",
+ reg_names[MIPS_TEMP2_REGNUM], base_offset);
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC, base_offset);
+ fprintf (file, "\n\t%s\t%s,%s,%s\n",
+ Pmode == DImode ? "daddu" : "addu",
+ reg_names[MIPS_TEMP2_REGNUM],
+ reg_names[MIPS_TEMP2_REGNUM],
+ reg_names[STACK_POINTER_REGNUM]);
+ }
}
for (regno = FP_REG_LAST-1; regno >= FP_REG_FIRST; regno -= fp_inc)
@@ -5987,13 +6003,16 @@ save_restore_insns (store_p, large_reg,
emit_move_insn (reg_rtx, mem_rtx);
}
else
- fprintf (file, "\t%s\t%s,%ld(%s)\n",
- (TARGET_SINGLE_FLOAT
- ? (store_p ? "s.s" : "l.s")
- : (store_p ? "s.d" : "l.d")),
- reg_names[regno],
- fp_offset - base_offset,
- reg_names[REGNO(base_reg_rtx)]);
+ {
+ fprintf (file, "\t%s\t%s,",
+ (TARGET_SINGLE_FLOAT
+ ? (store_p ? "s.s" : "l.s")
+ : (store_p ? "s.d" : "l.d")),
+ reg_names[regno]);
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC,
+ fp_offset - base_offset);
+ fprintf (file, "(%s)\n", reg_names[REGNO(base_reg_rtx)]);
+ }
fp_offset -= fp_size;
}
@@ -6005,7 +6024,7 @@ save_restore_insns (store_p, large_reg,
void
function_prologue (file, size)
FILE *file;
- int size;
+ int size ATTRIBUTE_UNUSED;
{
#ifndef FUNCTION_NAME_ALREADY_DECLARED
char *fnname;
@@ -6562,8 +6581,8 @@ mips_expand_prologue ()
void
function_epilogue (file, size)
- FILE *file;
- HOST_WIDE_INT size;
+ FILE *file ATTRIBUTE_UNUSED;
+ HOST_WIDE_INT size ATTRIBUTE_UNUSED;
{
char *fnname;
@@ -6594,7 +6613,7 @@ function_epilogue (file, size)
dslots_load_total += num_regs;
fprintf (stderr,
- "%-20s fp=%c leaf=%c alloca=%c setjmp=%c stack=%4ld arg=%3ld reg=%2d/%d delay=%3d/%3dL %3d/%3dJ refs=%3d/%3d/%3d",
+ "%-20s fp=%c leaf=%c alloca=%c setjmp=%c stack=%4ld arg=%3d reg=%2d/%d delay=%3d/%3dL %3d/%3dJ refs=%3d/%3d/%3d",
name, frame_pointer_needed ? 'y' : 'n',
(current_frame_info.mask & RA_MASK) != 0 ? 'n' : 'y',
current_function_calls_alloca ? 'y' : 'n',
@@ -6796,7 +6815,7 @@ mips_can_use_return_insn ()
void
mips_select_rtx_section (mode, x)
enum machine_mode mode;
- rtx x;
+ rtx x ATTRIBUTE_UNUSED;
{
if (TARGET_MIPS16)
{
@@ -6896,7 +6915,7 @@ mips_select_section (decl, reloc)
rtx
mips_function_value (valtype, func)
tree valtype;
- tree func;
+ tree func ATTRIBUTE_UNUSED;
{
int reg = GP_RETURN;
enum machine_mode mode = TYPE_MODE (valtype);
@@ -6991,10 +7010,10 @@ mips_function_value (valtype, func)
int
function_arg_pass_by_reference (cum, mode, type, named)
- CUMULATIVE_ARGS *cum;
+ CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED;
enum machine_mode mode;
tree type;
- int named;
+ int named ATTRIBUTE_UNUSED;
{
int size;
@@ -8387,7 +8406,7 @@ machine_dependent_reorg (first)
int
extend_operator (x, mode)
rtx x;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
enum rtx_code code = GET_CODE (x);
return code == SIGN_EXTEND || code == ZERO_EXTEND;
@@ -8400,7 +8419,7 @@ extend_operator (x, mode)
int
highpart_shift_operator (x, mode)
rtx x;
- enum machine_mode mode;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
{
enum rtx_code code = GET_CODE (x);
return (code == LSHIFTRT
diff -rup orig/egcs-19980608/gcc/config/mips/mips.md egcs-19980608/gcc/config/mips/mips.md
--- orig/egcs-19980608/gcc/config/mips/mips.md Mon Jun 8 14:30:25 1998
+++ egcs-19980608/gcc/config/mips/mips.md Thu Jun 11 19:33:44 1998
@@ -1728,7 +1728,6 @@
"*
{
static char *const madd[] = { \"madd\\t%1,%2\", \"madd\\t%0,%1,%2\" };
- static char *const macc[] = { \"macc\\t$0,%1,%2\", \"macc\\t%0,%1,%2\" };
if (which_alternative == 2)
return \"#\";
return madd[which_alternative];