diff mbox

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

Message ID 20101123135758.50c8mzs46cg8cok4-nzlynne@webmail.spamcop.net
State New
Headers show

Commit Message

Joern Rennecke Nov. 23, 2010, 6:57 p.m. UTC
Tested by cross-building "all-gcc" on i686-pc-linux-gnu .
2010-11-23  Joern Rennecke  <amylaar@spamcop.net>

	PR target/46623
	* config/microblaze/microblaze.c (microblaze_block_move_straight):
	Use XALLOCAVEC.
	(microblaze_option_override): Don't use C++ style comments.
	(save_restore_insns): Remove unused variable base_offset.
	(microblaze_expand_prologue): Remove unused variable insn.
	(microblaze_secondary_reload): Adjust type to match target.h .
	(microblaze_elf_in_small_data_p): Move declarations to start of block.
	(microblaze_expand_move): Likewise.
	* config/microblaze/microblaze.h (LARGE_INT):
	Avoid signed / unsigned comparisons.
	(ASM_OUTPUT_ALIGNED_COMMON, ASM_OUTPUT_ALIGNED_LOCAL): Likewise.
	(ASM_FORMAT_PRIVATE_NAME): Make format specifier match printed data.
	(ASM_FINISH_DECLARE_OBJECT): Likewise.  Constify name.

Comments

Michael Eager Nov. 26, 2010, 5:29 p.m. UTC | #1
Joern Rennecke wrote:
> Tested by cross-building "all-gcc" on i686-pc-linux-gnu .

OK.
diff mbox

Patch

Index: config/microblaze/microblaze.c
===================================================================
--- config/microblaze/microblaze.c	(revision 167087)
+++ config/microblaze/microblaze.c	(working copy)
@@ -729,7 +729,7 @@  microblaze_block_move_straight (rtx dest
   delta = bits / BITS_PER_UNIT;
 
   /* Allocate a buffer for the temporary registers.  */
-  regs = alloca (sizeof (rtx) * length / delta);
+  regs = XALLOCAVEC (rtx, length / delta);
 
   /* Load as many BITS-sized chunks as possible.  Use a normal load if
      the source has enough alignment, otherwise use left/right pairs.  */
@@ -1317,7 +1317,9 @@  microblaze_option_override (void)
   if (ver < 0)
     {
       /* No hardware exceptions in earlier versions. So no worries.  */
-      // microblaze_select_flags &= ~(MICROBLAZE_MASK_NO_UNSAFE_DELAY);
+#if 0
+      microblaze_select_flags &= ~(MICROBLAZE_MASK_NO_UNSAFE_DELAY);
+#endif
       microblaze_no_unsafe_delay = 0;
       microblaze_pipe = MICROBLAZE_PIPE_3;
     }
@@ -1325,7 +1327,9 @@  microblaze_option_override (void)
 	   || (MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v4.00.b")
 	       == 0))
     {
-      // microblaze_select_flags |= (MICROBLAZE_MASK_NO_UNSAFE_DELAY);
+#if 0
+      microblaze_select_flags |= (MICROBLAZE_MASK_NO_UNSAFE_DELAY);
+#endif
       microblaze_no_unsafe_delay = 1;
       microblaze_pipe = MICROBLAZE_PIPE_3;
     }
@@ -1333,7 +1337,9 @@  microblaze_option_override (void)
     {
       /* We agree to use 5 pipe-stage model even on area optimized 3 
          pipe-stage variants.  */
-      // microblaze_select_flags &= ~(MICROBLAZE_MASK_NO_UNSAFE_DELAY);
+#if 0
+      microblaze_select_flags &= ~(MICROBLAZE_MASK_NO_UNSAFE_DELAY);
+#endif
       microblaze_no_unsafe_delay = 0;
       microblaze_pipe = MICROBLAZE_PIPE_5;
       if (MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v5.00.a") == 0
@@ -1362,7 +1368,9 @@  microblaze_option_override (void)
   /* Always use DFA scheduler.  */
   microblaze_sched_use_dfa = 1;
 
-  // microblaze_abicalls = MICROBLAZE_ABICALLS_NO;
+#if 0
+  microblaze_abicalls = MICROBLAZE_ABICALLS_NO;
+#endif
 
   /* Initialize the high, low values for legit floating point constants.  */
   real_maxval (&dfhigh, 0, DFmode);
@@ -2068,7 +2076,7 @@  save_restore_insns (int prologue)
     0, isr_mem_rtx = 0;
   rtx isr_msr_rtx = 0, insn;
   long mask = current_frame_info.mask;
-  HOST_WIDE_INT base_offset, gp_offset;
+  HOST_WIDE_INT gp_offset;
   int regno;
 
   if (frame_pointer_needed
@@ -2094,7 +2102,6 @@  save_restore_insns (int prologue)
   gcc_assert (gp_offset > 0);
 
   base_reg_rtx = stack_pointer_rtx;
-  base_offset = 0;
 
   /* For interrupt_handlers, need to save/restore the MSR.  */
   if (interrupt_handler)
@@ -2391,9 +2398,8 @@  microblaze_expand_prologue (void)
 
   if (flag_pic == 2 && df_regs_ever_live_p (MB_ABI_PIC_ADDR_REGNUM))
     {
-      rtx insn;
       SET_REGNO (pic_offset_table_rtx, MB_ABI_PIC_ADDR_REGNUM);
-      insn = emit_insn (gen_set_got (pic_offset_table_rtx));	/* setting GOT.  */
+      emit_insn (gen_set_got (pic_offset_table_rtx));	/* setting GOT.  */
     }
 
   /* If we are profiling, make sure no instructions are scheduled before
@@ -2518,9 +2524,9 @@  microblaze_can_use_return_insn (void)
 
 /* Implement TARGET_SECONDARY_RELOAD.  */
 
-static enum reg_class
+static reg_class_t
 microblaze_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED, 
-			     enum reg_class rclass, enum machine_mode mode ATTRIBUTE_UNUSED, 
+			     reg_class_t rclass, enum machine_mode mode ATTRIBUTE_UNUSED, 
 			     secondary_reload_info *sri ATTRIBUTE_UNUSED)
 {
   if (rclass == ST_REGS)
@@ -2546,6 +2552,8 @@  microblaze_globalize_label (FILE * strea
 static bool
 microblaze_elf_in_small_data_p (const_tree decl)
 {
+  HOST_WIDE_INT size;
+
   if (!TARGET_XLGPOPT)
     return false;
 
@@ -2567,7 +2575,7 @@  microblaze_elf_in_small_data_p (const_tr
 	return true;
     }
 
-  HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (decl));
+  size = int_size_in_bytes (TREE_TYPE (decl));
 
   return (size > 0 && size <= microblaze_section_threshold);
 }
@@ -2624,11 +2632,11 @@  microblaze_expand_move (enum machine_mod
 	  rtx addr = XEXP (operands[0], 0);
 	  if (GET_CODE (addr) == SYMBOL_REF)
 	    {
+	      rtx ptr_reg, result;
+
 	      if (reload_in_progress)
 		df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
 
-	      rtx ptr_reg, result;
-
 	      addr = expand_pic_symbol_ref (mode, addr);
 	      ptr_reg = gen_reg_rtx (Pmode);
 	      emit_move_insn (ptr_reg, addr);
Index: config/microblaze/microblaze.h
===================================================================
--- config/microblaze/microblaze.h	(revision 167087)
+++ config/microblaze/microblaze.h	(working copy)
@@ -369,7 +369,8 @@  #define REG_CLASS_CONTENTS						\
 /* REGISTER AND CONSTANT CLASSES */
 
 #define SMALL_INT(X) ((unsigned HOST_WIDE_INT) (INTVAL (X) + 0x8000) < 0x10000)
-#define LARGE_INT(X) (INTVAL (X) >= 0x80000000 && INTVAL (X) <= 0xffffffff)
+#define LARGE_INT(X) \
+  (INTVAL (X) > 0 && UINTVAL (X) >= 0x80000000 && UINTVAL (X) <= 0xffffffff)
 #define PLT_ADDR_P(X) (GET_CODE (X) == UNSPEC && XINT (X,1) == UNSPEC_PLT)
 /* Test for a valid operand for a call instruction.
    Don't allow the arg pointer register or virtual regs
@@ -647,8 +648,9 @@  #define ADDITIONAL_REGISTER_NAMES					\
 #undef	ASM_OUTPUT_ALIGNED_COMMON
 #define	ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
 do {									\
-  if (SIZE > 0 && SIZE <= microblaze_section_threshold                  \
-      && TARGET_XLGPOPT)                                               \
+  if ((SIZE) > 0 && (SIZE) <= INT_MAX					\
+      && (int) (SIZE) <= microblaze_section_threshold			\
+      && TARGET_XLGPOPT)						\
     {                                                                   \
       switch_to_section (sbss_section);					\
     }									\
@@ -666,8 +668,9 @@  #define	ASM_OUTPUT_ALIGNED_COMMON(FILE, 
 #undef ASM_OUTPUT_ALIGNED_LOCAL
 #define	ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)		\
 do {									\
-  if (SIZE > 0 && SIZE <= microblaze_section_threshold                  \
-      && TARGET_XLGPOPT)                                               \
+  if ((SIZE) > 0 && (SIZE) <= INT_MAX					\
+      && (int) (SIZE) <= microblaze_section_threshold			\
+      && TARGET_XLGPOPT)						\
     {                                                                   \
       switch_to_section (sbss_section);					\
     }									\
@@ -736,7 +739,7 @@  #define ASM_OUTPUT_IDENT(FILE, STRING)		
    LABELNO is an integer which is different for each call.  */
 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)			\
 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),			\
-  sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
+  sprintf ((OUTPUT), "%s.%lu", (NAME), (unsigned long)(LABELNO)))
 
 /* How to start an assembler comment.
    The leading space is important (the microblaze assembler requires it).  */
@@ -817,7 +820,8 @@  #define ASM_DECLARE_OBJECT_NAME(FILE, NA
 	size_directive_output = 1;					\
 	fprintf (FILE, "%s", SIZE_ASM_OP);				\
 	assemble_name (FILE, NAME);					\
-	fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL)));	\
+	fprintf (FILE, "," HOST_WIDE_INT_PRINT_DEC "\n",		\
+	int_size_in_bytes (TREE_TYPE (DECL)));				\
       }									\
     microblaze_declare_object (FILE, NAME, "", ":\n", 0);			\
   } while (0)
@@ -825,7 +829,7 @@  #define ASM_DECLARE_OBJECT_NAME(FILE, NA
 #undef ASM_FINISH_DECLARE_OBJECT
 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)	 \
 do {									 \
-     char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);			 \
+     const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);		 \
      if (!flag_inhibit_size_directive && DECL_SIZE (DECL)		 \
          && ! AT_END && TOP_LEVEL					 \
 	 && DECL_INITIAL (DECL) == error_mark_node			 \
@@ -834,7 +838,8 @@  #define ASM_FINISH_DECLARE_OBJECT(FILE, 
 	 size_directive_output = 1;					 \
 	 fprintf (FILE, "%s", SIZE_ASM_OP);			         \
 	 assemble_name (FILE, name);					 \
-	 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));  \
+	 fprintf (FILE, "," HOST_WIDE_INT_PRINT_DEC "\n",		 \
+		  int_size_in_bytes (TREE_TYPE (DECL)));		 \
        }								 \
    } while (0)