warning patches part 2/2

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Mon Oct 12 09:14:00 GMT 1998


	This is part 2/2, okay to install?


	* expr.c (copy_blkmode_from_reg): Cast BITS_PER_WORD to (unsigned)
	when comparing against one.
	(get_inner_reference): Change variable `alignment' to unsigned.
	(expand_expr): Cast the result of GET_MODE_ALIGNMENT to (unsigned
	int) when comparing against one.
	(expand_builtin_setjmp): Change type of variable `i' to size_t.

	* fold-const.c (div_and_round_double): Cast BASE to
	(HOST_WIDE_INT) when comparing against one.

	* gencheck.c: Include gansidecl.h.
	(main): Mark parameter `argv' with ATTRIBUTE_UNUSED.

	* optabs.c (init_traps): If !defined HAVE_conditional_trap, mark
	parameters `code', `op2' and `tcode' with ATTRIBUTE_UNUSED.

	* real.c (edivm): Cast constant value to (unsigned long) in
	expression compared against an unsigned value.

	* stmt.c (expand_return): Cast BITS_PER_WORD to (unsigned) when
	comparing against one.
	(expand_end_case): Cast CASE_VALUES_THRESHOLD to (unsigned int)
	when comparing against one.

	* stor-layout.c (mode_for_size): Cast MAX_FIXED_MODE_SIZE to
	(unsigned int) when comparing against one.  Likewise for
	GET_MODE_BITSIZE.
	(smallest_mode_for_size): Likewise.
	(save_storage_status): Mark parameter `p' with ATTRIBUTE_UNUSED.
	(restore_storage_status): Likewise.
	
	* toplev.c (debug_args): Add missing initializer.
	(f_options): Spelling correction.  Add missing initializers.
	(documented_lang_options): Likewise.
	(debug_end_source_file): Ifndef DWARF_DEBUGGING_INFO, mark
	parameter `lineno' with ATTRIBUTE_UNUSED.

	* tree.c (valid_machine_attribute): Mark parameters `attr_args',
	`decl' and `type' with ATTRIBUTE_UNUSED upon appropriate macro
	conditions.

	* varasm.c (decode_reg_name): Cast `sizeof' expression to (int)
	when comparing against one.
	(assemble_variable): Mark parameter `top_level' with
	ATTRIBUTE_UNUSED upon appropriate macro conditions.
	(assemble_external_libcall): Ifndef ASM_OUTPUT_EXTERNAL_LIBCALL,
	mark parameter `fun' with ATTRIBUTE_UNUSED.
	(output_constant_pool): If defined(ASM_OUTPUT_POOL_PROLOGUE) ||
	defined (ASM_OUTPUT_POOL_EPILOGUE), mark parameters `fnname' and
	`fndecl' with ATTRIBUTE_UNUSED.
	
diff -rup orig/egcs-CVS19981011/gcc/expr.c egcs-CVS19981011/gcc/expr.c
--- orig/egcs-CVS19981011/gcc/expr.c	Sun Oct 11 12:40:35 1998
+++ egcs-CVS19981011/gcc/expr.c	Sun Oct 11 20:36:05 1998
@@ -2101,7 +2101,7 @@ copy_blkmode_from_reg(tgtblk,srcreg,type
 {
       int bytes = int_size_in_bytes (type);
       rtx src = NULL, dst = NULL;
-      int bitsize = MIN (TYPE_ALIGN (type), BITS_PER_WORD);
+      int bitsize = MIN (TYPE_ALIGN (type), (unsigned int) BITS_PER_WORD);
       int bitpos, xbitpos, big_endian_correction = 0;
       
       if (tgtblk == 0)
@@ -4703,7 +4703,7 @@ get_inner_reference (exp, pbitsize, pbit
   tree size_tree = 0;
   enum machine_mode mode = VOIDmode;
   tree offset = integer_zero_node;
-  int alignment = BIGGEST_ALIGNMENT;
+  unsigned int alignment = BIGGEST_ALIGNMENT;
 
   if (TREE_CODE (exp) == COMPONENT_REF)
     {
@@ -6456,7 +6456,7 @@ expand_expr (exp, target, tmode, modifie
 		    /* If the field isn't aligned enough to fetch as a memref,
 		       fetch it as a bit field.  */
 		    || (SLOW_UNALIGNED_ACCESS
-			&& ((TYPE_ALIGN (TREE_TYPE (tem)) < GET_MODE_ALIGNMENT (mode))
+			&& ((TYPE_ALIGN (TREE_TYPE (tem)) < (unsigned int) GET_MODE_ALIGNMENT (mode))
 			    || (bitpos % GET_MODE_ALIGNMENT (mode) != 0))))))
 	  {
 	    enum machine_mode ext_mode = mode;
@@ -8416,7 +8416,7 @@ expand_builtin_setjmp (buf_addr, target,
   if (fixed_regs[ARG_POINTER_REGNUM])
     {
 #ifdef ELIMINABLE_REGS
-      int i;
+      size_t i;
       static struct elims {int from, to;} elim_regs[] = ELIMINABLE_REGS;
 
       for (i = 0; i < sizeof elim_regs / sizeof elim_regs[0]; i++)
diff -rup orig/egcs-CVS19981011/gcc/fold-const.c egcs-CVS19981011/gcc/fold-const.c
--- orig/egcs-CVS19981011/gcc/fold-const.c	Sun Oct 11 12:40:39 1998
+++ egcs-CVS19981011/gcc/fold-const.c	Sun Oct 11 19:48:08 1998
@@ -529,7 +529,7 @@ div_and_round_double (code, uns,
   encode (den, lden, hden);
 
   /* Special code for when the divisor < BASE.  */
-  if (hden == 0 && lden < BASE)
+  if (hden == 0 && lden < (HOST_WIDE_INT) BASE)
     {
       /* hnum != 0 already checked.  */
       for (i = 4 - 1; i >= 0; i--)
diff -rup orig/egcs-CVS19981011/gcc/gencheck.c egcs-CVS19981011/gcc/gencheck.c
--- orig/egcs-CVS19981011/gcc/gencheck.c	Sun Oct 11 12:44:34 1998
+++ egcs-CVS19981011/gcc/gencheck.c	Sun Oct 11 17:59:47 1998
@@ -20,6 +20,7 @@ Boston, MA 02111-1307, USA.  */
 
 #include "hconfig.h"
 #include "system.h"
+#include "gansidecl.h"
 
 #define DEFTREECODE(SYM, NAME, TYPE, LEN)   STRINGIFY(SYM),
 
@@ -36,7 +37,7 @@ void usage ()
 
 int main (argc, argv)
      int argc;
-     char *argv[];
+     char *argv[] ATTRIBUTE_UNUSED;
 {
   int i;
 
diff -rup orig/egcs-CVS19981011/gcc/optabs.c egcs-CVS19981011/gcc/optabs.c
--- orig/egcs-CVS19981011/gcc/optabs.c	Sun Oct 11 12:41:31 1998
+++ egcs-CVS19981011/gcc/optabs.c	Sun Oct 11 21:34:49 1998
@@ -4451,8 +4451,14 @@ init_traps ()
 
 rtx
 gen_cond_trap (code, op1, op2, tcode)
-     enum rtx_code code;
-     rtx op1, op2, tcode;
+  rtx op1;
+#ifdef HAVE_conditional_trap
+  enum rtx_code code;
+  rtx op2, tcode;
+#else
+  enum rtx_code code ATTRIBUTE_UNUSED;
+  rtx op2 ATTRIBUTE_UNUSED, tcode ATTRIBUTE_UNUSED;
+#endif
 {
   enum machine_mode mode = GET_MODE (op1);
 
diff -rup orig/egcs-CVS19981011/gcc/real.c egcs-CVS19981011/gcc/real.c
--- orig/egcs-CVS19981011/gcc/real.c	Sun Oct 11 12:41:32 1998
+++ egcs-CVS19981011/gcc/real.c	Sun Oct 11 23:33:49 1998
@@ -2333,7 +2333,7 @@ edivm (den, num)
       tnum = (((unsigned EMULONG) num[M]) << 16) + num[M+1];
 
       /* Do not execute the divide instruction if it will overflow.  */
-      if ((tdenm * 0xffffL) < tnum)
+      if ((tdenm * (unsigned long)0xffff) < tnum)
 	tquot = 0xffff;
       else
 	tquot = tnum / tdenm;
diff -rup orig/egcs-CVS19981011/gcc/stmt.c egcs-CVS19981011/gcc/stmt.c
--- orig/egcs-CVS19981011/gcc/stmt.c	Sun Oct 11 12:41:36 1998
+++ egcs-CVS19981011/gcc/stmt.c	Sun Oct 11 20:10:53 1998
@@ -2630,7 +2630,8 @@ expand_return (retval)
       int big_endian_correction = 0;
       int bytes = int_size_in_bytes (TREE_TYPE (retval_rhs));
       int n_regs = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
-      int bitsize = MIN (TYPE_ALIGN (TREE_TYPE (retval_rhs)),BITS_PER_WORD);
+      int bitsize = MIN (TYPE_ALIGN (TREE_TYPE (retval_rhs)),
+			 (unsigned int)BITS_PER_WORD);
       rtx *result_pseudos = (rtx *) alloca (sizeof (rtx) * n_regs);
       rtx result_reg, src = NULL_RTX, dst = NULL_RTX;
       rtx result_val = expand_expr (retval_rhs, NULL_RTX, VOIDmode, 0);
@@ -4899,7 +4900,7 @@ expand_end_case (orig_index)
 #endif /* CASE_VALUES_THRESHOLD */
 
       else if (TREE_INT_CST_HIGH (range) != 0
-	       || count < CASE_VALUES_THRESHOLD
+	       || count < (unsigned int) CASE_VALUES_THRESHOLD
 	       || ((unsigned HOST_WIDE_INT) (TREE_INT_CST_LOW (range))
 		   > 10 * count)
 #ifndef ASM_OUTPUT_ADDR_DIFF_ELT
diff -rup orig/egcs-CVS19981011/gcc/stor-layout.c egcs-CVS19981011/gcc/stor-layout.c
--- orig/egcs-CVS19981011/gcc/stor-layout.c	Sun Oct 11 12:41:37 1998
+++ egcs-CVS19981011/gcc/stor-layout.c	Sun Oct 11 19:45:07 1998
@@ -144,13 +144,13 @@ mode_for_size (size, class, limit)
 {
   register enum machine_mode mode;
 
-  if (limit && size > MAX_FIXED_MODE_SIZE)
+  if (limit && size > (unsigned int)(MAX_FIXED_MODE_SIZE))
     return BLKmode;
 
   /* Get the first mode which has this size, in the specified class.  */
   for (mode = GET_CLASS_NARROWEST_MODE (class); mode != VOIDmode;
        mode = GET_MODE_WIDER_MODE (mode))
-    if (GET_MODE_BITSIZE (mode) == size)
+    if ((unsigned int)GET_MODE_BITSIZE (mode) == size)
       return mode;
 
   return BLKmode;
@@ -170,7 +170,7 @@ smallest_mode_for_size (size, class)
      specified class.  */
   for (mode = GET_CLASS_NARROWEST_MODE (class); mode != VOIDmode;
        mode = GET_MODE_WIDER_MODE (mode))
-    if (GET_MODE_BITSIZE (mode) >= size)
+    if ((unsigned int)GET_MODE_BITSIZE (mode) >= size)
       return mode;
 
   abort ();
@@ -1382,7 +1382,7 @@ get_best_mode (bitsize, bitpos, align, l
 
 void
 save_storage_status (p)
-     struct function *p;
+     struct function *p ATTRIBUTE_UNUSED;
 {
 #if 0  /* Need not save, since always 0 and non0 (resp.) within a function.  */
   p->pending_sizes = pending_sizes;
@@ -1395,7 +1395,7 @@ save_storage_status (p)
 
 void
 restore_storage_status (p)
-     struct function *p;
+     struct function *p ATTRIBUTE_UNUSED;
 {
 #if 0
   pending_sizes = p->pending_sizes;
diff -rup orig/egcs-CVS19981011/gcc/toplev.c egcs-CVS19981011/gcc/toplev.c
--- orig/egcs-CVS19981011/gcc/toplev.c	Mon Oct 12 00:30:56 1998
+++ egcs-CVS19981011/gcc/toplev.c	Sun Oct 11 19:01:54 1998
@@ -762,7 +762,7 @@ debug_args[] =
 #ifdef SDB_DEBUGGING_INFO
   { "gcoff", SDB_DEBUG, 0, "Generate COFF format debug output" },
 #endif
-  { 0, 0, 0 }
+  { 0, 0, 0, 0 }
 };
 
 typedef struct
@@ -896,8 +896,9 @@ lang_independent_options f_options[] =
   {"gnu-linker", &flag_gnu_linker, 1,
    "Output GNU ld formatted global initialisers"},
   {"regmove", &flag_regmove, 1,
-   "Enables a regoster move optimisation"},
-  {"optimize-register-move", &flag_regmove, 1},
+   "Enables a register move optimisation"},
+  {"optimize-register-move", &flag_regmove, 1,
+   "Do the full regmove optimization pass"},
   {"pack-struct", &flag_pack_struct, 1,
    "Pack structure members together without holes" },
   {"stack-check", &flag_stack_check, 1,
@@ -914,7 +915,8 @@ lang_independent_options f_options[] =
    "Generate code to check every memory access" },
   {"prefix-function-name", &flag_prefix_function_name, 1,
    "Add a prefix to all function names" },
-  {"dump-unnumbered", &flag_dump_unnumbered, 1},
+  {"dump-unnumbered", &flag_dump_unnumbered, 1,
+   "Suppress output of instruction numbers and line number notes in debugging dumps"},
   {"instrument-functions", &flag_instrument_function_entry_exit, 1,
    "Instrument function entry/exit with profiling calls"},
 };
@@ -981,9 +983,9 @@ documented_lang_options[] =
   { "-Wchar-subscripts", "Warn about subscripts whose type is 'char'"},
   { "-Wno-char-subscripts", "" },
   { "-Wcomment", "Warn if nested comments are detected" },
-  { "-Wno-comment", },
-  { "-Wcomments", },
-  { "-Wno-comments", },
+  { "-Wno-comment", "" },
+  { "-Wcomments", "Warn if nested comments are detected" },
+  { "-Wno-comments", "" },
   { "-Wconversion", "Warn about possibly confusing type conversions" },
   { "-Wno-conversion", "" },
   { "-Wformat", "Warn about printf format anomalies" },
@@ -5087,7 +5089,11 @@ debug_start_source_file (filename)
 
 void
 debug_end_source_file (lineno)
-     register unsigned lineno;
+     register unsigned lineno
+#ifndef DWARF_DEBUGGING_INFO
+  ATTRIBUTE_UNUSED
+#endif
+  ;
 {
 #ifdef DBX_DEBUGGING_INFO
   if (write_symbols == DBX_DEBUG)
diff -rup orig/egcs-CVS19981011/gcc/tree.c egcs-CVS19981011/gcc/tree.c
--- orig/egcs-CVS19981011/gcc/tree.c	Sun Oct 11 12:41:38 1998
+++ egcs-CVS19981011/gcc/tree.c	Sun Oct 11 19:23:13 1998
@@ -3332,9 +3332,20 @@ build_type_attribute_variant (ttype, att
 
 int
 valid_machine_attribute (attr_name, attr_args, decl, type)
-     tree attr_name, attr_args;
-     tree decl;
-     tree type;
+  tree attr_name,
+  attr_args
+#if !defined(VALID_MACHINE_DECL_ATTRIBUTE) && !defined(VALID_MACHINE_TYPE_ATTRIBUTE)
+  ATTRIBUTE_UNUSED
+#endif
+  ,decl
+#if !defined(VALID_MACHINE_DECL_ATTRIBUTE) && !defined(VALID_MACHINE_TYPE_ATTRIBUTE)
+  ATTRIBUTE_UNUSED
+#endif
+  ,type
+#ifndef VALID_MACHINE_TYPE_ATTRIBUTE
+  ATTRIBUTE_UNUSED
+#endif
+  ;
 {
   int valid = 0;
 #ifdef VALID_MACHINE_DECL_ATTRIBUTE
diff -rup orig/egcs-CVS19981011/gcc/varasm.c egcs-CVS19981011/gcc/varasm.c
--- orig/egcs-CVS19981011/gcc/varasm.c	Sun Oct 11 12:41:39 1998
+++ egcs-CVS19981011/gcc/varasm.c	Sun Oct 11 21:48:59 1998
@@ -595,7 +595,7 @@ decode_reg_name (asmspec)
 	static struct { char *name; int number; } table[]
 	  = ADDITIONAL_REGISTER_NAMES;
 
-	for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
+	for (i = 0; i < (int)(sizeof (table) / sizeof (table[0])); i++)
 	  if (! strcmp (asmspec, table[i].name))
 	    return table[i].number;
       }
@@ -1133,7 +1133,11 @@ assemble_string (p, size)
 void
 assemble_variable (decl, top_level, at_end, dont_output_data)
      tree decl;
-     int top_level;
+     int top_level
+#if !defined(SDB_DEBUGGING_INFO) && !defined(DBX_DEBUGGING_INFO) && !defined(XCOFF_DEBUGGING_INFO)
+  ATTRIBUTE_UNUSED
+#endif
+  ;
      int at_end;
      int dont_output_data;
 {
@@ -1606,7 +1610,11 @@ assemble_external (decl)
 
 void
 assemble_external_libcall (fun)
-     rtx fun;
+     rtx fun
+#ifndef ASM_OUTPUT_EXTERNAL_LIBCALL
+  ATTRIBUTE_UNUSED
+#endif
+  ;
 {
 #ifdef ASM_OUTPUT_EXTERNAL_LIBCALL
   /* Declare library function name external when first used, if nec.  */
@@ -3570,8 +3578,13 @@ get_pool_size ()
 
 void
 output_constant_pool (fnname, fndecl)
-     char *fnname;
-     tree fndecl;
+#if defined(ASM_OUTPUT_POOL_PROLOGUE) || defined (ASM_OUTPUT_POOL_EPILOGUE)
+  char *fnname;
+  tree fndecl;
+#else
+  char *fnname ATTRIBUTE_UNUSED;
+  tree fndecl ATTRIBUTE_UNUSED;
+#endif
 {
   struct pool_constant *pool;
   rtx x;



More information about the Gcc-patches mailing list