diff mbox

RFA: Fix picochip --enable-werror-always build

Message ID 20101105142713.bgkd560u848k88kg-nzlynne@webmail.spamcop.net
State New
Headers show

Commit Message

Joern Rennecke Nov. 5, 2010, 6:27 p.m. UTC
http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00559.html fixes warnings
due to the frontends using ASM_GENERATE_INTERNAL_LABEL, while
this patch fixes the rest for i686-pc-linux-gnu X picochip-elf .
2010-11-05  Joern Rennecke  <amylaar@spamcop.net>

	PR target/44755
	* config.gcc (picochip-*): Add t-pnt16-warn to tmake_file.
	* config/t-pnt16-warn: New file.
	* config/picochip/picochip.c (picochip_emit_stack_allocate):
	Use add_reg_note.
	(picochip_emit_save_register): Likewise.
	(picochip_emit_restore_register): Remove variable insn.
	(picochip_legitimize_address): Don't use C++ style comments.
	(picochip_legitimize_reload_address): Likewise.
	(reorder_var_tracking_notes): Remove variable vliw_start.
	(picochip_reorg): Cast first arguemnt to emit_note_after to
	enum insn_note.
	(picochip_expand_builtin_2op): Use EXPAND_NORMAL.
	(picochip_expand_builtin_3op): Likewise.
	(picochip_expand_builtin_2opvoid): Likewise.
	(picochip_expand_array_get, picochip_expand_array_put): Likewise.
	(picochip_expand_array_testport): Likewise.
	(picochip_init_builtins): Remove unused variables.
	* config/picochip/picochip.h (ASM_FORMAT_PRIVATE_NAME): Cast LABELNO
	to unsigned long, and output it as such.
	(ASM_OUTPUT_SKIP): Use HOST_WIDE_INT_PRINT_UNSIGNED.
	* config/picochip/picochip.md (movhicc): Remove nonsense statement.
	(schedType): Cast result of picochip_schedule_type to
	enum attr_schedType.

Comments

Hariharan Sandanagobalane Nov. 9, 2010, 4:52 p.m. UTC | #1
This all looks sensible. One minor change to config.gcc please.

-tmake_file="${tmake_file} t-pnt16-warn"
+tmake_file="picochip/t-picochip t-pnt16-warn"

Cheers
Hari

On 05/11/10 18:27, Joern Rennecke wrote:
> http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00559.html fixes warnings
> due to the frontends using ASM_GENERATE_INTERNAL_LABEL, while
> this patch fixes the rest for i686-pc-linux-gnu X picochip-elf .
diff mbox

Patch

Index: config.gcc
===================================================================
--- config.gcc	(revision 166360)
+++ config.gcc	(working copy)
@@ -1979,6 +1979,7 @@  pdp11-*-*)
 picochip-*)
 	tm_file="${tm_file} newlib-stdint.h"
 	use_gcc_stdint=wrap
+	tmake_file="${tmake_file} t-pnt16-warn"
         ;;
 # port not yet contributed
 #powerpc-*-openbsd*)
Index: config/t-pnt16-warn
===================================================================
--- config/t-pnt16-warn	(revision 0)
+++ config/t-pnt16-warn	(revision 0)
@@ -0,0 +1,31 @@ 
+# -Werror overrides for targets with 16 bit pointers
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+
+# Because POINTER_SIZE is only 16, in dwarf2out.c,
+# DWARF_ARANGES_PAD_SIZE is 0, thus a loop in output_aranges that checks
+# (i < (unsigned) DWARF_ARANGES_PAD_SIZE) elicits a warning that the
+# comparison is always false.
+# We could say "-Werror -Wno-error=type-limits", alas, not all supported
+# gcc bootstrap compilers support the latter option.
+dwarf2out.o-warn = -Wno-error
+
+# Likewise, java/constants.c:build_constants_constructor has a negative shift
+# count (in never-executed code) due to the small POINTER_SIZE.
+java/constants.o-warn = -Wno-error
Index: config/picochip/picochip.c
===================================================================
--- config/picochip/picochip.c	(revision 166360)
+++ config/picochip/picochip.c	(working copy)
@@ -685,12 +685,10 @@  picochip_emit_stack_allocate (int adjust
      so that the correct Dwarf information is generated (see documention
      for RTX_FRAME_RELATED_P for more details). */
   RTX_FRAME_RELATED_P (insn) = 1;
-  REG_NOTES (insn) =
-    gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
-		       gen_rtx_SET (VOIDmode, stack_pointer_reg,
-				    gen_rtx_PLUS (Pmode, stack_pointer_reg,
-						  GEN_INT (-adjustment))),
-		       REG_NOTES (insn));
+  add_reg_note (insn, REG_FRAME_RELATED_EXPR,
+		gen_rtx_SET (VOIDmode, stack_pointer_reg,
+			     gen_rtx_PLUS (Pmode, stack_pointer_reg,
+					   GEN_INT (-adjustment))));
 
 }
 
@@ -743,10 +741,8 @@  picochip_emit_save_register (rtx reg, in
 		       gen_rtx_REG (HImode, REGNO (reg) + 1));
 	RTX_FRAME_RELATED_P (RTVEC_ELT (p, 1)) = 1;
 
-	REG_NOTES (insn) =
-	  gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
-			     gen_rtx_PARALLEL (VOIDmode, p),
-			     REG_NOTES (insn));
+	add_reg_note (insn, REG_FRAME_RELATED_EXPR,
+		      gen_rtx_PARALLEL (VOIDmode, p));
 
       }
       break;
@@ -765,7 +761,7 @@  picochip_emit_save_register (rtx reg, in
 static void
 picochip_emit_restore_register (rtx reg, int offset)
 {
-  rtx stack_pointer, address, mem, insn;
+  rtx stack_pointer, address, mem;
 
   stack_pointer = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM);
 
@@ -773,7 +769,7 @@  picochip_emit_restore_register (rtx reg,
 
   mem = gen_rtx_MEM (GET_MODE (reg), address);
 
-  insn = emit_move_insn (reg, mem);
+  emit_move_insn (reg, mem);
 
 }
 
@@ -1477,7 +1473,7 @@  picochip_legitimize_address (rtx x, rtx 
     {
       int high_val, low_val, offset;
       offset = INTVAL (XEXP (x, 1));
-      // Ignore cases with negative offsets.
+      /* Ignore cases with negative offsets.  */
       if (offset < 0)
         return x;
       high_val = offset & mask_val;
@@ -1534,7 +1530,7 @@  picochip_legitimize_reload_address (rtx 
       return 1;
     }
 
-  // Depending on mode, the offsets allowed are either 16/32/64.
+  /* Depending on mode, the offsets allowed are either 16/32/64.  */
   switch (mode)
     {
       case QImode:
@@ -1556,7 +1552,7 @@  picochip_legitimize_reload_address (rtx 
     {
       int high_val, low_val, offset;
       offset = INTVAL (XEXP (*x, 1));
-      // Ignore cases with negative offsets.
+      /* Ignore cases with negative offsets.  */
       if (offset < 0)
         return 0;
       high_val = offset & mask_val;
@@ -3196,7 +3192,6 @@  reorder_var_tracking_notes (void)
   FOR_EACH_BB (bb)
     {
       rtx insn, next, last_insn = NULL_RTX;
-      rtx vliw_start = NULL_RTX;
       rtx queue = NULL_RTX;
 
       /* Iterate through the bb and find the last non-debug insn */
@@ -3362,7 +3357,9 @@  picochip_reorg (void)
 
       if (last_insn_in_packet != NULL)
 	{
-          rtx tmp_note = emit_note_after (NOTE_KIND(prologue_end_note), last_insn_in_packet);
+          rtx tmp_note
+	    = emit_note_after ((enum insn_note) NOTE_KIND (prologue_end_note),
+			       last_insn_in_packet);
           memcpy(&NOTE_DATA (tmp_note), &NOTE_DATA(prologue_end_note), sizeof(NOTE_DATA(prologue_end_note)));
 	  delete_insn (prologue_end_note);
 	}
@@ -3937,7 +3934,7 @@  picochip_expand_builtin_2op (enum insn_c
 
   /* Grab the incoming argument and emit its RTL. */
   arg0 = CALL_EXPR_ARG (call, 0);
-  op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
+  op0 = expand_expr (arg0, NULL_RTX, VOIDmode, EXPAND_NORMAL);
 
   /* Determine the modes of the instruction operands. */
   tmode = insn_data[icode].operand[0].mode;
@@ -3978,8 +3975,8 @@  picochip_expand_builtin_3op (enum insn_c
   arg1 = CALL_EXPR_ARG (call, 1);
 
   /* Emit rtl sequences for the function arguments. */
-  op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
-  op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
+  op0 = expand_expr (arg0, NULL_RTX, VOIDmode, EXPAND_NORMAL);
+  op1 = expand_expr (arg1, NULL_RTX, VOIDmode, EXPAND_NORMAL);
 
   /* Get the mode's of each of the instruction operands. */
   tmode = insn_data[icode].operand[0].mode;
@@ -4022,8 +4019,8 @@  picochip_expand_builtin_2opvoid (enum in
   arg1 = CALL_EXPR_ARG (call, 1);
 
   /* Emit rtl sequences for the function arguments. */
-  op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
-  op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
+  op0 = expand_expr (arg0, NULL_RTX, VOIDmode, EXPAND_NORMAL);
+  op1 = expand_expr (arg1, NULL_RTX, VOIDmode, EXPAND_NORMAL);
 
   /* Get the mode's of each of the instruction operands. */
   mode0 = insn_data[icode].operand[0].mode;
@@ -4059,9 +4056,9 @@  picochip_expand_array_get (tree call, rt
   arg2 = CALL_EXPR_ARG (call, 2) ;
 
   /* Emit rtl sequences for the function arguments. */
-  op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
-  op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
-  op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
+  op0 = expand_expr (arg0, NULL_RTX, VOIDmode, EXPAND_NORMAL);
+  op1 = expand_expr (arg1, NULL_RTX, VOIDmode, EXPAND_NORMAL);
+  op2 = expand_expr (arg2, NULL_RTX, VOIDmode, EXPAND_NORMAL);
 
   /* The second and third operands must be constant.  Nothing else will
      do. */
@@ -4104,10 +4101,10 @@  picochip_expand_array_put (tree call, rt
   arg3 = CALL_EXPR_ARG (call, 3);
 
   /* Emit rtl sequences for the function arguments. */
-  op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
-  op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
-  op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
-  op3 = expand_expr (arg3, NULL_RTX, VOIDmode, 0);
+  op0 = expand_expr (arg0, NULL_RTX, VOIDmode, EXPAND_NORMAL);
+  op1 = expand_expr (arg1, NULL_RTX, VOIDmode, EXPAND_NORMAL);
+  op2 = expand_expr (arg2, NULL_RTX, VOIDmode, EXPAND_NORMAL);
+  op3 = expand_expr (arg3, NULL_RTX, VOIDmode, EXPAND_NORMAL);
 
   /* The first operand must be an SImode register. */
   if (GET_MODE (op0) != SImode || REG != GET_CODE (op0))
@@ -4147,9 +4144,9 @@  picochip_expand_array_testport (tree cal
   arg2 = CALL_EXPR_ARG (call, 2);
 
   /* Emit rtl sequences for the function arguments. */
-  op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
-  op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
-  op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
+  op0 = expand_expr (arg0, NULL_RTX, VOIDmode, EXPAND_NORMAL);
+  op1 = expand_expr (arg1, NULL_RTX, VOIDmode, EXPAND_NORMAL);
+  op2 = expand_expr (arg2, NULL_RTX, VOIDmode, EXPAND_NORMAL);
 
   /* The first operand must be a HImode register, or a constant.  If it
      isn't, force it into a HImode register. */
@@ -4224,30 +4221,18 @@  picochip_init_builtins (void)
     tree_cons (NULL_TREE, integer_type_node, int_int_endlink);
   tree int_long_endlink =
     tree_cons (NULL_TREE, integer_type_node, long_endlink);
-  tree pchar_type_node = build_pointer_type (char_type_node);
   tree long_int_int_int_endlink =
     tree_cons (NULL_TREE, long_integer_type_node, int_int_int_endlink);
 
-  tree int_ftype_void, int_ftype_int, int_ftype_int_int, void_ftype_pchar;
-  tree long_ftype_int, long_ftype_int_int, long_ftype_int_int_int;
+  tree int_ftype_int, int_ftype_int_int;
+  tree long_ftype_int, long_ftype_int_int_int;
   tree void_ftype_int_long, int_ftype_int_int_int,
     void_ftype_long_int_int_int;
-  tree void_ftype_void, void_ftype_int, unsigned_ftype_unsigned;
+  tree void_ftype_void, unsigned_ftype_unsigned;
 
   /* void func (void) */
   void_ftype_void = build_function_type (void_type_node, endlink);
 
-  /* void func (void *) */
-  void_ftype_pchar
-    = build_function_type (void_type_node,
-			   tree_cons (NULL_TREE, pchar_type_node, endlink));
-
-  /* int func (void) */
-  int_ftype_void = build_function_type (integer_type_node, endlink);
-
-  /* void func (int) */
-  void_ftype_int = build_function_type (void_type_node, int_endlink);
-
   /* int func (int) */
   int_ftype_int = build_function_type (integer_type_node, int_endlink);
 
@@ -4261,10 +4246,6 @@  picochip_init_builtins (void)
   /* long func(int) */
   long_ftype_int = build_function_type (long_integer_type_node, int_endlink);
 
-  /* long func(int, int) */
-  long_ftype_int_int
-    = build_function_type (long_integer_type_node, int_int_endlink);
-
   /* long func(int, int, int) */
   long_ftype_int_int_int
     = build_function_type (long_integer_type_node, int_int_int_endlink);
Index: config/picochip/picochip.h
===================================================================
--- config/picochip/picochip.h	(revision 166360)
+++ config/picochip/picochip.h	(working copy)
@@ -550,7 +550,7 @@  do {                                    
 
 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)  \
 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 15),    \
-  sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
+  sprintf ((OUTPUT), "%s___%lu", (NAME), (unsigned long)(LABELNO)))
 
 /* Macros Controlling Initialization Routines  */
 
@@ -622,7 +622,7 @@  do {                                    
 /* Assembler Commands for Alignment  */
 
 #define ASM_OUTPUT_SKIP(STREAM,BYTES) \
-  fprintf(STREAM, ".skip %u\n", BYTES);
+  fprintf(STREAM, ".skip "HOST_WIDE_INT_PRINT_UNSIGNED"\n", BYTES);
 #define ASM_OUTPUT_ALIGN(STREAM,POWER) \
   fprintf(STREAM, ".align %u\n", 1 << POWER);
 
Index: config/picochip/picochip.md
===================================================================
--- config/picochip/picochip.md	(revision 166360)
+++ config/picochip/picochip.md	(working copy)
@@ -2520,7 +2520,6 @@  (define_expand "movhicc"
   ""
   {if (!picochip_check_conditional_copy (operands))
      FAIL;
-   operands[4] = GEN_INT(GET_CODE(operands[1]));
   })
 
 (define_insn_and_split "*checked_movhicc"
@@ -2593,7 +2592,7 @@  (define_attr "type"
   (const_string "unknown"))
 
 (define_attr "schedType" "none,space,speed"
-  (const (symbol_ref "picochip_schedule_type")))
+  (const (symbol_ref "(enum attr_schedType) picochip_schedule_type")))
 
 ;; Define whether an instruction uses a long constant.