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]

gcc directory warning patches


	Here are some nits fixed in the gcc dir.  Okay to install?
		--Kaveh



Mon Dec 21 12:48:10 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* alias.c (record_alias_subset): Remove ignored `&'.
	(init_alias_once): Likewise.

	* c-lex.c (UNGETC): Cast first argument of comma expression to void.

	* config/mips/mips.c (mips_asm_file_end): Cast the result of
	fwrite to `int' when comparing against one.

	* config/mips/mips.h (CAN_ELIMINATE): Add parens around && within ||.
	(INITIAL_ELIMINATION_OFFSET): Add braces to avoid ambiguous `else'.

	* cse.c (rehash_using_reg): Change type of variable `i' to
	unsigned int.

	* dwarf2out.c (initial_return_save): Cast -1 to unsigned before
	assigning it to one.

	* except.c (duplicate_eh_handlers): Remove unused variable `tmp'.

	* final.c (final_scan_insn): Likewise for variable `i'.
	(output_asm_insn): Cast a char to unsigned char when used as an
	array index.

	* gcse.c (compute_pre_ppinout): Cast -1 to SBITMAP_ELT_TYPE when
	assigning it to one.

	* loop.c (strength_reduce): Remove unused variable `temp'.

	* recog.c (preprocess_constraints): Cast a char to unsigned char
	when used as an array index.

	* regmove.c (find_matches): Likewise.

	* reload1.c (calculate_needs): Add default case in switch.
	(eliminate_regs_in_insn): Initialize variable `offset'.
	(set_offsets_for_label): Change type of variable `i' to unsigned.
	(reload_as_needed): Wrap variable `i' in macro check on
	AUTO_INC_DEC || INSN_CLOBBERS_REGNO_P.

	* rtlanal.c (multiple_sets): Change type of truth-value variable
	`found' from rtx to int.

	* scan-decls.c (scan_decls): Mark parameters `argc' and `argv'
	with ATTRIBUTE_UNUSED.  Cast variable `start_written' to size_t
	when comparing against one.

	* stor-layout.c (layout_decl): Cast maximum_field_alignment to
	unsigned when comparing against one.  Likewise for
	GET_MODE_ALIGNMENT().
	(layout_record): Cast record_align to int when comparing against a
	signed value. 
	(layout_type): Cast TYPE_ALIGN() to int when comparing against a
	signed value.

	* tree.c (get_identifier): Cast variable `len' to unsigned when
	comparing against one.
	(maybe_get_identifier): Likewise
	
	
diff -rup orig/egcs-CVS19981220/gcc/alias.c egcs-CVS19981220/gcc/alias.c
--- orig/egcs-CVS19981220/gcc/alias.c	Sun Dec 20 09:13:48 1998
+++ egcs-CVS19981220/gcc/alias.c	Mon Dec 21 11:29:27 1998
@@ -302,7 +302,7 @@ record_alias_subset (superset, subset)
 	(alias_set_entry) xmalloc (sizeof (struct alias_set_entry));
       superset_entry->alias_set = superset;
       superset_entry->children 
-	= splay_tree_new (&alias_set_compare, 0, 0);
+	= splay_tree_new (alias_set_compare, 0, 0);
       splay_tree_insert (alias_sets, 
 			 (splay_tree_key) superset,
 			 (splay_tree_value) superset_entry);
@@ -314,7 +314,7 @@ record_alias_subset (superset, subset)
     /* There is an entry for the subset.  Enter all of its children
        (if they are not already present) as children of the SUPERSET.  */
     splay_tree_foreach (subset_entry->children,
-			&insert_subset_children,
+			insert_subset_children,
 			superset_entry->children);
 
   /* Enter the SUBSET itself as a child of the SUPERSET.  */
@@ -1295,7 +1295,7 @@ init_alias_once ()
 	&& HARD_REGNO_MODE_OK (i, Pmode))
       SET_HARD_REG_BIT (argument_registers, i);
 
-  alias_sets = splay_tree_new (&alias_set_compare, 0, 0);
+  alias_sets = splay_tree_new (alias_set_compare, 0, 0);
 }
 
 void
diff -rup orig/egcs-CVS19981220/gcc/c-lex.c egcs-CVS19981220/gcc/c-lex.c
--- orig/egcs-CVS19981220/gcc/c-lex.c	Sun Dec 20 09:13:50 1998
+++ egcs-CVS19981220/gcc/c-lex.c	Mon Dec 21 11:53:27 1998
@@ -63,7 +63,7 @@ extern unsigned char *yy_cur, *yy_lim;
 extern int yy_get_token ();
 
 #define GETC() (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ())
-#define UNGETC(c) ((c), yy_cur--)
+#define UNGETC(c) ((void)(c), yy_cur--)
 #else
 #define GETC() getc (finput)
 #define UNGETC(c) ungetc (c, finput)
diff -rup orig/egcs-CVS19981220/gcc/config/mips/mips.c egcs-CVS19981220/gcc/config/mips/mips.c
--- orig/egcs-CVS19981220/gcc/config/mips/mips.c	Sun Dec 20 09:13:02 1998
+++ egcs-CVS19981220/gcc/config/mips/mips.c	Mon Dec 21 12:38:31 1998
@@ -5326,7 +5326,7 @@ mips_asm_file_end (file)
 	fatal_io_error (temp_filename);
 
       while ((len = fread (buffer, 1, sizeof (buffer), asm_out_text_file)) > 0)
-	if (fwrite (buffer, 1, len, file) != len)
+	if ((int) fwrite (buffer, 1, len, file) != len)
 	  pfatal_with_name (asm_file_name);
 
       if (len < 0)
diff -rup orig/egcs-CVS19981220/gcc/config/mips/mips.h egcs-CVS19981220/gcc/config/mips/mips.h
--- orig/egcs-CVS19981220/gcc/config/mips/mips.h	Sun Dec 20 09:13:03 1998
+++ egcs-CVS19981220/gcc/config/mips/mips.h	Mon Dec 21 12:34:25 1998
@@ -2180,7 +2180,7 @@ extern struct mips_frame_info current_fr
 
 #define CAN_ELIMINATE(FROM, TO)						\
   (((FROM) == RETURN_ADDRESS_POINTER_REGNUM && (! leaf_function_p ()	\
-   || TO == GP_REG_FIRST + 31 && leaf_function_p))   			\
+   || (TO == GP_REG_FIRST + 31 && leaf_function_p)))   			\
   || ((FROM) != RETURN_ADDRESS_POINTER_REGNUM				\
    && ((TO) == HARD_FRAME_POINTER_REGNUM 				\
    || ((TO) == STACK_POINTER_REGNUM && ! frame_pointer_needed		\
@@ -2219,11 +2219,13 @@ extern struct mips_frame_info current_fr
   /* Some ABIs store 64 bits to the stack, but Pmode is 32 bits,	 \
      so we must add 4 bytes to the offset to get the right value.  */	 \
   else if ((FROM) == RETURN_ADDRESS_POINTER_REGNUM)			 \
+  {									 \
    if (leaf_function_p ()) 						 \
       (OFFSET) = 0;				 			 \
    else (OFFSET) = current_frame_info.gp_sp_offset			 \
 	       + ((UNITS_PER_WORD - (POINTER_SIZE / BITS_PER_UNIT))	 \
 		  * (BYTES_BIG_ENDIAN != 0));				 \
+  }									 \
 }
 
 /* If we generate an insn to push BYTES bytes,
diff -rup orig/egcs-CVS19981220/gcc/cse.c egcs-CVS19981220/gcc/cse.c
--- orig/egcs-CVS19981220/gcc/cse.c	Sun Dec 20 09:13:58 1998
+++ egcs-CVS19981220/gcc/cse.c	Mon Dec 21 12:28:45 1998
@@ -1772,7 +1772,7 @@ static void
 rehash_using_reg (x)
      rtx x;
 {
-  int i;
+  unsigned int i;
   struct table_elt *p, *next;
   unsigned hash;
 
diff -rup orig/egcs-CVS19981220/gcc/dwarf2out.c egcs-CVS19981220/gcc/dwarf2out.c
--- orig/egcs-CVS19981220/gcc/dwarf2out.c	Sun Dec 20 09:13:59 1998
+++ egcs-CVS19981220/gcc/dwarf2out.c	Mon Dec 21 10:16:57 1998
@@ -1040,7 +1040,7 @@ static void
 initial_return_save (rtl)
      register rtx rtl;
 {
-  unsigned reg = -1;
+  unsigned int reg = (unsigned int) -1;
   long offset = 0;
 
   switch (GET_CODE (rtl))
diff -rup orig/egcs-CVS19981220/gcc/except.c egcs-CVS19981220/gcc/except.c
--- orig/egcs-CVS19981220/gcc/except.c	Sun Dec 20 09:13:58 1998
+++ egcs-CVS19981220/gcc/except.c	Mon Dec 21 11:54:15 1998
@@ -982,7 +982,6 @@ duplicate_eh_handlers (old_note_eh_regio
 {
   struct handler_info *ptr, *new_ptr;
   int new_region, region;
-  rtx tmp;
 
   region = find_func_region (old_note_eh_region);
   if (region == -1)
diff -rup orig/egcs-CVS19981220/gcc/final.c egcs-CVS19981220/gcc/final.c
--- orig/egcs-CVS19981220/gcc/final.c	Sun Dec 20 09:14:02 1998
+++ egcs-CVS19981220/gcc/final.c	Mon Dec 21 11:49:48 1998
@@ -2035,7 +2035,6 @@ final_scan_insn (insn, file, optimize, p
      int prescan;
      int nopeepholes;
 {
-  register int i;
 #ifdef HAVE_cc0
   rtx set;
 #endif
@@ -3486,7 +3485,7 @@ output_asm_insn (template, operands)
 	   punctuation character alone, with no operand.
 	   The PRINT_OPERAND macro decides what is actually done.  */
 #ifdef PRINT_OPERAND_PUNCT_VALID_P
-	else if (PRINT_OPERAND_PUNCT_VALID_P (*p))
+	else if (PRINT_OPERAND_PUNCT_VALID_P ((unsigned char)*p))
 	  output_operand (NULL_RTX, *p++);
 #endif
 	else
diff -rup orig/egcs-CVS19981220/gcc/gcse.c egcs-CVS19981220/gcc/gcse.c
--- orig/egcs-CVS19981220/gcc/gcse.c	Sun Dec 20 09:18:04 1998
+++ egcs-CVS19981220/gcc/gcse.c	Mon Dec 21 10:16:57 1998
@@ -4258,7 +4258,7 @@ compute_pre_ppinout ()
 	    {
 	      int_list_ptr pred;
 	      SBITMAP_ELT_TYPE tmp = *antin & *pavin & (*antloc | (*transp & *ppout));
-	      SBITMAP_ELT_TYPE pred_val = -1L;
+	      SBITMAP_ELT_TYPE pred_val = (SBITMAP_ELT_TYPE) -1;
 
 	      for (pred = s_preds[bb]; pred != NULL; pred = pred->next)
 		{
diff -rup orig/egcs-CVS19981220/gcc/loop.c egcs-CVS19981220/gcc/loop.c
--- orig/egcs-CVS19981220/gcc/loop.c	Sun Dec 20 09:14:43 1998
+++ egcs-CVS19981220/gcc/loop.c	Mon Dec 21 11:54:51 1998
@@ -3927,10 +3927,8 @@ strength_reduce (scan_start, end, loop_t
 						 &add_val, &mult_val,
 						 &last_consec_insn))))
 	    {
-	      int count;
 	      struct induction *v
 		= (struct induction *) alloca (sizeof (struct induction));
-	      rtx temp;
 
 	      /* If this is a library call, increase benefit.  */
 	      if (find_reg_note (p, REG_RETVAL, NULL_RTX))
diff -rup orig/egcs-CVS19981220/gcc/recog.c egcs-CVS19981220/gcc/recog.c
--- orig/egcs-CVS19981220/gcc/recog.c	Sun Dec 20 09:14:44 1998
+++ egcs-CVS19981220/gcc/recog.c	Mon Dec 21 11:50:46 1998
@@ -1908,7 +1908,7 @@ preprocess_constraints ()
 		  break;
 
 		default:
-		  op_alt[j].class = reg_class_subunion[(int) op_alt[j].class][(int) REG_CLASS_FROM_LETTER (c)];
+		  op_alt[j].class = reg_class_subunion[(int) op_alt[j].class][(int) REG_CLASS_FROM_LETTER ((unsigned char)c)];
 		  break;
 		}
 	    }
diff -rup orig/egcs-CVS19981220/gcc/regmove.c egcs-CVS19981220/gcc/regmove.c
--- orig/egcs-CVS19981220/gcc/regmove.c	Sun Dec 20 09:14:47 1998
+++ egcs-CVS19981220/gcc/regmove.c	Mon Dec 21 11:47:05 1998
@@ -1471,7 +1471,7 @@ find_matches (insn, matchp)
 	  case 'j': case 'k': case 'l': case 'p': case 'q': case 't': case 'u':
 	  case 'v': case 'w': case 'x': case 'y': case 'z': case 'A': case 'B':
 	  case 'C': case 'D': case 'W': case 'Y': case 'Z':
-	    if (CLASS_LIKELY_SPILLED_P (REG_CLASS_FROM_LETTER (c)))
+	    if (CLASS_LIKELY_SPILLED_P (REG_CLASS_FROM_LETTER ((unsigned char)c)))
 	      likely_spilled[op_no] = 1;
 	    break;
 	  }
diff -rup orig/egcs-CVS19981220/gcc/reload1.c egcs-CVS19981220/gcc/reload1.c
--- orig/egcs-CVS19981220/gcc/reload1.c	Sun Dec 20 09:14:48 1998
+++ egcs-CVS19981220/gcc/reload1.c	Mon Dec 21 12:35:48 1998
@@ -1527,6 +1527,8 @@ calculate_needs (chain)
 	case RELOAD_FOR_OPADDR_ADDR:
 	  this_needs = &insn_needs.op_addr_reload;
 	  break;
+	default:
+	  abort();
 	}
 
       if (size > 1)
@@ -3244,7 +3246,7 @@ eliminate_regs_in_insn (insn, replace)
 		&& ep->to == HARD_FRAME_POINTER_REGNUM)
 	      {
 		rtx src = SET_SRC (old_set);
-		int offset, ok = 0;
+		int offset = 0, ok = 0;
 		rtx prev_insn, prev_set;
 
 		if (src == ep->to_rtx)
@@ -3572,7 +3574,7 @@ static void
 set_offsets_for_label (insn)
      rtx insn;
 {
-  int i;
+  unsigned int i;
   int label_nr = CODE_LABEL_NUMBER (insn);
   struct elim_table *ep;
 
@@ -4148,7 +4150,9 @@ reload_as_needed (live_known)
      int live_known;
 {
   struct insn_chain *chain;
+#if defined (AUTO_INC_DEC) || defined (INSN_CLOBBERS_REGNO_P)
   register int i;
+#endif
   rtx x;
 
   bzero ((char *) spill_reg_rtx, sizeof spill_reg_rtx);
diff -rup orig/egcs-CVS19981220/gcc/rtlanal.c egcs-CVS19981220/gcc/rtlanal.c
--- orig/egcs-CVS19981220/gcc/rtlanal.c	Sun Dec 20 09:14:49 1998
+++ egcs-CVS19981220/gcc/rtlanal.c	Mon Dec 21 10:16:57 1998
@@ -698,7 +698,7 @@ int
 multiple_sets (insn)
      rtx insn;
 {
-  rtx found;
+  int found;
   int i;
   
   /* INSN must be an insn.  */
diff -rup orig/egcs-CVS19981220/gcc/scan-decls.c egcs-CVS19981220/gcc/scan-decls.c
--- orig/egcs-CVS19981220/gcc/scan-decls.c	Sun Dec 20 09:14:49 1998
+++ egcs-CVS19981220/gcc/scan-decls.c	Mon Dec 21 12:43:08 1998
@@ -77,8 +77,8 @@ Here dname is the actual name being decl
 int
 scan_decls (pfile, argc, argv)
      cpp_reader *pfile;
-     int argc;
-     char **argv;
+     int argc ATTRIBUTE_UNUSED;
+     char **argv ATTRIBUTE_UNUSED;
 {
   int saw_extern, saw_inline;
   int start_written;
@@ -169,7 +169,7 @@ scan_decls (pfile, argc, argv)
 	    }
 	  break;
 	case CPP_OTHER:
-	  if (CPP_WRITTEN (pfile) == start_written + 1
+	  if (CPP_WRITTEN (pfile) == (size_t) start_written + 1
 	      && (CPP_PWRITTEN (pfile)[-1] == '*'
 		  || CPP_PWRITTEN (pfile)[-1] == '&'))
 	    declarator_start = start_written;
diff -rup orig/egcs-CVS19981220/gcc/stor-layout.c egcs-CVS19981220/gcc/stor-layout.c
--- orig/egcs-CVS19981220/gcc/stor-layout.c	Sun Dec 20 09:14:50 1998
+++ egcs-CVS19981220/gcc/stor-layout.c	Mon Dec 21 12:23:27 1998
@@ -283,7 +283,8 @@ layout_decl (decl, known_align)
     {
       DECL_BIT_FIELD_TYPE (decl) = DECL_BIT_FIELD (decl) ? type : 0;
       if (maximum_field_alignment != 0)
-	DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), maximum_field_alignment);
+	DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl),
+				 (unsigned)maximum_field_alignment);
       else if (DECL_PACKED (decl))
 	DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT);
     }
@@ -299,7 +300,7 @@ layout_decl (decl, known_align)
       if (xmode != BLKmode
 	  && known_align % GET_MODE_ALIGNMENT (xmode) == 0)
 	{
-	  DECL_ALIGN (decl) = MAX (GET_MODE_ALIGNMENT (xmode),
+	  DECL_ALIGN (decl) = MAX ((unsigned) GET_MODE_ALIGNMENT (xmode),
 				   DECL_ALIGN (decl));
 	  DECL_MODE (decl) = xmode;
 	  DECL_SIZE (decl) = size_int (GET_MODE_BITSIZE (xmode));
@@ -413,7 +414,7 @@ layout_record (rec)
 	     It does, however, affect the alignment of the next field
 	     within the structure.  */
 	  if (! integer_zerop (DECL_SIZE (field)))
-	    record_align = MAX (record_align, desired_align);
+	    record_align = MAX ((int)record_align, desired_align);
 	  else if (! DECL_PACKED (field))
 	    desired_align = TYPE_ALIGN (TREE_TYPE (field));
 	  /* A named bit field of declared type `int'
@@ -426,11 +427,11 @@ layout_record (rec)
 	      else if (DECL_PACKED (field))
 		type_align = MIN (type_align, BITS_PER_UNIT);
 
-	      record_align = MAX (record_align, type_align);
+	      record_align = MAX ((int)record_align, type_align);
 	    }
 	}
       else
-	record_align = MAX (record_align, desired_align);
+	record_align = MAX ((int)record_align, desired_align);
 #endif
 
       /* Does this field automatically have alignment it needs
@@ -913,7 +914,7 @@ layout_type (type)
 			       MODE_INT, 1);
 
 	    if (STRICT_ALIGNMENT && TYPE_ALIGN (type) < BIGGEST_ALIGNMENT
-		&& TYPE_ALIGN (type) < TREE_INT_CST_LOW (TYPE_SIZE (type))
+		&& (int)TYPE_ALIGN (type) < TREE_INT_CST_LOW (TYPE_SIZE (type))
 		&& TYPE_MODE (type) != BLKmode)
 	      {
 		TYPE_NO_FORCE_BLK (type) = 1;
@@ -979,7 +980,7 @@ layout_type (type)
 	     then stick with BLKmode.  */
 	  if (STRICT_ALIGNMENT
 	      && ! (TYPE_ALIGN (type) >= BIGGEST_ALIGNMENT
-		    || (TYPE_ALIGN (type)
+		    || ((int)TYPE_ALIGN (type)
 			>= TREE_INT_CST_LOW (TYPE_SIZE (type)))))
 	    {
 	      if (TYPE_MODE (type) != BLKmode)
@@ -1011,7 +1012,7 @@ layout_type (type)
 	     then stick with BLKmode.  */
 	  && (! STRICT_ALIGNMENT
 	      || TYPE_ALIGN (type) >= BIGGEST_ALIGNMENT
-	      || TYPE_ALIGN (type) >= TREE_INT_CST_LOW (TYPE_SIZE (type))))
+	      || (int)TYPE_ALIGN (type) >= TREE_INT_CST_LOW (TYPE_SIZE (type))))
 	{
 	  tree field;
 	  /* A union which has any BLKmode members must itself be BLKmode;
diff -rup orig/egcs-CVS19981220/gcc/tree.c egcs-CVS19981220/gcc/tree.c
--- orig/egcs-CVS19981220/gcc/tree.c	Sun Dec 20 09:14:54 1998
+++ egcs-CVS19981220/gcc/tree.c	Mon Dec 21 12:10:16 1998
@@ -1266,7 +1266,7 @@ get_identifier (text)
 
   /* Decide how much of that length to hash on */
   hash_len = len;
-  if (warn_id_clash && len > id_clash_len)
+  if (warn_id_clash && (unsigned)len > id_clash_len)
     hash_len = id_clash_len;
 
   /* Compute hash code */
@@ -1285,7 +1285,7 @@ get_identifier (text)
       return idp;		/* <-- return if found */
 
   /* Not found; optionally warn about a similar identifier */
-  if (warn_id_clash && do_identifier_warnings && len >= id_clash_len)
+  if (warn_id_clash && do_identifier_warnings && (unsigned)len >= id_clash_len)
     for (idp = hash_table[hi]; idp; idp = TREE_CHAIN (idp))
       if (!strncmp (IDENTIFIER_POINTER (idp), text, id_clash_len))
 	{
@@ -1329,7 +1329,7 @@ maybe_get_identifier (text)
 
   /* Decide how much of that length to hash on */
   hash_len = len;
-  if (warn_id_clash && len > id_clash_len)
+  if (warn_id_clash && (unsigned)len > id_clash_len)
     hash_len = id_clash_len;
 
   /* Compute hash code */


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