Java warning patches

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Sat Oct 21 08:16:00 GMT 2000


 > From: Alexandre Petit-Bianco <apbianco@cygnus.com>
 > 
 > How about the patch below?
 > 
 > > Bootstrapped on solaris2.7, okay to install?
 > 
 > Yes please, thank you!
 > ./A

Thanks.  Below is the final patch I checked in.

		--Kaveh

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/ChangeLog,v
retrieving revision 1.551
diff -u -p -r1.551 ChangeLog
--- ChangeLog	2000/10/21 06:28:27	1.551
+++ ChangeLog	2000/10/21 15:06:59
@@ -1,3 +1,14 @@
+2000-10-21  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* gjavah.c (NEED_PEEK_ATTRIBUTE, NEED_SKIP_ATTRIBUTE): Define
+	
+	* jcf-reader.c (peek_attribute, skip_attribute): Only define
+	when requested.
+
+	* parse.h (yyerror): If JC1_LITE, mark with ATTRIBUTE_NORETURN.
+
+	* verify.c (CHECK_PC_IN_RANGE): Cast result of stmt-expr to void.
+
 2000-10-16  Tom Tromey  <tromey@cygnus.com>
 
 	* jvspec.c (lang_specific_driver): Recognize -MF and -MT.
Index: gjavah.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/gjavah.c,v
retrieving revision 1.62
diff -u -p -r1.62 gjavah.c
--- gjavah.c	2000/10/19 04:19:09	1.62
+++ gjavah.c	2000/10/21 15:07:08
@@ -222,6 +222,10 @@ static int decompiled = 0;
   if (out && method_printed && !method_synthetic) 	\
     fputs (decompiled || stubs ? "\n" : ";\n", out);
 
+/* We're going to need {peek,skip}_attribute, enable their definition.   */
+#define NEED_PEEK_ATTRIBUTE
+#define NEED_SKIP_ATTRIBUTE
+
 #include "jcf-reader.c"
 
 /* Some useful constants.  */
Index: jcf-reader.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/jcf-reader.c,v
retrieving revision 1.12
diff -u -p -r1.12 jcf-reader.c
--- jcf-reader.c	2000/08/08 03:33:36	1.12
+++ jcf-reader.c	2000/10/21 15:07:09
@@ -27,8 +27,6 @@ The Free Software Foundation is independ
 #include "zipfile.h"
 
 static int get_attribute PARAMS ((JCF *));
-static int peek_attribute PARAMS ((JCF *, int, const char *, int));
-static void skip_attribute PARAMS ((JCF *, int));
 static int jcf_parse_preamble PARAMS ((JCF *));
 static int jcf_parse_constant_pool PARAMS ((JCF *));
 static void jcf_parse_class PARAMS ((JCF *));
@@ -36,12 +34,19 @@ static int jcf_parse_fields PARAMS ((JCF
 static int jcf_parse_one_method PARAMS ((JCF *));
 static int jcf_parse_methods PARAMS ((JCF *));
 static int jcf_parse_final_attributes PARAMS ((JCF *));
+#ifdef NEED_PEEK_ATTRIBUTE
+static int peek_attribute PARAMS ((JCF *, int, const char *, int));
+#endif
+#ifdef NEED_SKIP_ATTRIBUTE
+static void skip_attribute PARAMS ((JCF *, int));
+#endif
 
 /* Go through all available attribute (ATTRIBUTE_NUMER) and try to
    identify PEEKED_NAME.  Return 1 if PEEKED_NAME was found, 0
    otherwise. JCF is restored to its initial position before
    returning.  */
 
+#ifdef NEED_PEEK_ATTRIBUTE	/* Not everyone uses this function */
 static int
 peek_attribute (jcf, attribute_number, peeked_name, peeked_name_length)
       JCF *jcf;
@@ -81,7 +86,9 @@ peek_attribute (jcf, attribute_number, p
   JCF_SEEK (jcf, absolute_offset);
   return to_return;
 }
+#endif
 
+#ifdef NEED_SKIP_ATTRIBUTE	/* Not everyone uses this function */
 static void
 skip_attribute (jcf, number_of_attribute)
      JCF *jcf;
@@ -94,6 +101,7 @@ skip_attribute (jcf, number_of_attribute
       JCF_SKIP (jcf, JCF_readu4 (jcf));
     }
 }
+#endif
 
 static int
 DEFUN(get_attribute, (jcf),
Index: parse.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.h,v
retrieving revision 1.60
diff -u -p -r1.60 parse.h
--- parse.h	2000/10/13 06:26:45	1.60
+++ parse.h	2000/10/21 15:07:12
@@ -940,6 +940,10 @@ extern void java_parser_context_save_glo
 extern void java_parser_context_restore_global PARAMS ((void));
 int yyparse PARAMS ((void));
 extern int java_parse PARAMS ((void));
-void yyerror PARAMS ((const char *));
+extern void yyerror PARAMS ((const char *))
+#ifdef JC1_LITE
+ATTRIBUTE_NORETURN
+#endif
+;
 extern void java_expand_classes PARAMS ((void));
 #endif
Index: verify.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/verify.c,v
retrieving revision 1.33
diff -u -p -r1.33 verify.c
--- verify.c	2000/09/12 22:31:00	1.33
+++ verify.c	2000/10/21 15:07:15
@@ -353,7 +353,7 @@ start_pc_cmp (xp, yp)
              goto verify_error; } while (0)
 
 #ifdef __GNUC__
-#define CHECK_PC_IN_RANGE(PC) ({if (PC < 0 || PC > length) goto bad_pc; 1;})
+#define CHECK_PC_IN_RANGE(PC) ({if (PC < 0 || PC > length) goto bad_pc; (void)1;})
 #else
 #define CHECK_PC_IN_RANGE(PC) (PC < 0 || PC > length ? \
   (fatal("Bad byte codes.\n"), 0) : 1)


More information about the Gcc-patches mailing list