Java warning patches part 2/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>

	* jcf-reader.c (jcf_parse_preamble): Mark variables
	`minor_version' and `major_version' with ATTRIBUTE_UNUSED.

	* jcf-write.c (generate_bytecode_insns): Initialize variable
	`finally_label'.

	* lex.c (java_is_eol): Wrap prototype and definition in !JC1_LITE.
	(java_init_lex): Wrap variable `java_lang_imported' in !JC1_LITE.
	(java_parse_doc_section): Initialize variable `seen_star'.
	(java_lex): Wrap variable `number_beginning' in !JC1_LITE.
	(java_lex_error): Mark parameters `msg' and `forward' with
	ATTRIBUTE_UNUSED.
	(java_get_line_col): Mark parameters `filename' and `line' with
	ATTRIBUTE_UNUSED.

	* parse-scan.y: Include toplev.h.
	(yyerror): Mark parameter `msg' with ATTRIBUTE_UNUSED.

	* parse.h: use `struct JCF', not plain `JCF'.
	(java_parser_context_save_global, java_expand_classes
	java_parser_context_restore_global, java_parse): Add prototypes.

	* typeck.c (convert_ieee_real_to_integer): Remove unused variable
	`node'.

	
	
diff -rup orig/egcs-CVS19990215/gcc/java/jcf-reader.c egcs-CVS19990215/gcc/java/jcf-reader.c
--- orig/egcs-CVS19990215/gcc/java/jcf-reader.c	Mon Feb 15 18:46:51 1999
+++ egcs-CVS19990215/gcc/java/jcf-reader.c	Tue Feb 16 15:38:09 1999
@@ -139,8 +139,8 @@ DEFUN(jcf_parse_preamble, (jcf),
       JCF* jcf)
 {
   uint32 magic = (JCF_FILL (jcf, 8), JCF_readu4 (jcf));
-  uint16 minor_version = JCF_readu2 (jcf);
-  uint16 major_version = JCF_readu2 (jcf);
+  uint16 minor_version ATTRIBUTE_UNUSED = JCF_readu2 (jcf);
+  uint16 major_version ATTRIBUTE_UNUSED = JCF_readu2 (jcf);
 #ifdef HANDLE_MAGIC
   HANDLE_MAGIC (magic, minor_version, major_version);
 #endif
diff -rup orig/egcs-CVS19990215/gcc/java/jcf-write.c egcs-CVS19990215/gcc/java/jcf-write.c
--- orig/egcs-CVS19990215/gcc/java/jcf-write.c	Mon Feb 15 18:46:52 1999
+++ egcs-CVS19990215/gcc/java/jcf-write.c	Tue Feb 16 15:38:09 1999
@@ -2185,7 +2185,7 @@ generate_bytecode_insns (exp, target, st
 	tree finally = TREE_OPERAND (exp, 2);
 	struct jcf_block *start_label = get_jcf_label_here (state);
 	struct jcf_block *end_label;  /* End of try clause. */
-	struct jcf_block *finally_label;  /* Finally subroutine. */
+	struct jcf_block *finally_label = 0;  /* Finally subroutine. */
 	struct jcf_block *finished_label = gen_jcf_label (state);
 	tree clause = TREE_OPERAND (exp, 1);
 	if (finally)
diff -rup orig/egcs-CVS19990215/gcc/java/lex.c egcs-CVS19990215/gcc/java/lex.c
--- orig/egcs-CVS19990215/gcc/java/lex.c	Mon Feb 15 18:46:52 1999
+++ egcs-CVS19990215/gcc/java/lex.c	Tue Feb 16 16:46:45 1999
@@ -57,7 +57,9 @@ static int java_lineterminator PROTO ((u
 static char *java_sprint_unicode PROTO ((struct java_line *, int));
 static void java_unicode_2_utf8 PROTO ((unicode_t));
 static void java_lex_error PROTO ((char *, int));
+#ifndef JC1_LITE
 static int java_is_eol PROTO ((FILE *, int));
+#endif
 static void java_store_unicode PROTO ((struct java_line *, unicode_t, int));
 static unicode_t java_parse_escape_sequence PROTO (());
 static int java_letter_or_digit_p PROTO ((unicode_t));
@@ -74,9 +76,9 @@ static unicode_t java_sneak_unicode PROT
 void
 java_init_lex ()
 {
+#ifndef JC1_LITE
   int java_lang_imported = 0;
 
-#ifndef JC1_LITE
   if (!java_lang_id)
     java_lang_id = get_identifier ("java.lang");
   if (!java_lang_cloneable)
@@ -397,7 +399,7 @@ static int
 java_parse_doc_section (c)
      unicode_t c;
 {
-  int valid_tag = 0, seen_star;
+  int valid_tag = 0, seen_star = 0;
 
   while (JAVA_WHITE_SPACE_P (c) || (c == '*') || c == '\n')
     {
@@ -603,7 +605,9 @@ java_lex (java_lval)
       char literal_token [256];
       int  literal_index = 0, radix = 10, long_suffix = 0, overflow = 0, bytes;
       int  i;
+#ifndef JC1_LITE
       int  number_beginning = ctxp->c_line->current;
+#endif
       
       /* We might have a . separator instead of a FP like .[0-9]* */
       if (c == '.')
@@ -1290,8 +1294,8 @@ build_wfl_node (node)
 
 static void
 java_lex_error (msg, forward)
-     char *msg;
-     int forward;
+     char *msg ATTRIBUTE_UNUSED;
+     int forward ATTRIBUTE_UNUSED;
 {
 #ifndef JC1_LITE
   ctxp->elc.line = ctxp->c_line->lineno;
@@ -1304,6 +1308,7 @@ java_lex_error (msg, forward)
 #endif
 }
 
+#ifndef JC1_LITE
 static int
 java_is_eol (fp, c)
   FILE *fp;
@@ -1323,11 +1328,12 @@ java_is_eol (fp, c)
       return 0;
     }  
 }
+#endif
 
 char *
 java_get_line_col (filename, line, col)
-     char *filename;
-     int line, col;
+     char *filename ATTRIBUTE_UNUSED;
+     int line ATTRIBUTE_UNUSED, col ATTRIBUTE_UNUSED;
 {
 #ifdef JC1_LITE
   return 0;
diff -rup orig/egcs-CVS19990215/gcc/java/parse-scan.y egcs-CVS19990215/gcc/java/parse-scan.y
--- orig/egcs-CVS19990215/gcc/java/parse-scan.y	Mon Feb 15 18:46:51 1999
+++ egcs-CVS19990215/gcc/java/parse-scan.y	Tue Feb 16 15:38:09 1999
@@ -41,6 +41,7 @@ definitions and other extensions.  */
 #include "system.h"
 
 #include "obstack.h"
+#include "toplev.h"
 
 extern char *input_filename;
 extern FILE *finput, *out;
@@ -1178,7 +1179,7 @@ void reset_report ()
 
 void
 yyerror (msg)
-     char *msg;
+     char *msg ATTRIBUTE_UNUSED;
 {
 }
 
diff -rup orig/egcs-CVS19990215/gcc/java/parse-scan.c egcs-CVS19990215/gcc/java/parse-scan.c
--- orig/egcs-CVS19990215/gcc/java/parse-scan.c	Mon Feb 15 18:53:26 1999
+++ egcs-CVS19990215/gcc/java/parse-scan.c	Tue Feb 16 15:38:09 1999
@@ -121,6 +121,7 @@
 #include "system.h"
 
 #include "obstack.h"
+#include "toplev.h"
 
 extern char *input_filename;
 extern FILE *finput, *out;
@@ -2423,7 +2424,7 @@ void reset_report ()
 
 void
 yyerror (msg)
-     char *msg;
+     char *msg ATTRIBUTE_UNUSED;
 {
 }
 
diff -rup orig/egcs-CVS19990215/gcc/java/parse.h egcs-CVS19990215/gcc/java/parse.h
--- orig/egcs-CVS19990215/gcc/java/parse.h	Mon Feb 15 18:53:22 1999
+++ egcs-CVS19990215/gcc/java/parse.h	Tue Feb 16 15:38:09 1999
@@ -616,7 +616,7 @@ struct parser_ctxt {
   tree current_class;		    /* Current class */
   tree current_function_decl;	    /* Current function decl, save/restore */
 
-  JCF *current_jcf;		    /* CU jcf */
+  struct JCF *current_jcf;	    /* CU jcf */
 
   int prevent_ese;	            /* Prevent expression statement error */
   int class_err;		    /* Flag to report certain errors */
@@ -674,8 +674,11 @@ int java_report_errors PROTO (());
 void java_push_parser_context PROTO ((void));
 void java_pop_parser_context PROTO ((int));
 void java_init_lex PROTO ((void));
+extern void java_parser_context_save_global PROTO ((void));
+extern void java_parser_context_restore_global PROTO ((void));
 int yyparse PROTO ((void));
+extern int java_parse PROTO ((void));
 int yylex ();
 void yyerror PROTO ((char *));
-
+extern void java_expand_classes PROTO ((void));
 #endif
diff -rup orig/egcs-CVS19990215/gcc/java/typeck.c egcs-CVS19990215/gcc/java/typeck.c
--- orig/egcs-CVS19990215/gcc/java/typeck.c	Mon Feb 15 18:46:51 1999
+++ egcs-CVS19990215/gcc/java/typeck.c	Tue Feb 16 15:38:09 1999
@@ -66,7 +66,7 @@ static tree
 convert_ieee_real_to_integer (type, expr)
      tree type, expr;
 {
-  tree node, assignment, expr_decl;
+  tree assignment, expr_decl;
 
   expr_decl = build_decl (VAR_DECL, generate_name (), TREE_TYPE (expr));
   layout_decl (expr_decl, 0);


More information about the Gcc-patches mailing list