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]
Other format: [Raw text]

Patch installed for various cross-compile warnings


This patch zaps the following warnings on various cross-targets.

< config/dsp16xx/dsp16xx.c:1925: warning: `base' might be used uninitialized in this function
< config/rs6000/rs6000.c:683: warning: function declaration isn't a prototype
< config/s390/s390.c:2004: warning: operation on `insn_addresses_' may be undefined
< config/s390/s390.c:2042: warning: operation on `insn_addresses_' may be undefined
< config/s390/s390.c:2079: warning: operation on `insn_addresses_' may be undefined
< config/s390/s390.c:2183: warning: operation on `insn_addresses_' may be undefined
< config/s390/s390.c:2195: warning: operation on `insn_addresses_' may be undefined
< config/s390/s390.c:2212: warning: operation on `insn_addresses_' may be undefined
< config/sh/sh.c:903: warning: operation on `insn_addresses_' may be undefined
< config/sh/sh.c:924: warning: operation on `insn_addresses_' may be undefined
< dbxout.c:569: warning: unused variable `ltext_label_name'
< final.c:1603: warning: unused parameter `file'
< final.c:1650: warning: initialization discards qualifiers from pointer target type
< final.c:3482: warning: `return' with a value, in function returning void
< insn-attrtab.c:10765: warning: function `s8bit_cint_operand' was previously declared within a block
< insn-attrtab.c:1649: warning: implicit declaration of function `s8bit_cint_operand'
< insn-attrtab.c:2746: warning: function `s8bit_cint_operand' was previously declared within a block
< insn-attrtab.c:3214: warning: function `s8bit_cint_operand' was previously declared within a block
< insn-attrtab.c:4518: warning: function `s8bit_cint_operand' was previously declared within a block
< insn-attrtab.c:5879: warning: function `s8bit_cint_operand' was previously declared within a block
< insn-attrtab.c:8994: warning: function `s8bit_cint_operand' was previously declared within a block
< insn-attrtab.c:9262: warning: function `s8bit_cint_operand' was previously declared within a block
< insn-attrtab.c:9838: warning: function `s8bit_cint_operand' was previously declared within a block
< insn-emit.c:1329: warning: unused variable `operand4'
< insn-emit.c:544: warning: unused variable `operand2'
< insn-emit.c:545: warning: unused variable `operand3'
< insn-output.c:332: warning: `istr' might be used uninitialized in this function
< insn-output.c:356: warning: (near initialization for `alt[0]')
< insn-output.c:356: warning: missing braces around initializer
< insn-output.c:681: warning: (near initialization for `alt[0]')
< insn-output.c:681: warning: missing braces around initializer
< regclass.c:159: warning: (near initialization for `int_reg_class_contents[0]')
< regclass.c:159: warning: missing braces around initializer
< reload1.c:3319: warning: `t' might be used uninitialized in this function

The "uninitialized" warnings were fixed by adding appropriate aborts
in execution paths.  The rest are obvious by inspection except
possibly two cases:

1.  The "operation undefined" warnings resulted from macro expansion
    from insn-addr.h which yielded "var = var = x".  Removing one
    layer of assignment fixed that.

2.  The "return with value in function returning void" warning
    resulted from the definition of OUTPUT_ADDR_CONST_EXTRA which
    issued a return where none was necessary or allowed.

Tested by cross-compiling cc1 to the following targets and installed
as obvious.

		--Kaveh

1750a-unknown-elf alpha-dec-vms dsp16xx-unknown-elf i386-unknown-osf1
ia64-unknown-aix ia64-unknown-elf ia64-unknown-freebsd6
ia64-unknown-hpux ia64-unknown-linux-gnu rs6000-bull-bosx
rs6000-ibm-aix rs6000-ibm-aix3.0 rs6000-ibm-aix3.2.4 rs6000-ibm-aix4.1
rs6000-ibm-aix4.3 rs6000-ibm-aix5.0 rs6000-unknown-lynxos
rs6000-unknown-mach powerpc-chorusos powerpc-unknown-beos
powerpc-unknown-darwin powerpc-unknown-eabi powerpc-unknown-eabiaix
powerpc-unknown-eabisim powerpc-unknown-elf powerpc-unknown-linux-gnu
powerpc-unknown-linux-gnulibc1 powerpc-unknown-netbsd
powerpc-unknown-rtems powerpc-unknown-sysv powerpc-wrs-vxworks
powerpc64-unknown-linux-gnu powerpcle-unknown-eabi
powerpcle-unknown-eabisim powerpcle-unknown-elf powerpcle-unknown-sysv
powerpcle-wrs-vxworks xstormy16-unknown-elf v850-unknown-elf
v850-unknown-rtems i860-alliant-bsd hppa1.0-unknown-linux-gnu
hppa64-unknown-linux-gnu romp-unknown-aos romp-unknown-mach
s390-unknown-linux-gnu s390x-unknown-linux-gnu sh-unknown-aout
sh-unknown-elf sh-unknown-linux-gnu sh-unknown-rtems
sh-unknown-rtemself


2001-12-09  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* 1750a.md: Add default case in switch.
	* alpha/vms.h (INITIAL_ELIMINATION_OFFSET): Add abort clause in
	if-else statement.
	* dsp16xx.c (print_operand_address): Likewise.
	* i386/osf1elf.h (FUNCTION_PROFILER): Const-ify.
	* ia64.md: Add missing braces.
	* rs6000-protos.h (s8bit_cint_operand): Prototype.
	* s390.h (INITIAL_ELIMINATION_OFFSET): Add abort clause in
        if-else statement.
	* stormy16.h (REG_CLASS_CONTENTS): Add missing braces.
	* v850.h (OUTPUT_ADDR_CONST_EXTRA): Don't issue a `return'.
	* dbxout.c (dbxout_source_file): Move a variable into the scope
	where it is used.
	* final.c (profile_function): Mark parameter with
	ATTRIBUTE_UNUSED.
	* genemit.c (gen_expand): Likewise for generated file.
	* insn-addr.h (INSN_ADDRESSES_NEW): Avoid undefined behavior.
	
diff -rup orig/egcc-CVS20011207/gcc/config/1750a/1750a.md egcc-CVS20011207/gcc/config/1750a/1750a.md
--- orig/egcc-CVS20011207/gcc/config/1750a/1750a.md	Mon Nov 19 23:34:35 2001
+++ egcc-CVS20011207/gcc/config/1750a/1750a.md	Sun Dec  9 02:25:36 2001
@@ -693,6 +693,8 @@
        case 4:
          istr = \"dv  \";
          break;
+       default:
+         abort();
       }
       return mod_regno_adjust (istr, operands);
      }")
diff -rup orig/egcc-CVS20011207/gcc/config/alpha/vms.h egcc-CVS20011207/gcc/config/alpha/vms.h
--- orig/egcc-CVS20011207/gcc/config/alpha/vms.h	Wed Dec  5 22:09:19 2001
+++ egcc-CVS20011207/gcc/config/alpha/vms.h	Sun Dec  9 02:44:08 2001
@@ -148,6 +148,8 @@ Boston, MA 02111-1307, USA.  */
 			     + get_frame_size ()			\
 			     + current_function_pretend_args_size)	\
 		- current_function_pretend_args_size);			\
+  else									\
+    abort();								\
   if ((TO) == STACK_POINTER_REGNUM)					\
     (OFFSET) += ALPHA_ROUND (current_function_outgoing_args_size);	\
 }
diff -rup orig/egcc-CVS20011207/gcc/config/dsp16xx/dsp16xx.c egcc-CVS20011207/gcc/config/dsp16xx/dsp16xx.c
--- orig/egcc-CVS20011207/gcc/config/dsp16xx/dsp16xx.c	Mon Dec  3 16:30:31 2001
+++ egcc-CVS20011207/gcc/config/dsp16xx/dsp16xx.c	Sun Dec  9 02:48:26 2001
@@ -1941,6 +1941,8 @@ print_operand_address(file, addr)
 	offset = INTVAL(XEXP(addr,0)), base = XEXP(addr,1);
       else if (GET_CODE (XEXP(addr,1)) == CONST_INT)
 	offset = INTVAL(XEXP(addr,1)), base = XEXP(addr,0);
+      else
+	abort();
       if (GET_CODE (base) == REG && REGNO(base) == STACK_POINTER_REGNUM)
 	{
 	  if (offset >= -31 && offset <= 0)
diff -rup orig/egcc-CVS20011207/gcc/config/i386/osf1elf.h egcc-CVS20011207/gcc/config/i386/osf1elf.h
--- orig/egcc-CVS20011207/gcc/config/i386/osf1elf.h	Wed Oct 31 16:30:53 2001
+++ egcc-CVS20011207/gcc/config/i386/osf1elf.h	Sun Dec  9 03:02:55 2001
@@ -153,9 +153,9 @@ do									\
   {									\
     if (!OSF_PROFILE_BEFORE_PROLOGUE)					\
       {									\
-	char *prefix = "";			\
-	char *lprefix = LPREFIX;					\
-	int labelno = LABELNO;					\
+	const char *const prefix = "";					\
+	const char *const lprefix = LPREFIX;				\
+	int labelno = LABELNO;						\
 									\
 	/* Note that OSF/rose blew it in terms of calling mcount,	\
 	   since OSF/rose prepends a leading underscore, but mcount's	\
diff -rup orig/egcc-CVS20011207/gcc/config/ia64/ia64.md egcc-CVS20011207/gcc/config/ia64/ia64.md
--- orig/egcc-CVS20011207/gcc/config/ia64/ia64.md	Tue Dec  4 07:30:45 2001
+++ egcc-CVS20011207/gcc/config/ia64/ia64.md	Sun Dec  9 03:07:46 2001
@@ -5057,14 +5057,18 @@
   ""
 {
   static const char * const alt[2][4] = {
-    "lfetch.nta [%0]",
-    "lfetch.nt1 [%0]",
-    "lfetch.nt2 [%0]",
-    "lfetch [%0]",
-    "lfetch.excl.nta [%0]",
-    "lfetch.excl.nt1 [%0]",
-    "lfetch.excl.nt2 [%0]",
-    "lfetch.excl [%0]"
+    {
+      "lfetch.nta [%0]",
+      "lfetch.nt1 [%0]",
+      "lfetch.nt2 [%0]",
+      "lfetch [%0]"
+    },
+    {
+      "lfetch.excl.nta [%0]",
+      "lfetch.excl.nt1 [%0]",
+      "lfetch.excl.nt2 [%0]",
+      "lfetch.excl [%0]"
+    }
   };
   int i = (INTVAL (operands[1]));
   int j = (INTVAL (operands[2]));
diff -rup orig/egcc-CVS20011207/gcc/config/rs6000/rs6000-protos.h egcc-CVS20011207/gcc/config/rs6000/rs6000-protos.h
--- orig/egcc-CVS20011207/gcc/config/rs6000/rs6000-protos.h	Sat Nov  3 21:39:02 2001
+++ egcc-CVS20011207/gcc/config/rs6000/rs6000-protos.h	Sun Dec  9 01:36:32 2001
@@ -70,6 +70,7 @@ extern int call_operand PARAMS ((rtx, en
 extern int current_file_function_operand PARAMS ((rtx, enum machine_mode));
 extern int input_operand PARAMS ((rtx, enum machine_mode));
 extern int small_data_operand PARAMS ((rtx, enum machine_mode));
+extern int s8bit_cint_operand PARAMS ((rtx, enum machine_mode));
 extern int constant_pool_expr_p PARAMS ((rtx));
 extern int toc_relative_expr_p PARAMS ((rtx));
 extern int expand_block_move PARAMS ((rtx[]));
diff -rup orig/egcc-CVS20011207/gcc/config/s390/s390.h egcc-CVS20011207/gcc/config/s390/s390.h
--- orig/egcc-CVS20011207/gcc/config/s390/s390.h	Thu Dec  6 07:30:28 2001
+++ egcc-CVS20011207/gcc/config/s390/s390.h	Sun Dec  9 02:44:00 2001
@@ -395,6 +395,8 @@ while (0)
   { (OFFSET) = s390_arg_frame_offset (); }     				  \
   else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM)  \
   { (OFFSET) = s390_arg_frame_offset (); }     				  \
+  else									  \
+    abort();								  \
 }
 
 #define CAN_DEBUG_WITHOUT_FP
diff -rup orig/egcc-CVS20011207/gcc/config/stormy16/stormy16.h egcc-CVS20011207/gcc/config/stormy16/stormy16.h
--- orig/egcc-CVS20011207/gcc/config/stormy16/stormy16.h	Thu Dec  6 07:30:30 2001
+++ egcc-CVS20011207/gcc/config/stormy16/stormy16.h	Sun Dec  9 03:17:12 2001
@@ -1234,17 +1234,17 @@ enum reg_class
    `hard-reg-set.h'.  */
 #define REG_CLASS_CONTENTS			\
 {						\
-  0x00000,					\
-  0x00001,					\
-  0x00002,					\
-  0x00003,					\
-  0x00004,					\
-  0x000FF,					\
-  0x00100,					\
-  0x00300,					\
-  0x6FFFF,					\
-  0x10000,					\
-  (1 << FIRST_PSEUDO_REGISTER) - 1		\
+  { 0x00000 },					\
+  { 0x00001 },					\
+  { 0x00002 },					\
+  { 0x00003 },					\
+  { 0x00004 },					\
+  { 0x000FF },					\
+  { 0x00100 },					\
+  { 0x00300 },					\
+  { 0x6FFFF },					\
+  { 0x10000 },					\
+  { (1 << FIRST_PSEUDO_REGISTER) - 1 }		\
 }
 
 /* A C expression whose value is a register class containing hard register
diff -rup orig/egcc-CVS20011207/gcc/config/v850/v850.h egcc-CVS20011207/gcc/config/v850/v850.h
--- orig/egcc-CVS20011207/gcc/config/v850/v850.h	Wed Nov 21 21:12:05 2001
+++ egcc-CVS20011207/gcc/config/v850/v850.h	Sun Dec  9 03:53:15 2001
@@ -1254,7 +1254,7 @@ do {									\
 
 #define OUTPUT_ADDR_CONST_EXTRA(FILE, X, FAIL)		\
   if (GET_CODE (x) == TRUNCATE)				\
-    return output_addr_const (FILE, XEXP (X, 0));	\
+    output_addr_const (FILE, XEXP (X, 0));		\
   else							\
     goto FAIL;
 
diff -rup orig/egcc-CVS20011207/gcc/dbxout.c egcc-CVS20011207/gcc/dbxout.c
--- orig/egcc-CVS20011207/gcc/dbxout.c	Fri Nov 30 16:30:30 2001
+++ egcc-CVS20011207/gcc/dbxout.c	Sun Dec  9 01:54:54 2001
@@ -566,13 +566,13 @@ dbxout_source_file (file, filename)
      FILE *file;
      const char *filename;
 {
-  char ltext_label_name[100];
-
   if (filename && (lastfile == 0 || strcmp (filename, lastfile)))
     {
 #ifdef DBX_OUTPUT_SOURCE_FILENAME
       DBX_OUTPUT_SOURCE_FILENAME (file, filename);
 #else
+      char ltext_label_name[100];
+
       ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext",
 				   source_label_number);
       fprintf (file, "%s", ASM_STABS_OP);
diff -rup orig/egcc-CVS20011207/gcc/final.c egcc-CVS20011207/gcc/final.c
--- orig/egcc-CVS20011207/gcc/final.c	Fri Dec  7 15:08:43 2001
+++ egcc-CVS20011207/gcc/final.c	Sun Dec  9 01:56:46 2001
@@ -1600,7 +1600,7 @@ profile_after_prologue (file)
 
 static void
 profile_function (file)
-     FILE *file;
+     FILE *file ATTRIBUTE_UNUSED;
 {
 #ifndef NO_PROFILE_COUNTERS
   int align = MIN (BIGGEST_ALIGNMENT, LONG_TYPE_SIZE);
diff -rup orig/egcc-CVS20011207/gcc/genemit.c egcc-CVS20011207/gcc/genemit.c
--- orig/egcc-CVS20011207/gcc/genemit.c	Sat Dec  1 20:50:07 2001
+++ egcc-CVS20011207/gcc/genemit.c	Sun Dec  9 02:09:56 2001
@@ -464,7 +464,7 @@ gen_expand (expand)
   for (i = operands; i <= max_dup_opno; i++)
     printf ("  rtx operand%d;\n", i);
   for (; i <= max_scratch_opno; i++)
-    printf ("  rtx operand%d;\n", i);
+    printf ("  rtx operand%d ATTRIBUTE_UNUSED;\n", i);
   printf ("  rtx _val = 0;\n");
   printf ("  start_sequence ();\n");
 
diff -rup orig/egcc-CVS20011207/gcc/insn-addr.h egcc-CVS20011207/gcc/insn-addr.h
--- orig/egcc-CVS20011207/gcc/insn-addr.h	Wed Aug 22 16:30:42 2001
+++ egcc-CVS20011207/gcc/insn-addr.h	Sun Dec  9 01:42:39 2001
@@ -41,7 +41,7 @@ extern int insn_current_address;
     if (INSN_ADDRESSES_SET_P ())					\
       {									\
 	if (INSN_ADDRESSES_SIZE () <= insn_uid__)			\
-	  insn_addresses_ = VARRAY_GROW (insn_addresses_, insn_uid__ + 1); \
+	  VARRAY_GROW (insn_addresses_, insn_uid__ + 1);		\
 	INSN_ADDRESSES (insn_uid__) = insn_addr__;			\
       }									\
   }									\


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