Patch for java dir warnings

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Fri Apr 27 19:11:00 GMT 2001


The number of warnings in the java dir has crept up again.  This patch
squelches the following nits.

typeck.c:584: warning: function declaration isn't a prototype
typeck.c:584: warning: unused parameter `type'
verify.c:414: warning: `message' might be used uninitialized in this function
jcf-io.c:195: warning: comparison between signed and unsigned
jcf-io.c:216: warning: comparison between signed and unsigned
mangle.c:317: warning: `saved_current' might be used uninitialized in this function
jvspec.c:128: warning: `filelist_filename' might be used uninitialized in this function
jvspec.c:130: warning: `filelist_file' might be used uninitialized in this function


Only this one remains:

jvspec.c:70: warning: string length `756' is greater than the length `509' ISO C89 compilers are required to support


Bootstrapped on the trunk and the branch on solaris2.7 (both have
identical warning profiles for java.)

Ok to install on both?

		Thanks,
		--Kaveh


2001-04-27  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* jcf-io.c (read_zip_member): Cast to long in comparison with
	signed value.

	* jvspec.c (lang_specific_driver): Initialize variables.

	* mangle.c (find_compression_record_match): Likewise.

	* typeck.c (build_null_signature): Provide static prototype.  Mark
	parameter with ATTRIBUTE_UNUSED.

	* verify.c (verify_jvm_instructions): Initialize variable.

diff -rup orig/egcs-CVS20010426/gcc/java/jcf-io.c egcs-CVS20010426/gcc/java/jcf-io.c
--- orig/egcs-CVS20010426/gcc/java/jcf-io.c	Sun Jan 21 16:50:36 2001
+++ egcs-CVS20010426/gcc/java/jcf-io.c	Fri Apr 27 11:16:13 2001
@@ -192,7 +192,7 @@ DEFUN(read_zip_member, (jcf, zipd, zipf)
 	      jcf->read_ptr = jcf->buffer;
 	      jcf->read_end = jcf->buffer_end;
 	      if (lseek (zipf->fd, zipd->filestart, 0) < 0
-		  || read (zipf->fd, jcf->buffer, zipd->size) != zipd->size)
+		  || read (zipf->fd, jcf->buffer, zipd->size) != (long) zipd->size)
 	        return -2;
 	    }
 	  else
@@ -213,7 +213,7 @@ DEFUN(read_zip_member, (jcf, zipd, zipf)
 	      d_stream.next_in = buffer;
 	      d_stream.avail_in = zipd->size;
 	      if (lseek (zipf->fd, zipd->filestart, 0) < 0
-		  || read (zipf->fd, buffer, zipd->size) != zipd->size)
+		  || read (zipf->fd, buffer, zipd->size) != (long) zipd->size)
 		return -2;
 	      /* Handle NO_HEADER using undocumented zlib feature.
                  This is a very common hack.  */
diff -rup orig/egcs-CVS20010426/gcc/java/jvspec.c egcs-CVS20010426/gcc/java/jvspec.c
--- orig/egcs-CVS20010426/gcc/java/jvspec.c	Sun Apr 22 20:17:13 2001
+++ egcs-CVS20010426/gcc/java/jvspec.c	Fri Apr 27 11:08:30 2001
@@ -126,9 +126,9 @@ lang_specific_driver (in_argc, in_argv, 
   int indirect_files_count = 0;
 
   /* Name of file containing list of files to compile. */
-  char *filelist_filename;
+  char *filelist_filename = 0;
 
-  FILE *filelist_file;
+  FILE *filelist_file = 0;
 
   /* The number of arguments being added to what's in argv, other than
      libraries.  */
diff -rup orig/egcs-CVS20010426/gcc/java/mangle.c egcs-CVS20010426/gcc/java/mangle.c
--- orig/egcs-CVS20010426/gcc/java/mangle.c	Thu Mar 15 17:06:12 2001
+++ egcs-CVS20010426/gcc/java/mangle.c	Fri Apr 27 11:00:52 2001
@@ -314,7 +314,7 @@ find_compression_record_match (type, nex
      tree *next_current;
 {
   int i, match;
-  tree current, saved_current;
+  tree current, saved_current = NULL_TREE;
 
   /* Search from the beginning for something that matches TYPE, even
      partially. */
diff -rup orig/egcs-CVS20010426/gcc/java/typeck.c egcs-CVS20010426/gcc/java/typeck.c
--- orig/egcs-CVS20010426/gcc/java/typeck.c	Thu Apr 26 16:30:40 2001
+++ egcs-CVS20010426/gcc/java/typeck.c	Fri Apr 27 10:47:02 2001
@@ -40,6 +40,7 @@ static tree convert_ieee_real_to_integer
 static tree parse_signature_type PARAMS ((const unsigned char **,
 					 const unsigned char *));
 static tree lookup_do PARAMS ((tree, tree, tree, tree, tree (*)(tree)));
+static tree build_null_signature PARAMS ((tree));
 
 tree * type_map;
 extern struct obstack permanent_obstack;
@@ -579,9 +580,9 @@ get_type_from_signature (tree signature)
   return type;
 }
 
-tree
+static tree
 build_null_signature (type)
-     tree type;
+     tree type ATTRIBUTE_UNUSED;
 {
   return NULL_TREE;
 }
diff -rup orig/egcs-CVS20010426/gcc/java/verify.c egcs-CVS20010426/gcc/java/verify.c
--- orig/egcs-CVS20010426/gcc/java/verify.c	Thu Apr 26 16:30:40 2001
+++ egcs-CVS20010426/gcc/java/verify.c	Fri Apr 27 10:51:18 2001
@@ -411,7 +411,7 @@ verify_jvm_instructions (jcf, byte_ops, 
   int PC;
   int oldpc = 0; /* PC of start of instruction. */
   int prevpc = 0;  /* If >= 0, PC of previous instruction. */
-  const char *message;
+  const char *message = 0;
   char *pmessage;
   int i;
   int index;



More information about the Gcc-patches mailing list