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]

Warning patches for gcc dir.


	This patch cleans out ~55 warnings from the top level gcc
directory.  Tested by bootstrapping and "make check" on Irix6.

	Okay to install?

		Thanks,
		--Kaveh


1999-08-04  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* calls.c (emit_call_1): Mark parameter `stack_size' with
	ATTRIBUTE_UNUSED.
	(expand_call): Initialize variable `insn'.
	(emit_library_call): Likewise for variable `high_to_save'.
	(emit_library_call_value): Likewise.
	(store_one_arg): Likewise for variables `lower_bound' and
	`upper_bound'.

	* combine.c (try_combine): Likewise for variables `i2_code_number'
	and `other_code_number'.
	(find_split_point): Likewise for variables `pos', `unsignedp' and
	`inner'.
	(simplify_if_then_else): Likewise for variables `op' and `c1'.
	(simplify_and_const_int): Remove unused variable `width'.
	(merge_outer_ops): Likewise.

	* cse.c (simplify_binary_operation): Cast an INTVAL() to `unsigned
	HOST_WIDE_INT' when comparing against one.
	(simplify_relational_operation): Likewise.
	(cse_insn): Initialize variables `src_eqv_volatile',
	`src_eqv_in_memory', `src_eqv_in_struct', `src_eqv_hash' and `sets'.

	* final.c (init_final): Constify parameter `filename'.
	(final_start_function): Mark parameter `optimize' with
	ATTRIBUTE_UNUSED.
	(profile_function): Likewise for parameters `first' and `optimize'.
	(output_source_line): Likewise for parameter `file'.

	* integrate.c (subst_constants): Cast a value to `size_t' when
	comparing against one.
	(mark_stores): Initialize variable `mode'.  Cast a value to
	`size_t' when comparing against one.

	* integrate.h (MAYBE_EXTEND_CONST_EQUIV_VARRAY): Likewise.

	* loop.c (move_movables): Initialize variable `first'.
	(strength_reduce): Likewise for variable `increment'.
	(check_dbra_loop): Likewise for variable `comparison_val'.  Cast a
	value to `size_t' when comparing against one.
	(load_mems): Initialize variable `end_label'.

	* output.h (init_final): Constify parameter.

	* reload.c (decompose): Initialize variable `base'.

	* reload1.c (reload): Likewise for variable `is_scalar'.
	(spill_hard_reg): Mark parameter `dumpfile' with ATTRIBUTE_UNUSED.
	(choose_reload_regs): Initialize variable `mode'.
	(emit_reload_insns): Likewise for variable `store_insn'.
	(reload_cse_noop_set_p): Mark parameter `insn' with
	ATTRIBUTE_UNUSED.
	(reload_combine): Initialize variable `set'.

	* unroll.c (unroll_loop): Likewise for variable `local_label'.
	(copy_loop_body): Cast a value to `size_t' when comparing against
	one.

	* varasm.c (assemble_variable): Initialize variable `size_tree'.
	(const_hash): Add an `else abort()' in an if-else-if-else sequence.
	(remove_from_pending_weak_list): Mark parameter `name' with
	ATTRIBUTE_UNUSED.
	
	
diff -rup orig/egcs-CVS19990803/gcc/calls.c egcs-CVS19990803/gcc/calls.c
--- orig/egcs-CVS19990803/gcc/calls.c	Sat May  8 09:23:07 1999
+++ egcs-CVS19990803/gcc/calls.c	Tue Aug  3 23:15:06 1999
@@ -380,7 +380,7 @@ emit_call_1 (funexp, fndecl, funtype, st
      rtx funexp;
      tree fndecl ATTRIBUTE_UNUSED;
      tree funtype ATTRIBUTE_UNUSED;
-     HOST_WIDE_INT stack_size;
+     HOST_WIDE_INT stack_size ATTRIBUTE_UNUSED;
      HOST_WIDE_INT rounded_stack_size;
      HOST_WIDE_INT struct_value_size;
      rtx next_arg_reg;
@@ -1783,7 +1783,7 @@ expand_call (exp, target, ignore)
 	    {
 	      rtx first_insn
 		= before_call ? NEXT_INSN (before_call) : get_insns ();
-	      rtx insn, seq;
+	      rtx insn = NULL_RTX, seq;
 
 	      /* Look for a call in the inline function code.
 		 If OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl)) is
@@ -2574,7 +2574,7 @@ emit_library_call VPROTO((rtx orgfun, in
 #if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
   /* Define the boundary of the register parm stack space that needs to be
      save, if any.  */
-  int low_to_save = -1, high_to_save;
+  int low_to_save = -1, high_to_save = 0;
   rtx save_area = 0;            /* Place that it is saved */
 #endif
 
@@ -3073,7 +3073,7 @@ emit_library_call_value VPROTO((rtx orgf
 #if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
   /* Define the boundary of the register parm stack space that needs to be
      save, if any.  */
-  int low_to_save = -1, high_to_save;
+  int low_to_save = -1, high_to_save = 0;
   rtx save_area = 0;            /* Place that it is saved */
 #endif
 
@@ -3685,7 +3685,7 @@ store_one_arg (arg, argblock, may_be_all
   int partial = 0;
   int used = 0;
 #ifdef ACCUMULATE_OUTGOING_ARGS
-  int i, lower_bound, upper_bound;
+  int i, lower_bound = 0, upper_bound = 0;
 #endif
 
   if (TREE_CODE (pval) == ERROR_MARK)
diff -rup orig/egcs-CVS19990803/gcc/combine.c egcs-CVS19990803/gcc/combine.c
--- orig/egcs-CVS19990803/gcc/combine.c	Tue Aug  3 07:42:06 1999
+++ egcs-CVS19990803/gcc/combine.c	Tue Aug  3 22:43:59 1999
@@ -1338,7 +1338,7 @@ try_combine (i3, i2, i1)
   /* Nonzero is I2's body now appears in I3.  */
   int i2_is_used;
   /* INSN_CODEs for new I3, new I2, and user of condition code.  */
-  int insn_code_number, i2_code_number, other_code_number;
+  int insn_code_number, i2_code_number = 0, other_code_number = 0;
   /* Contains I3 if the destination of I3 is used in its source, which means
      that the old life of I3 is being killed.  If that usage is placed into
      I2 and not in I3, a REG_DEAD note must be made.  */
@@ -2592,8 +2592,8 @@ find_split_point (loc, insn)
   rtx x = *loc;
   enum rtx_code code = GET_CODE (x);
   rtx *split;
-  int len = 0, pos, unsignedp;
-  rtx inner;
+  int len = 0, pos = 0, unsignedp = 0;
+  rtx inner = NULL_RTX;
 
   /* First special-case some codes.  */
   switch (code)
@@ -4456,9 +4456,9 @@ simplify_if_then_else (x)
       rtx f = make_compound_operation (false, SET);
       rtx cond_op0 = XEXP (cond, 0);
       rtx cond_op1 = XEXP (cond, 1);
-      enum rtx_code op, extend_op = NIL;
+      enum rtx_code op = NIL, extend_op = NIL;
       enum machine_mode m = mode;
-      rtx z = 0, c1;
+      rtx z = 0, c1 = NULL_RTX;
 
       if ((GET_CODE (t) == PLUS || GET_CODE (t) == MINUS
 	   || GET_CODE (t) == IOR || GET_CODE (t) == XOR
@@ -7322,7 +7322,6 @@ simplify_and_const_int (x, mode, varop, 
      unsigned HOST_WIDE_INT constop;
 {
   unsigned HOST_WIDE_INT nonzero;
-  int width = GET_MODE_BITSIZE (mode);
   int i;
 
   /* Simplify VAROP knowing that we will be only looking at some of the
@@ -8223,7 +8222,6 @@ merge_outer_ops (pop0, pconst0, op1, con
 {
   enum rtx_code op0 = *pop0;
   HOST_WIDE_INT const0 = *pconst0;
-  int width = GET_MODE_BITSIZE (mode);
 
   const0 &= GET_MODE_MASK (mode);
   const1 &= GET_MODE_MASK (mode);
diff -rup orig/egcs-CVS19990803/gcc/cse.c egcs-CVS19990803/gcc/cse.c
--- orig/egcs-CVS19990803/gcc/cse.c	Tue Aug  3 07:42:09 1999
+++ egcs-CVS19990803/gcc/cse.c	Tue Aug  3 22:39:01 1999
@@ -4198,7 +4198,7 @@ simplify_binary_operation (code, mode, o
 	case ROTATE:
 	  /* Rotating ~0 always results in ~0.  */
 	  if (GET_CODE (op0) == CONST_INT && width <= HOST_BITS_PER_WIDE_INT
-	      && INTVAL (op0) == GET_MODE_MASK (mode)
+	      && (unsigned HOST_WIDE_INT) INTVAL (op0) == GET_MODE_MASK (mode)
 	      && ! side_effects_p (op1))
 	    return op0;
 
@@ -4224,7 +4224,7 @@ simplify_binary_operation (code, mode, o
 	   
 	case SMAX:
 	  if (width <= HOST_BITS_PER_WIDE_INT && GET_CODE (op1) == CONST_INT
-	      && (INTVAL (op1)
+	      && ((unsigned HOST_WIDE_INT) INTVAL (op1)
 		  == (unsigned HOST_WIDE_INT) GET_MODE_MASK (mode) >> 1)
 	      && ! side_effects_p (op0))
 	    return op1;
@@ -4839,14 +4839,14 @@ simplify_relational_operation (code, mod
 	  /* Unsigned values are never greater than the largest
 	     unsigned value.  */
 	  if (GET_CODE (op1) == CONST_INT
-	      && INTVAL (op1) == GET_MODE_MASK (mode)
+	      && (unsigned HOST_WIDE_INT) INTVAL (op1) == GET_MODE_MASK (mode)
 	    && INTEGRAL_MODE_P (mode))
 	  return const_true_rtx;
 	  break;
 
 	case GTU:
 	  if (GET_CODE (op1) == CONST_INT
-	      && INTVAL (op1) == GET_MODE_MASK (mode)
+	      && (unsigned HOST_WIDE_INT) INTVAL (op1) == GET_MODE_MASK (mode)
 	      && INTEGRAL_MODE_P (mode))
 	    return const0_rtx;
 	  break;
@@ -6377,12 +6377,12 @@ cse_insn (insn, libcall_insn)
 
   rtx src_eqv = 0;
   struct table_elt *src_eqv_elt = 0;
-  int src_eqv_volatile;
-  int src_eqv_in_memory;
-  int src_eqv_in_struct;
-  unsigned src_eqv_hash;
+  int src_eqv_volatile = 0;
+  int src_eqv_in_memory = 0;
+  int src_eqv_in_struct = 0;
+  unsigned src_eqv_hash = 0;
 
-  struct set *sets;
+  struct set *sets = NULL_PTR;
 
   this_insn = insn;
 
diff -rup orig/egcs-CVS19990803/gcc/final.c egcs-CVS19990803/gcc/final.c
--- orig/egcs-CVS19990803/gcc/final.c	Mon Jul 26 07:41:23 1999
+++ egcs-CVS19990803/gcc/final.c	Tue Aug  3 23:28:41 1999
@@ -313,7 +313,7 @@ extern char *getpwd ();
 
 void
 init_final (filename)
-     char *filename;
+     const char *filename ATTRIBUTE_UNUSED;
 {
   next_block_index = 2;
   app_on = 0;
@@ -1583,7 +1583,7 @@ void
 final_start_function (first, file, optimize)
      rtx first;
      FILE *file;
-     int optimize;
+     int optimize ATTRIBUTE_UNUSED;
 {
   block_depth = 0;
 
@@ -1775,9 +1775,9 @@ profile_function (file)
 
 void
 final_end_function (first, file, optimize)
-     rtx first;
+     rtx first ATTRIBUTE_UNUSED;
      FILE *file;
-     int optimize;
+     int optimize ATTRIBUTE_UNUSED;
 {
   if (app_on)
     {
@@ -2967,7 +2967,7 @@ final_scan_insn (insn, file, optimize, p
 
 static void
 output_source_line (file, insn)
-     FILE *file;
+     FILE *file ATTRIBUTE_UNUSED;
      rtx insn;
 {
   register char *filename = NOTE_SOURCE_FILE (insn);
diff -rup orig/egcs-CVS19990803/gcc/integrate.c egcs-CVS19990803/gcc/integrate.c
--- orig/egcs-CVS19990803/gcc/integrate.c	Mon Apr 26 06:00:59 1999
+++ egcs-CVS19990803/gcc/integrate.c	Tue Aug  3 22:33:01 1999
@@ -2909,7 +2909,7 @@ subst_constants (loc, insn, map)
 	struct const_equiv_data *p;
 
 	if (! (regno < FIRST_PSEUDO_REGISTER && REG_USERVAR_P (x))
-	    && regno < VARRAY_SIZE (map->const_equiv_varray)
+	    && (size_t) regno < VARRAY_SIZE (map->const_equiv_varray)
 	    && (p = &VARRAY_CONST_EQUIV (map->const_equiv_varray, regno),
 		p->rtx != 0)
 	    && p->age >= map->const_age)
@@ -3136,7 +3136,7 @@ mark_stores (dest, x)
      rtx x ATTRIBUTE_UNUSED;
 {
   int regno = -1;
-  enum machine_mode mode;
+  enum machine_mode mode = VOIDmode;
 
   /* DEST is always the innermost thing set, except in the case of
      SUBREGs of hard registers.  */
@@ -3160,7 +3160,7 @@ mark_stores (dest, x)
       if (regno != VIRTUAL_INCOMING_ARGS_REGNUM
 	  && regno != VIRTUAL_STACK_VARS_REGNUM)
 	for (i = regno; i <= last_reg; i++)
-	  if (i < VARRAY_SIZE (global_const_equiv_varray))
+	  if ((size_t) i < VARRAY_SIZE (global_const_equiv_varray))
 	    VARRAY_CONST_EQUIV (global_const_equiv_varray, i).rtx = 0;
     }
 }
diff -rup orig/egcs-CVS19990803/gcc/integrate.h egcs-CVS19990803/gcc/integrate.h
--- orig/egcs-CVS19990803/gcc/integrate.h	Mon Feb  1 07:50:50 1999
+++ egcs-CVS19990803/gcc/integrate.h	Tue Aug  3 22:24:17 1999
@@ -134,7 +134,7 @@ extern varray_type global_const_equiv_va
 
 #define MAYBE_EXTEND_CONST_EQUIV_VARRAY(MAP,MAX)			\
   {									\
-    if ((MAX) >= VARRAY_SIZE ((MAP)->const_equiv_varray))		\
+    if ((size_t)(MAX) >= VARRAY_SIZE ((MAP)->const_equiv_varray))	\
       {									\
         int is_global = (global_const_equiv_varray			\
 			 == (MAP)->const_equiv_varray);			\
diff -rup orig/egcs-CVS19990803/gcc/loop.c egcs-CVS19990803/gcc/loop.c
--- orig/egcs-CVS19990803/gcc/loop.c	Tue Aug  3 07:42:15 1999
+++ egcs-CVS19990803/gcc/loop.c	Tue Aug  3 23:07:42 1999
@@ -1837,7 +1837,7 @@ move_movables (movables, threshold, insn
 	    {
 	      int count;
 	      register struct movable *m1;
-	      rtx first;
+	      rtx first = NULL_RTX;
 
 	      /* Now move the insns that set the reg.  */
 
@@ -4015,7 +4015,7 @@ strength_reduce (scan_start, end, loop_t
       else
 	{
 	  struct iv_class *bl2 = 0;
-	  rtx increment;
+	  rtx increment = NULL_RTX;
 
 	  /* Biv initial value is not a simple move.  If it is the sum of
 	     another biv and a constant, check if both bivs are incremented
@@ -7868,7 +7868,7 @@ check_dbra_loop (loop_end, insn_count, l
 		  || (GET_CODE (comparison) == LE
 		      && no_use_except_counting)))
 	    {
-	      HOST_WIDE_INT add_val, add_adjust, comparison_val;
+	      HOST_WIDE_INT add_val, add_adjust, comparison_val = 0;
 	      rtx initial_value, comparison_value;
 	      int nonneg = 0;
 	      enum rtx_code cmp_code;
@@ -8140,7 +8140,7 @@ check_dbra_loop (loop_end, insn_count, l
 		       REG_EQUAL notes should still be correct.  */
 		    if (! set
 			|| GET_CODE (SET_DEST (set)) != REG
-			|| REGNO (SET_DEST (set)) >= reg_iv_type->num_elements
+			|| (size_t) REGNO (SET_DEST (set)) >= reg_iv_type->num_elements
 			|| REG_IV_TYPE (REGNO (SET_DEST (set))) != GENERAL_INDUCT
 			|| REG_IV_INFO (REGNO (SET_DEST (set)))->src_reg != bl->biv->src_reg)
 		      for (pnote = &REG_NOTES (p); *pnote;)
@@ -9485,7 +9485,7 @@ load_mems (scan_start, end, loop_top, st
   int i;
   rtx p;
   rtx label = NULL_RTX;
-  rtx end_label;
+  rtx end_label = NULL_RTX;
 
   if (loop_mems_idx > 0) 
     {
diff -rup orig/egcs-CVS19990803/gcc/output.h egcs-CVS19990803/gcc/output.h
--- orig/egcs-CVS19990803/gcc/output.h	Thu May 27 09:03:27 1999
+++ egcs-CVS19990803/gcc/output.h	Tue Aug  3 23:26:24 1999
@@ -20,7 +20,7 @@ the Free Software Foundation, 59 Temple 
 Boston, MA 02111-1307, USA.  */
 
 /* Initialize data in final at the beginning of a compilation.  */
-extern void init_final		PROTO((char *));
+extern void init_final		PROTO((const char *));
 
 /* Called at end of source file,
    to output the block-profiling table for this entire compilation.  */
diff -rup orig/egcs-CVS19990803/gcc/reload.c egcs-CVS19990803/gcc/reload.c
--- orig/egcs-CVS19990803/gcc/reload.c	Thu Jul 15 08:50:59 1999
+++ egcs-CVS19990803/gcc/reload.c	Tue Aug  3 23:22:24 1999
@@ -2225,7 +2225,7 @@ decompose (x)
   val.base = 0;
   if (GET_CODE (x) == MEM)
     {
-      rtx base, offset = 0;
+      rtx base = NULL_RTX, offset = 0;
       rtx addr = XEXP (x, 0);
 
       if (GET_CODE (addr) == PRE_DEC || GET_CODE (addr) == PRE_INC
diff -rup orig/egcs-CVS19990803/gcc/reload1.c egcs-CVS19990803/gcc/reload1.c
--- orig/egcs-CVS19990803/gcc/reload1.c	Tue Aug  3 07:42:18 1999
+++ egcs-CVS19990803/gcc/reload1.c	Tue Aug  3 22:51:47 1999
@@ -1091,7 +1091,7 @@ reload (first, global, dumpfile)
     {
       rtx addr = 0;
       int in_struct = 0;
-      int is_scalar;
+      int is_scalar = 0;
       int is_readonly = 0;
 
       if (reg_equiv_memory_loc[i])
@@ -3796,7 +3796,7 @@ init_elim_table ()
 static void
 spill_hard_reg (regno, dumpfile, cant_eliminate)
      register int regno;
-     FILE *dumpfile;
+     FILE *dumpfile ATTRIBUTE_UNUSED;
      int cant_eliminate;
 {
   register int i;
@@ -5847,7 +5847,7 @@ choose_reload_regs (chain)
 	    {
 	      int word = 0;
 	      register int regno = -1;
-	      enum machine_mode mode;
+	      enum machine_mode mode = VOIDmode;
 
 	      if (reload_in[r] == 0)
 		;
@@ -7624,7 +7624,7 @@ emit_reload_insns (chain)
 	  register int nregno = REGNO (out);
 	  if (nregno >= FIRST_PSEUDO_REGISTER)
 	    {
-	      rtx src_reg, store_insn;
+	      rtx src_reg, store_insn = NULL_RTX;
 
 	      reg_last_reload_reg[nregno] = 0;
 
@@ -8970,7 +8970,7 @@ reload_cse_regno_equal_p (regno, val, mo
 static int
 reload_cse_noop_set_p (set, insn)
      rtx set;
-     rtx insn;
+     rtx insn ATTRIBUTE_UNUSED;
 {
   rtx src, dest;
   enum machine_mode dest_mode;
@@ -9652,7 +9652,7 @@ reload_combine ()
 	  rtx prev = prev_nonnote_insn (insn);
 	  rtx prev_set = prev ? single_set (prev) : NULL_RTX;
 	  int regno = REGNO (reg);
-	  rtx const_reg;
+	  rtx const_reg = NULL_RTX;
 	  rtx reg_sum = NULL_RTX;
 
 	  /* Now, we need an index register.
@@ -10076,7 +10076,7 @@ reload_cse_move2add (first)
 		       && reg_set_luid[regno] > reg_set_luid[REGNO (src)])
 		{
 		  rtx next = next_nonnote_insn (insn);
-		  rtx set;
+		  rtx set = NULL_RTX;
 		  if (next)
 		    set = single_set (next);
 		  if (next
diff -rup orig/egcs-CVS19990803/gcc/unroll.c egcs-CVS19990803/gcc/unroll.c
--- orig/egcs-CVS19990803/gcc/unroll.c	Mon Aug  2 14:27:14 1999
+++ egcs-CVS19990803/gcc/unroll.c	Tue Aug  3 23:17:22 1999
@@ -236,7 +236,7 @@ unroll_loop (loop_end, insn_count, loop_
   int max_labelno, max_insnno;
   rtx insert_before;
   struct inline_remap *map;
-  char *local_label;
+  char *local_label = NULL;
   char *local_regno;
   int max_local_regnum;
   int maxregnum;
@@ -1974,7 +1974,7 @@ copy_loop_body (copy_start, copy_end, ma
 	    {
 	      int regno = REGNO (SET_DEST (pattern));
 
-	      if (regno < VARRAY_SIZE (map->const_equiv_varray)
+	      if ((size_t) regno < VARRAY_SIZE (map->const_equiv_varray)
 		  && (VARRAY_CONST_EQUIV (map->const_equiv_varray, regno).age
 		      == map->const_age))
 		VARRAY_CONST_EQUIV (map->const_equiv_varray, regno).age = -1;
diff -rup orig/egcs-CVS19990803/gcc/varasm.c egcs-CVS19990803/gcc/varasm.c
--- orig/egcs-CVS19990803/gcc/varasm.c	Tue Aug  3 07:42:21 1999
+++ egcs-CVS19990803/gcc/varasm.c	Tue Aug  3 22:59:34 1999
@@ -1158,7 +1158,7 @@ assemble_variable (decl, top_level, at_e
 {
   register char *name;
   unsigned int align;
-  tree size_tree;
+  tree size_tree = NULL_TREE;
   int reloc = 0;
   enum in_section saved_in_section;
 
@@ -2354,6 +2354,8 @@ const_hash (exp)
 	  }
 	else if (GET_CODE (value.base) == LABEL_REF)
 	  hi = value.offset + CODE_LABEL_NUMBER (XEXP (value.base, 0)) * 13;
+	else
+	  abort();
 
 	hi &= (1 << HASHBITS) - 1;
 	hi %= MAX_HASH_TABLE;
@@ -4382,7 +4384,7 @@ weak_finish ()
    some assemblers.  */
 static void
 remove_from_pending_weak_list (name)
-     char *name;
+     char *name ATTRIBUTE_UNUSED;
 {
 #ifdef HANDLE_PRAGMA_WEAK
   if (HANDLE_PRAGMA_WEAK)


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