Patch: Java: Fix PR 8618

Andreas Tobler toa@pop.agri.ch
Sat Jul 10 07:28:00 GMT 2004


Hi Bryce,

this one breaks bootstrap. (at least here on darwin)

Bryce McKinlay wrote:

>  int
>  common_enclosing_context_p (tree type1, tree type2)
>  {
> +  for (type1; type1;  <----------- here 
> +       type1 = (INNER_CLASS_TYPE_P (type1) ?
> +		TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type1))) : NULL_TREE))
> +    {
> +      tree current;
> +      for (current = type2; current;
> +	   current = (INNER_CLASS_TYPE_P (current) ?
> +		      TREE_TYPE (DECL_CONTEXT (TYPE_NAME (current))) : 
> +		      NULL_TREE))
> +	if (type1 == current)
> +	  return 1;
> +    }
> +  return 0;
> +}

I get a warning with 'statement with no effect on class.c:597'

Is this the right approach?

I continue and see if I did some rubbish ;)

Andreas

Index: java/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.197
diff -u -r1.197 class.c
--- java/class.c        10 Jul 2004 05:38:15 -0000      1.197
+++ java/class.c        10 Jul 2004 07:16:16 -0000
@@ -594,16 +594,17 @@
  int
  common_enclosing_context_p (tree type1, tree type2)
  {
-  for (type1; type1;
-       type1 = (INNER_CLASS_TYPE_P (type1) ?
-               TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type1))) : NULL_TREE))
+  tree first;
+  for (first = type1; first;
+       first = (INNER_CLASS_TYPE_P (first) ?
+               TREE_TYPE (DECL_CONTEXT (TYPE_NAME (first))) : NULL_TREE))
      {
        tree current;
        for (current = type2; current;
            current = (INNER_CLASS_TYPE_P (current) ?
                       TREE_TYPE (DECL_CONTEXT (TYPE_NAME (current))) :
                       NULL_TREE))
-       if (type1 == current)
+       if (first == current)
           return 1;
      }
    return 0;




More information about the Java-patches mailing list