[PATCH] Fix unused but set warnings in Java FE

Jakub Jelinek jakub@redhat.com
Sat Nov 28 11:31:00 GMT 2009


Hi!

This patch fixes some -Wunused-but-set-* warnings in Java FE.
gcc/java/builtins.c:325:7: warning: variable ‘value_type’ set but not used
gcc/java/builtins.c:349:7: warning: variable ‘value_type’ set but not used
gcc/java/builtins.c:412:3: warning: variable ‘this_arg’ set but not used
gcc/java/javaop.def:278:1: warning: variable ‘saw_index’ set but not used
gcc/java/javaop.def:311:1: warning: variable ‘saw_index’ set but not used
warnings are still left, I'd appreciate help with either fixing those or
finding workarounds.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2009-11-28  Jakub Jelinek  <jakub@redhat.com>

	* jvspec.c (lang_specific_driver): Remove unused
	saw_verbose_flag variable.
	* jcf-dump.c (main): Remove unused general_purpose_bits
	variable.
	* builtins.c (initialize_builtins): Remove unused float_ftype_float
	variable.
	* expr.c (java_stack_pop): Remove unused val variable.
	(build_jni_stub): Remove unused res_type variable.
	* verify-impl.c (check_field_constant): Remove unused len variable.

--- gcc/java/jvspec.c.jj	2009-08-19 17:45:47.000000000 +0200
+++ gcc/java/jvspec.c	2009-11-27 16:24:55.000000000 +0100
@@ -147,9 +147,6 @@ lang_specific_driver (int *in_argc, cons
 {
   int i, j;
 
-  /* If nonzero, the user gave us the `-v' flag.  */
-  int saw_verbose_flag = 0;
-
   int saw_save_temps = 0;
 
   /* This will be 0 if we encounter a situation where we should not
@@ -266,7 +263,6 @@ lang_specific_driver (int *in_argc, cons
 	    want_spec_file = 0;
 	  else if (strcmp (argv[i], "-v") == 0)
 	    {
-	      saw_verbose_flag = 1;
 	      if (argc == 2)
 		{
 		  /* If they only gave us `-v', don't try to link
--- gcc/java/jcf-dump.c.jj	2009-02-06 11:16:56.000000000 +0100
+++ gcc/java/jcf-dump.c	2009-11-27 16:24:23.000000000 +0100
@@ -1305,7 +1305,6 @@ main (int argc, char** argv)
 	    {
 	      long compressed_size, member_size;
 	      int compression_method, filename_length, extra_length;
-	      int general_purpose_bits;
 	      const char *filename;
 	      int total_length;
 	      if (flag_print_class_info)
@@ -1325,7 +1324,7 @@ main (int argc, char** argv)
 		    }
 		  JCF_FILL (jcf, 26);
 		  JCF_SKIP (jcf, 2);
-		  general_purpose_bits = JCF_readu2_le (jcf);
+		  (void) /* general_purpose_bits = */ JCF_readu2_le (jcf);
 		  compression_method = JCF_readu2_le (jcf);
 		  JCF_SKIP (jcf, 8);
 		  compressed_size = JCF_readu4_le (jcf);
--- gcc/java/builtins.c.jj	2009-09-29 15:10:36.000000000 +0200
+++ gcc/java/builtins.c	2009-11-27 16:20:22.000000000 +0100
@@ -484,7 +484,7 @@ void
 initialize_builtins (void)
 {
   tree double_ftype_double, double_ftype_double_double;
-  tree float_ftype_float, float_ftype_float_float;
+  tree float_ftype_float_float;
   tree boolean_ftype_boolean_boolean;
   tree t;
   int i;
@@ -501,7 +501,6 @@ initialize_builtins (void)
   void_list_node = end_params_node;
 
   t = tree_cons (NULL_TREE, float_type_node, end_params_node);
-  float_ftype_float = build_function_type (float_type_node, t);
   t = tree_cons (NULL_TREE, float_type_node, t);
   float_ftype_float_float = build_function_type (float_type_node, t);
 
--- gcc/java/expr.c.jj	2009-06-30 13:09:50.000000000 +0200
+++ gcc/java/expr.c	2009-11-27 16:21:30.000000000 +0100
@@ -632,7 +632,7 @@ java_stack_pop (int count)
 {
   while (count > 0)
     {
-      tree type, val;
+      tree type;
 
       gcc_assert (stack_pointer != 0);
 
@@ -644,7 +644,7 @@ java_stack_pop (int count)
 
 	  type = stack_type_map[stack_pointer - 2];
 	}
-      val = pop_value (type);
+      pop_value (type);
       count--;
     }
 }
@@ -2652,7 +2652,7 @@ build_jni_stub (tree method)
   tree jniarg0, jniarg1, jniarg2, jniarg3;
   tree jni_func_type, tem;
   tree env_var, res_var = NULL_TREE, block;
-  tree method_args, res_type;
+  tree method_args;
   tree meth_var;
   tree bind;
 
@@ -2805,7 +2805,6 @@ build_jni_stub (tree method)
   TREE_SIDE_EFFECTS (body) = 1;
 
   /* Finally, do the return.  */
-  res_type = void_type_node;
   if (res_var != NULL_TREE)
     {
       tree drt;
--- gcc/java/verify-impl.c.jj	2009-05-04 16:45:47.000000000 +0200
+++ gcc/java/verify-impl.c	2009-11-27 16:26:29.000000000 +0100
@@ -2035,7 +2035,6 @@ check_field_constant (int index, type *c
 {
   vfy_string name, field_type;
   const char *typec;
-  int len;
   type t;
 
   type ct = handle_field_or_method (index,
@@ -2044,7 +2043,6 @@ check_field_constant (int index, type *c
   if (class_type)
     *class_type = ct;
   typec = vfy_string_bytes (field_type);
-  len = vfy_string_length (field_type);
   if (typec[0] == '[' || typec[0] == 'L')
     init_type_from_string (&t, field_type);
   else

	Jakub



More information about the Java-patches mailing list