Another round of java patches
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Wed Mar 31 18:59:00 GMT 1999
> From: Per Bothner <bothner@cygnus.com>
>
> + if (cpool->tags[i] == tag && cpool->data[i] == (unsigned) j)
>
> I think the cast should be to (jword).
>
> > * parse.y (build_jump_to_finally): Hide prototype and definition.
>
> Just remove the whole function - it is obsolete.
>
> > * verify.c (verify_jvm_instructions): Mark unused label `bad_ldc'
> > with ATTRIBUTE_UNUSED_LABEL.
>
> Just get rid of the label - I don't see any point to it.
>
> With these changes, please check it in. (Please sense me a revised
> patch so I can check in these changes to our internal tree.)
> --Per Bothner
Done and installed, below is the revised diff that I checked in.
Thanks for reviewing my patch.
--Kaveh
Index: ChangeLog
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/java/ChangeLog,v
retrieving revision 1.158
diff -u -p -r1.158 ChangeLog
--- ChangeLog 1999/03/12 07:52:57 1.158
+++ ChangeLog 1999/03/13 01:05:55
@@ -1,3 +1,33 @@
+Fri Mar 12 19:42:55 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * constants.c (find_class_or_string_constant): Cast variable `j'
+ to a `jword' when comparing against one.
+
+ * expr.c (java_lang_expand_expr): Remove unused variables
+ `has_finally_p' and `op0'.
+
+ * gjavah.c (print_field_info): Cast a value to jint when comparing
+ against one. Likewise for a jlong.
+ (add_namelet): Likewise cast a `sizeof' to an int when comparing
+ against a signed quantity.
+
+ * jcf-dump.c (print_signature_type): Remove unused variable `digit'.
+ (print_signature): Don't needlessly dereference variable `str'
+
+ * jcf-reader.c (get_attribute): Mark variables `max_stack' and
+ `max_locals' with ATTRIBUTE_UNUSED.
+ (jcf_parse_class): Likewise for variable `index'.
+
+ * parse.h (reverse_jdep_list): Remove static prototype.
+
+ * parse.y (build_jump_to_finally): Remove prototype and definition.
+ (reverse_jdep_list): Add static prototype.
+
+ * typeck.c (convert_ieee_real_to_integer): Remove unused variables
+ `assignment' and `expr_decl'.
+
+ * verify.c (verify_jvm_instructions): Remove unused label `bad_ldc'.
+
1999-03-12 Andrew Haley <aph@cygnus.com>
* jcf-path.c (add_entry): alloca len+2 rather than len+1 bytes;
Index: constants.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/java/constants.c,v
retrieving revision 1.6
diff -u -p -r1.6 constants.c
--- constants.c 1999/02/17 02:01:58 1.6
+++ constants.c 1999/03/13 01:05:55
@@ -123,7 +123,7 @@ find_class_or_string_constant (cpool, ta
int i;
for (i = cpool->count; --i > 0; )
{
- if (cpool->tags[i] == tag && cpool->data[i] == j)
+ if (cpool->tags[i] == tag && cpool->data[i] == (jword) j)
return i;
}
i = cpool->count;
Index: expr.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/java/expr.c,v
retrieving revision 1.29
diff -u -p -r1.29 expr.c
--- expr.c 1999/03/06 08:35:38 1.29
+++ expr.c 1999/03/13 01:06:03
@@ -1750,8 +1750,6 @@ java_lang_expand_expr (exp, target, tmod
enum expand_modifier modifier;
{
tree current;
- int has_finally_p;
- rtx op0;
switch (TREE_CODE (exp))
{
Index: gjavah.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/java/gjavah.c,v
retrieving revision 1.21
diff -u -p -r1.21 gjavah.c
--- gjavah.c 1999/02/26 12:49:52 1.21
+++ gjavah.c 1999/03/13 01:06:07
@@ -335,7 +335,7 @@ DEFUN(print_field_info, (stream, jcf, na
num = JPOOL_INT (jcf, current_field_value);
/* We single out the most negative number to print
specially. This avoids later warnings from g++. */
- if (num == 0x80000000)
+ if (num == (jint) 0x80000000)
{
most_negative = 1;
++num;
@@ -354,7 +354,7 @@ DEFUN(print_field_info, (stream, jcf, na
num = JPOOL_LONG (jcf, current_field_value);
/* We single out the most negative number to print
specially.. This avoids later warnings from g++. */
- if (num == 0x8000000000000000LL)
+ if (num == (jlong) 0x8000000000000000LL)
{
most_negative = 1;
++num;
@@ -920,11 +920,11 @@ add_namelet (name, name_limit, parent)
#define JAVALANG "java/lang/"
#define JAVAIO "java/io/"
#define JAVAUTIL "java/util/"
- if ((name_limit - name >= sizeof (JAVALANG) - 1
+ if ((name_limit - name >= (int) sizeof (JAVALANG) - 1
&& ! strncmp (name, JAVALANG, sizeof (JAVALANG) - 1))
- || (name_limit - name >= sizeof (JAVAUTIL) - 1
+ || (name_limit - name >= (int) sizeof (JAVAUTIL) - 1
&& ! strncmp (name, JAVAUTIL, sizeof (JAVAUTIL) - 1))
- || (name_limit - name >= sizeof (JAVAIO) - 1
+ || (name_limit - name >= (int) sizeof (JAVAIO) - 1
&& ! strncmp (name, JAVAIO, sizeof (JAVAIO) - 1)))
return;
}
Index: jcf-dump.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/java/jcf-dump.c,v
retrieving revision 1.15
diff -u -p -r1.15 jcf-dump.c
--- jcf-dump.c 1999/03/06 08:35:41 1.15
+++ jcf-dump.c 1999/03/13 01:06:10
@@ -520,8 +520,7 @@ DEFUN(print_signature_type, (stream, ptr
array_size = -1;
for ((*ptr)++; (*ptr) < limit && ISDIGIT (**ptr); (*ptr)++)
{
- int digit =
- array_size = (array_size < 0 ? 0 : 10 * array_size) + *(*ptr) - '0';
+ array_size = (array_size < 0 ? 0 : 10 * array_size) + *(*ptr) - '0';
}
print_signature_type (stream, ptr, limit);
if (array_size == -1)
@@ -592,7 +591,7 @@ DEFUN(print_signature, (stream, jcf, sig
}
if (options & PRINT_SIGNATURE_ARGS_ONLY)
{
- *str++;
+ str++;
fputc ('(', stream);
while (str < limit && *str != ')')
{
Index: jcf-reader.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/java/jcf-reader.c,v
retrieving revision 1.5
diff -u -p -r1.5 jcf-reader.c
--- jcf-reader.c 1999/03/06 08:35:43 1.5
+++ jcf-reader.c 1999/03/13 01:06:10
@@ -72,8 +72,8 @@ DEFUN(get_attribute, (jcf),
if (name_length == 4 && memcmp (name_data, "Code", 4) == 0)
{
uint16 j;
- uint16 max_stack = JCF_readu2 (jcf);
- uint16 max_locals = JCF_readu2 (jcf);
+ uint16 max_stack ATTRIBUTE_UNUSED = JCF_readu2 (jcf);
+ uint16 max_locals ATTRIBUTE_UNUSED = JCF_readu2 (jcf);
uint32 code_length = JCF_readu4 (jcf);
uint16 exception_table_length, attributes_count;
if (code_length + 12 > attribute_length)
@@ -242,7 +242,7 @@ DEFUN(jcf_parse_class, (jcf),
/* Read interfaces. */
for (i = 0; i < interfaces_count; i++)
{
- uint16 index = JCF_readu2 (jcf);
+ uint16 index ATTRIBUTE_UNUSED = JCF_readu2 (jcf);
#ifdef HANDLE_CLASS_INTERFACE
HANDLE_CLASS_INTERFACE (index);
#endif
Index: parse.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/java/parse.h,v
retrieving revision 1.24
diff -u -p -r1.24 parse.h
--- parse.h 1999/03/06 08:35:48 1.24
+++ parse.h 1999/03/13 01:06:12
@@ -392,7 +392,6 @@ typedef struct _jdeplist {
jdep *last;
struct _jdeplist *next;
} jdeplist;
-static jdeplist *reverse_jdep_list ();
#endif /* JC1_LITE */
Index: parse.y
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/java/parse.y,v
retrieving revision 1.58
diff -u -p -r1.58 parse.y
--- parse.y 1999/03/08 13:34:08 1.58
+++ parse.y 1999/03/13 01:06:42
@@ -199,7 +199,6 @@ static tree string_constant_concatenatio
static tree build_string_concatenation PROTO ((tree, tree));
static tree patch_string_cst PROTO ((tree));
static tree patch_string PROTO ((tree));
-static tree build_jump_to_finally PROTO ((tree, tree, tree, tree));
static tree build_try_statement PROTO ((int, tree, tree));
static tree build_try_finally_statement PROTO ((int, tree, tree));
static tree patch_try_statement PROTO ((tree));
@@ -239,6 +238,7 @@ static char *purify_type_name PROTO ((ch
static tree patch_initialized_static_field PROTO ((tree));
static tree fold_constant_for_init PROTO ((tree, tree));
static tree strip_out_static_field_access_decl PROTO ((tree));
+static jdeplist *reverse_jdep_list PROTO ((struct parser_ctxt *));
/* Number of error found so far. */
int java_error_count;
@@ -10710,36 +10710,6 @@ patch_switch_statement (node)
}
/* 14.18 The try statement */
-
-/* Wrap BLOCK around a LABELED_BLOCK, set DECL to the newly generated
- exit labeld and issue a jump to FINALLY_LABEL:
-
- LABELED_BLOCK
- BLOCK
- <orignal_statments>
- DECL = &LABEL_DECL
- GOTO_EXPR
- FINALLY_LABEL
- LABEL_DECL */
-
-static tree
-build_jump_to_finally (block, decl, finally_label, type)
- tree block, decl, finally_label, type;
-{
- tree stmt;
- tree new_block = build (LABELED_BLOCK_EXPR, type,
- create_label_decl (generate_name ()), block);
-
- stmt = build (MODIFY_EXPR, void_type_node, decl,
- build_address_of (LABELED_BLOCK_LABEL (new_block)));
- TREE_SIDE_EFFECTS (stmt) = 1;
- CAN_COMPLETE_NORMALLY (stmt) = 1;
- add_stmt_to_block (block, type, stmt);
- stmt = build (GOTO_EXPR, void_type_node, finally_label);
- TREE_SIDE_EFFECTS (stmt) = 1;
- add_stmt_to_block (block, type, stmt);
- return new_block;
-}
static tree
build_try_statement (location, try_block, catches)
Index: typeck.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/java/typeck.c,v
retrieving revision 1.14
diff -u -p -r1.14 typeck.c
--- typeck.c 1999/03/06 08:35:49 1.14
+++ typeck.c 1999/03/13 01:06:44
@@ -66,7 +66,6 @@ static tree
convert_ieee_real_to_integer (type, expr)
tree type, expr;
{
- tree assignment, expr_decl;
expr = save_expr (expr);
return build (COND_EXPR, type,
Index: verify.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/java/verify.c,v
retrieving revision 1.10
diff -u -p -r1.10 verify.c
--- verify.c 1999/02/02 12:20:39 1.10
+++ verify.c 1999/03/13 01:06:46
@@ -786,7 +786,6 @@ verify_jvm_instructions (jcf, byte_ops,
break;
/* ... else fall through ... */
default:
- bad_ldc:
VERIFICATION_ERROR ("bad constant pool tag in ldc");
}
if (type == int_type_node)
Index: parse.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/java/parse.c,v
retrieving revision 1.50
diff -u -p -r1.50 parse.c
--- parse.c 1999/03/08 13:34:10 1.50
+++ parse.c 1999/03/13 01:07:21
@@ -5,13 +5,6 @@
#define YYBISON 1 /* Identify Bison output. */
-#define yyparse java_parse
-#define yylex java_lex
-#define yyerror java_error
-#define yylval java_lval
-#define yychar java_char
-#define yydebug java_debug
-#define yynerrs java_nerrs
#define PLUS_TK 258
#define MINUS_TK 259
#define MULT_TK 260
@@ -275,7 +268,6 @@ static tree string_constant_concatenatio
static tree build_string_concatenation PROTO ((tree, tree));
static tree patch_string_cst PROTO ((tree));
static tree patch_string PROTO ((tree));
-static tree build_jump_to_finally PROTO ((tree, tree, tree, tree));
static tree build_try_statement PROTO ((int, tree, tree));
static tree build_try_finally_statement PROTO ((int, tree, tree));
static tree patch_try_statement PROTO ((tree));
@@ -315,6 +307,7 @@ static char *purify_type_name PROTO ((ch
static tree patch_initialized_static_field PROTO ((tree));
static tree fold_constant_for_init PROTO ((tree, tree));
static tree strip_out_static_field_access_decl PROTO ((tree));
+static jdeplist *reverse_jdep_list PROTO ((struct parser_ctxt *));
/* Number of error found so far. */
int java_error_count;
@@ -2217,7 +2210,7 @@ static const short yycheck[] = { 3,
#define YYPURE 1
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "/usr/share/misc/bison.simple"
+#line 3 "/usr/local/gnu/share/bison.simple"
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@@ -2234,7 +2227,7 @@ static const short yycheck[] = { 3,
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
@@ -2410,7 +2403,7 @@ __yy_memcpy (char *to, char *from, int c
#endif
#endif
-#line 196 "/usr/share/misc/bison.simple"
+#line 196 "/usr/local/gnu/share/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *.
@@ -4675,7 +4668,7 @@ case 493:
break;}
}
/* the action file gets copied in in place of this dollarsign */
-#line 498 "/usr/share/misc/bison.simple"
+#line 498 "/usr/local/gnu/share/bison.simple"
yyvsp -= yylen;
yyssp -= yylen;
@@ -13312,36 +13305,6 @@ patch_switch_statement (node)
}
/* 14.18 The try statement */
-
-/* Wrap BLOCK around a LABELED_BLOCK, set DECL to the newly generated
- exit labeld and issue a jump to FINALLY_LABEL:
-
- LABELED_BLOCK
- BLOCK
- <orignal_statments>
- DECL = &LABEL_DECL
- GOTO_EXPR
- FINALLY_LABEL
- LABEL_DECL */
-
-static tree
-build_jump_to_finally (block, decl, finally_label, type)
- tree block, decl, finally_label, type;
-{
- tree stmt;
- tree new_block = build (LABELED_BLOCK_EXPR, type,
- create_label_decl (generate_name ()), block);
-
- stmt = build (MODIFY_EXPR, void_type_node, decl,
- build_address_of (LABELED_BLOCK_LABEL (new_block)));
- TREE_SIDE_EFFECTS (stmt) = 1;
- CAN_COMPLETE_NORMALLY (stmt) = 1;
- add_stmt_to_block (block, type, stmt);
- stmt = build (GOTO_EXPR, void_type_node, finally_label);
- TREE_SIDE_EFFECTS (stmt) = 1;
- add_stmt_to_block (block, type, stmt);
- return new_block;
-}
static tree
build_try_statement (location, try_block, catches)
More information about the Gcc-patches
mailing list