[PATCH] SH: Fix compile time warnings

Kaz Kojima kkojima@rr.iij4u.or.jp
Thu May 12 14:03:00 GMT 2005


Hi,

Mainline fails to bootstrap for sh4-unknown-linux-gnu because of
a few warnings in compiling sh.c.

../../LOCAL/gcc/gcc/config/sh/sh.c:269: warning: 'sh_adjust_unroll_max' declared 'static' but never defined
../../LOCAL/gcc/gcc/config/sh/sh.c:7557:27: error: C++ style comments are not allowed in ISO C90
../../LOCAL/gcc/gcc/config/sh/sh.c:7557:27: error: (this will be reported only once per input file)
cc1: warnings being treated as errors
../../LOCAL/gcc/gcc/config/sh/sh.c: In function 'ua_offset':
../../LOCAL/gcc/gcc/config/sh/sh.c:8772: warning: old-style function definition

I've accidentally set --disable-werror when testing sh-elf-4_1 branch
and missed these warnings.  The patch below fixes it.  Ok for mainline?

Regards,
	kaz
--
2005-05-12  Kaz Kojima  <kkojima@gcc.gnu.org>

	* config/sh/sh.c: Declare the prototype of sh_adjust_unroll_max
	only when TARGET_ADJUST_UNROLL_MAX is defined.
	(general_movsrc_operand): Use the C style comment.
	(ua_offset): Use prototype.

diff -uprN ORIG/gcc/gcc/config/sh/sh.c LOCAL/gcc/gcc/config/sh/sh.c
--- ORIG/gcc/gcc/config/sh/sh.c	2005-05-11 07:03:24.000000000 +0900
+++ LOCAL/gcc/gcc/config/sh/sh.c	2005-05-12 07:51:59.496444648 +0900
@@ -266,7 +266,9 @@ static bool unspec_caller_rtx_p (rtx);
 static bool sh_cannot_copy_insn_p (rtx);
 static bool sh_rtx_costs (rtx, int, int, int *);
 static int sh_address_cost (rtx);
+#ifdef TARGET_ADJUST_UNROLL_MAX
 static int sh_adjust_unroll_max (struct loop *, int, int, int, int);
+#endif
 static int shmedia_target_regs_stack_space (HARD_REG_SET *);
 static int shmedia_reserve_space_for_target_registers_p (int, HARD_REG_SET *);
 static int shmedia_target_regs_stack_adjust (HARD_REG_SET *);
@@ -7554,7 +7556,7 @@ general_movsrc_operand (rtx op, enum mac
   if (TARGET_SHMEDIA && 1
       && GET_CODE (op) == SUBREG && GET_MODE (op) == mode
       && SUBREG_REG (op) == const0_rtx && subreg_lowpart_p (op))
-    /* FIXME */ abort (); // return 1;
+    /* FIXME */ abort (); /* return 1; */
   return general_operand (op, mode);
 }
 
@@ -8766,9 +8768,7 @@ mark_constant_pool_use (rtx x)
 }
 
 int
-ua_offset (c, mode)
-     rtx c;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+ua_offset (rtx c, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   return GET_CODE (c) == CONST_INT && CONST_OK_FOR_I06 (INTVAL (c));
 }



More information about the Gcc-patches mailing list