This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH/RFA] Avoid warnings in compiling config/sh/sh.c


The appended patch is simply to get rid of some warnings in compiling
config/sh/sh.c:

stage1/xgcc -Bstage1/ -B/usr/gnu/sh4-unknown-linux-gnu/bin/ -c   -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition -Werror    -DHAVE_CONFIG_H    -I. -I. -I../../TMP/gcc/gcc -I../../TMP/gcc/gcc/. -I../../TMP/gcc/gcc/../include -I../../TMP/gcc/gcc/../libcpp/include  \
        ../../TMP/gcc/gcc/config/sh/sh.c -o sh.o
cc1: warnings being treated as errors
../../TMP/gcc/gcc/config/sh/sh.c: In function 'calc_live_regs':
../../TMP/gcc/gcc/config/sh/sh.c:5173: warning: comparison between signed and unsigned
../../TMP/gcc/gcc/config/sh/sh.c: In function 'sh_expand_prologue':
../../TMP/gcc/gcc/config/sh/sh.c:5695: warning: comparison between signed and unsigned
../../TMP/gcc/gcc/config/sh/sh.c: In function 'sh_gimplify_va_arg_expr':
../../TMP/gcc/gcc/config/sh/sh.c:6415: warning: 'lab_over' may be used uninitialized in this function
[../../TMP/gcc/gcc/config/sh/sh.c: In function 'sh_handle_sp_switch_attribute':
../../TMP/gcc/gcc/config/sh/sh.c:7195: warning: initialization discards qualifiers from pointer target type

This and the patch
  http://gcc.gnu.org/ml/gcc-patches/2004-10/msg02245.html 
enable bootstrapping without --desable-werror on sh4-unknown-linux-gnu
and there are no new regressions.  OK for mainline?

Regards,
	kaz
--
2004-10-26  Kaz Kojima  <kkojima@gcc.gnu.org>

	* config/sh/sh.c (calc_live_regs): Add cast appropriately.
	(sh_expand_prologue): Likewise.
	(sh_gimplify_va_arg_expr): Initinalize lab_over.
	(sh_handle_sp_switch_attribute): Add const qualifier appropriately.

diff -uprN ORIG/gcc/gcc/config/sh/sh.c TMP/gcc/gcc/config/sh/sh.c
--- ORIG/gcc/gcc/config/sh/sh.c	2004-10-25 16:59:25.000000000 +0900
+++ TMP/gcc/gcc/config/sh/sh.c	2004-10-26 18:32:30.000000000 +0900
@@ -5166,7 +5170,7 @@ calc_live_regs (HARD_REG_SET *live_regs_
 	     (regs_ever_live[reg]
 	      || (call_really_used_regs[reg]
 		  && (! fixed_regs[reg] || reg == MACH_REG || reg == MACL_REG
-		      || reg == PIC_OFFSET_TABLE_REGNUM)
+		      || reg == (int) PIC_OFFSET_TABLE_REGNUM)
 		  && has_call)
 	      || (has_call && REGISTER_NATURAL_MODE (reg) == SImode
 		  && (GENERAL_REGISTER_P (reg) || TARGET_REGISTER_P (reg))))
@@ -5688,7 +5692,7 @@ sh_expand_prologue (void)
 	       have a different natural size than the to-be-saved register.
 	       Thus, we gloss over the intermediate copy and pretend we do
 	       a direct save from the to-be-saved register.  */
-	    if (REGNO (reg_rtx) != reg)
+	    if (REGNO (reg_rtx) != (unsigned) reg)
 	      {
 		rtx set, note_rtx;
 
@@ -6408,7 +6412,7 @@ sh_gimplify_va_arg_expr (tree valist, tr
 {
   HOST_WIDE_INT size, rsize;
   tree tmp, pptr_type_node;
-  tree addr, lab_over, result = NULL;
+  tree addr, lab_over = NULL, result = NULL;
   int pass_by_ref = targetm.calls.must_pass_in_stack (TYPE_MODE (type), type);
 
   if (pass_by_ref)
@@ -7188,7 +7192,7 @@ sh_handle_sp_switch_attribute (tree *nod
     }
   else
     {
-      char *s = ggc_strdup (TREE_STRING_POINTER (TREE_VALUE (args)));
+      const char *s = ggc_strdup (TREE_STRING_POINTER (TREE_VALUE (args)));
       sp_switch = gen_rtx_SYMBOL_REF (VOIDmode, s);
     }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]