From 7e21fe59b2a6fdd9b5ac1f11f554fd64a7285bbd Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Fri, 12 Mar 1999 17:13:24 +0000 Subject: [PATCH] Warning fixes: * 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'. From-SVN: r25731 --- gcc/java/ChangeLog | 30 +++++++++++++++++++++++++++ gcc/java/constants.c | 2 +- gcc/java/expr.c | 2 -- gcc/java/gjavah.c | 10 ++++----- gcc/java/jcf-dump.c | 5 ++--- gcc/java/jcf-reader.c | 6 +++--- gcc/java/parse.c | 47 +++++-------------------------------------- gcc/java/parse.h | 1 - gcc/java/parse.y | 32 +---------------------------- gcc/java/typeck.c | 1 - gcc/java/verify.c | 1 - 11 files changed, 47 insertions(+), 90 deletions(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index ecd1b523f07..f5829259057 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,33 @@ +Fri Mar 12 19:42:55 1999 Kaveh R. Ghazi + + * 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 * jcf-path.c (add_entry): alloca len+2 rather than len+1 bytes; diff --git a/gcc/java/constants.c b/gcc/java/constants.c index 3679d4e4e6f..81ff7adc35e 100644 --- a/gcc/java/constants.c +++ b/gcc/java/constants.c @@ -123,7 +123,7 @@ find_class_or_string_constant (cpool, tag, name) 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; diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 6daeb92cd36..15ac0c2b52e 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -1750,8 +1750,6 @@ java_lang_expand_expr (exp, target, tmode, modifier) enum expand_modifier modifier; { tree current; - int has_finally_p; - rtx op0; switch (TREE_CODE (exp)) { diff --git a/gcc/java/gjavah.c b/gcc/java/gjavah.c index 5ec6a883dff..9b32836278a 100644 --- a/gcc/java/gjavah.c +++ b/gcc/java/gjavah.c @@ -335,7 +335,7 @@ DEFUN(print_field_info, (stream, jcf, name_index, sig_index, flags), 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, name_index, sig_index, flags), 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; } diff --git a/gcc/java/jcf-dump.c b/gcc/java/jcf-dump.c index 4512bcde27c..b48c0b43c63 100644 --- a/gcc/java/jcf-dump.c +++ b/gcc/java/jcf-dump.c @@ -520,8 +520,7 @@ DEFUN(print_signature_type, (stream, ptr, limit), 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, signature_index, int options), } if (options & PRINT_SIGNATURE_ARGS_ONLY) { - *str++; + str++; fputc ('(', stream); while (str < limit && *str != ')') { diff --git a/gcc/java/jcf-reader.c b/gcc/java/jcf-reader.c index 49a9b1602fb..accb1a11706 100644 --- a/gcc/java/jcf-reader.c +++ b/gcc/java/jcf-reader.c @@ -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 diff --git a/gcc/java/parse.c b/gcc/java/parse.c index 6579a3d807c..485ed0e9665 100644 --- a/gcc/java/parse.c +++ b/gcc/java/parse.c @@ -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_concatenation PROTO ((tree, tree)); 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 ((char *)); 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 count) #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; @@ -13313,36 +13306,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 - - 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) int location; diff --git a/gcc/java/parse.h b/gcc/java/parse.h index 5326669842f..f917127577b 100644 --- a/gcc/java/parse.h +++ b/gcc/java/parse.h @@ -392,7 +392,6 @@ typedef struct _jdeplist { jdep *last; struct _jdeplist *next; } jdeplist; -static jdeplist *reverse_jdep_list (); #endif /* JC1_LITE */ diff --git a/gcc/java/parse.y b/gcc/java/parse.y index c26a7cc97e0..ad6122b8fd6 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -199,7 +199,6 @@ static tree string_constant_concatenation PROTO ((tree, tree)); 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 ((char *)); 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; @@ -10711,36 +10711,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 - - 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) int location; diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c index d52d7fdebc1..ad0ba4cda87 100644 --- a/gcc/java/typeck.c +++ b/gcc/java/typeck.c @@ -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, diff --git a/gcc/java/verify.c b/gcc/java/verify.c index a6771dbde91..4b6ffffae44 100644 --- a/gcc/java/verify.c +++ b/gcc/java/verify.c @@ -786,7 +786,6 @@ verify_jvm_instructions (jcf, byte_ops, length) break; /* ... else fall through ... */ default: - bad_ldc: VERIFICATION_ERROR ("bad constant pool tag in ldc"); } if (type == int_type_node) -- 2.30.2