Java warning patches part 1/2

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Wed Feb 17 20:02:00 GMT 1999


Wed Feb 17 22:40:57 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* Makefile.in (jcf-parse.o): Depend on $(PARSE_H).
	(parse-scan.o): Depend on toplev.h.

	* class.c (make_method_value): Add prototype.  Make it static.
  	Remove unused second argument, caller changed.

	* expr.c (java_lang_expand_expr): Remove unused variable
	`return_label'.

	* java-tree.h: Don't prototype find_in_current_zip.
	Add prototypes for verify_constant_pool, start_java_method,
	end_java_method, give_name_to_locals, expand_byte_code,
	open_in_zip, set_constant_value, find_constant1, find_constant2,
	find_utf8_constant, find_string_constant, find_class_constant,
	find_fieldref_index, find_methodref_index, write_constant_pool,
	count_constant_pool_bytes and encode_newarray_type.

	* jcf-dump.c: Remove unused variable `LONG_temp'.

	* jcf-parse.c: Include parse.h.
	(jcf_parse_source): Remove unused parameter, all callers changed.
	(jcf_figure_file_type): Add static prototype.
	(find_in_current_zip): Likewise.  Also remove unused parameter,
	all callers changed.
	(read_class): Initialize variable `saved_pos'.


diff -rup orig/egcs-CVS19990215/gcc/java/Makefile.in egcs-CVS19990215/gcc/java/Makefile.in
--- orig/egcs-CVS19990215/gcc/java/Makefile.in	Mon Feb 15 18:46:49 1999
+++ egcs-CVS19990215/gcc/java/Makefile.in	Tue Feb 16 15:38:08 1999
@@ -300,7 +300,7 @@ jcf-depend.o : jcf-depend.c $(CONFIG_H) 
 jcf-io.o : jcf-io.c $(CONFIG_H) $(srcdir)/../system.h
 jcf-parse.o : jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) $(srcdir)/../flags.h \
   $(srcdir)/../input.h java-except.h $(srcdir)/../system.h \
-  $(srcdir)/../toplev.h
+  $(srcdir)/../toplev.h $(PARSE_H)
 jcf-write.o : jcf-write.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(RTL_H) \
   java-opcodes.h parse.h buffer.h $(srcdir)/../system.h $(srcdir)/../toplev.h
 jv-scan.o : jv-scan.c $(CONFIG_H) $(srcdir)/../system.h
@@ -309,7 +309,7 @@ lang.o : lang.c $(CONFIG_H) $(JAVA_TREE_
   $(srcdir)/../toplev.h $(srcdir)/../system.h
 mangle.o : mangle.c $(CONFIG_H) jcf.h $(srcdir)/../system.h \
   $(srcdir)/../toplev.h
-parse-scan.o : $(CONFIG_H) $(srcdir)/../system.h
+parse-scan.o : $(CONFIG_H) $(srcdir)/../system.h $(srcdir)/../toplev.h
 typeck.o : typeck.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h convert.h \
   $(srcdir)/../toplev.h $(srcdir)/../system.h
 verify.o : verify.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h javaop.h java-opcodes.h \
diff -rup orig/egcs-CVS19990215/gcc/java/class.c egcs-CVS19990215/gcc/java/class.c
--- orig/egcs-CVS19990215/gcc/java/class.c	Mon Feb 15 18:46:49 1999
+++ egcs-CVS19990215/gcc/java/class.c	Tue Feb 16 15:38:08 1999
@@ -37,6 +37,7 @@ The Free Software Foundation is independ
 #include "parse.h"
 
 static tree mangle_class_field PROTO ((tree class));
+static tree make_method_value PROTO ((tree));
 
 static rtx registerClass_libfunc;
 
@@ -880,10 +881,9 @@ make_field_value (tree fdecl)
   return finit;
 }
 
-tree
-make_method_value (mdecl, this_class_addr)
+static tree
+make_method_value (mdecl)
      tree mdecl;
-     tree this_class_addr;
 {
   tree minit;
   tree code;
@@ -1042,7 +1042,7 @@ make_class_data (type)
       if (METHOD_PRIVATE (method)
 	  && (flag_inline_functions || optimize))
 	continue;
-      init = make_method_value (method, this_class_addr);
+      init = make_method_value (method);
       method_count++;
       methods = tree_cons (NULL_TREE, init, methods);
     }
diff -rup orig/egcs-CVS19990215/gcc/java/expr.c egcs-CVS19990215/gcc/java/expr.c
--- orig/egcs-CVS19990215/gcc/java/expr.c	Mon Feb 15 18:46:52 1999
+++ egcs-CVS19990215/gcc/java/expr.c	Tue Feb 16 15:38:08 1999
@@ -1881,7 +1881,6 @@ java_lang_expand_expr (exp, target, tmod
       for (current = TREE_OPERAND (exp, 1); current; 
 	   current = TREE_CHAIN (current))
 	{
-	  extern rtx return_label;
 	  tree type;
 	  /* If we have a finally, the last exception handler is the
 	     one that is supposed to catch everything. */
diff -rup orig/egcs-CVS19990215/gcc/java/java-tree.h egcs-CVS19990215/gcc/java/java-tree.h
--- orig/egcs-CVS19990215/gcc/java/java-tree.h	Mon Feb 15 18:46:53 1999
+++ egcs-CVS19990215/gcc/java/java-tree.h	Tue Feb 16 15:38:08 1999
@@ -586,9 +586,27 @@ extern int merge_type_state PROTO ((tree
 extern void push_type PROTO ((tree));
 extern void load_type_state PROTO ((tree));
 extern void add_interface PROTO ((tree, tree));
-extern int find_in_current_zip PROTO ((char *, int, struct JCF **));
 extern void append_gpp_mangled_classtype PROTO ((struct obstack *, char *));
 extern void emit_unicode_mangled_name PROTO ((struct obstack *, char *, int));
+extern int verify_constant_pool PROTO ((struct JCF *));
+extern void start_java_method PROTO ((tree));
+extern void end_java_method PROTO ((void));
+extern void give_name_to_locals PROTO ((struct JCF *));
+extern void expand_byte_code PROTO ((struct JCF *, tree));
+extern int open_in_zip PROTO ((struct JCF *, const char *, const char *, int));
+extern void set_constant_value PROTO ((tree, tree));
+#ifdef jword
+extern int find_constant1 PROTO ((struct CPool *, int, jword));
+extern int find_constant2 PROTO ((struct CPool *, int, jword, jword));
+#endif
+extern int find_utf8_constant PROTO ((struct CPool *, tree));
+extern int find_string_constant PROTO ((struct CPool *, tree));
+extern int find_class_constant PROTO ((struct CPool *, tree));
+extern int find_fieldref_index PROTO ((struct CPool *, tree));
+extern int find_methodref_index PROTO ((struct CPool *, tree));
+extern void write_constant_pool PROTO ((struct CPool *, unsigned char *, int));
+extern int count_constant_pool_bytes PROTO ((struct CPool *));
+extern int encode_newarray_type PROTO ((tree));
 
 /* Access flags etc for a method (a FUNCTION_DECL): */
 
diff -rup orig/egcs-CVS19990215/gcc/java/jcf-dump.c egcs-CVS19990215/gcc/java/jcf-dump.c
--- orig/egcs-CVS19990215/gcc/java/jcf-dump.c	Mon Feb 15 18:46:50 1999
+++ egcs-CVS19990215/gcc/java/jcf-dump.c	Tue Feb 16 15:38:09 1999
@@ -913,7 +913,6 @@ DEFUN(disassemble_method, (jcf, byte_ops
     {
       int oldpc = PC;
       int saw_index;
-      jlong LONG_temp;
       jint INT_temp;
       switch (byte_ops[PC++])
 	{
diff -rup orig/egcs-CVS19990215/gcc/java/jcf-parse.c egcs-CVS19990215/gcc/java/jcf-parse.c
--- orig/egcs-CVS19990215/gcc/java/jcf-parse.c	Mon Feb 15 18:46:52 1999
+++ egcs-CVS19990215/gcc/java/jcf-parse.c	Tue Feb 16 15:38:09 1999
@@ -33,6 +33,7 @@ The Free Software Foundation is independ
 #include "input.h"
 #include "java-tree.h"
 #include "toplev.h"
+#include "parse.h"
 
 /* A CONSTANT_Utf8 element is converted to an IDENTIFIER_NODE at parse time. */
 #define JPOOL_UTF(JCF, INDEX) CPOOL_UTF(&(JCF)->cpool, INDEX)
@@ -81,7 +82,9 @@ static tree give_name_to_class PROTO ((J
 void parse_zip_file_entries PROTO (());
 void process_zip_dir PROTO (());
 static void parse_source_file PROTO ((tree));
-static void jcf_parse_source PROTO ((JCF *));
+static void jcf_parse_source PROTO ((void));
+static int jcf_figure_file_type PROTO ((JCF *));
+static int find_in_current_zip PROTO ((char *, struct JCF **));
 
 /* Handle "SourceFile" attribute. */
 
@@ -463,15 +466,14 @@ read_class (name)
   tree save_current_class = current_class;
   char *save_input_filename = input_filename;
   JCF *save_current_jcf = current_jcf;
-  long saved_pos;
+  long saved_pos = 0;
   if (current_jcf->read_state)
     saved_pos = ftell (current_jcf->read_state);
 
   push_obstacks (&permanent_obstack, &permanent_obstack);
 
   /* Search in current zip first.  */
-  if (find_in_current_zip (IDENTIFIER_POINTER (name),
-			   IDENTIFIER_LENGTH (name), &jcf) == 0)
+  if (find_in_current_zip (IDENTIFIER_POINTER (name), &jcf) == 0)
     /* FIXME: until the `.java' parser is fully working, we only
        look for a .java file when one was mentioned on the
        command line.  This lets us test the .java parser fairly
@@ -494,7 +496,7 @@ read_class (name)
     current_jcf = jcf;
 
   if (current_jcf->java_source)
-    jcf_parse_source (current_jcf);
+    jcf_parse_source ();
   else {
     java_parser_context_save_global ();
     java_push_parser_context ();
@@ -558,9 +560,8 @@ load_class (class_or_name, verbose)
 
 /* Parse a source file when JCF refers to a source file.  */
 
-void
-jcf_parse_source (jcf)
-     JCF *jcf;
+static void
+jcf_parse_source ()
 {
   tree file;
 
@@ -952,7 +953,7 @@ void process_zip_dir()
    zip file.  */
 int
 DEFUN(find_in_current_zip, (name, length, jcf),
-      char *name AND int length AND JCF **jcf)
+      char *name AND JCF **jcf)
 {
   JCF *local_jcf;
   tree class_name = maybe_get_identifier (name), class, icv;
@@ -975,7 +976,7 @@ DEFUN(find_in_current_zip, (name, length
 }
 
 /* Figure what kind of file we're dealing with */
-int
+static int
 DEFUN(jcf_figure_file_type, (jcf),
       JCF *jcf)
 {


More information about the Gcc-patches mailing list