This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: RFA: Fix PR java/21844


On 07 Jun 2005 08:51:13 -0600, Tom Tromey <tromey@redhat.com> wrote:
> >>>>> "Ranjit" == Ranjit Mathew <rmathew@gmail.com> writes:
> 
> Ranjit> See parse.y:8393, which is *supposed* to handle the same
> Ranjit> case. Before my patch, the "for" loop was peeking ahead
> Ranjit> and handling this case. Perhaps you can correct the look
> Ranjit> ahead at the mentioned line and retry?
> 
> My first attempt was changing that loop not to terminate as early, but
> this caused the 19870 test to fail.

Sorry, I didn't understand this properly. I'll try to
elaborate on what I was trying to say. Before my
patch the loop used to look like:

-  for (type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))); ;
-       type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))))
-    {
-      if (type == DECL_CONTEXT (decl))
-	return 1;
-      if (!DECL_CONTEXT (TYPE_NAME (type)))
-	{
-	  /* Before we give up, see whether the field is inherited from
-	     the enclosing context we're considering. */
-	  if (inherits_from_p (type, DECL_CONTEXT (decl)))
-	    return 1;
-	  break;
-	}

After my patch it looks like:

  for (type_root = type;
       DECL_CONTEXT (TYPE_NAME (type_root));
       type_root = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type_root))))
    {
      if (type_root == decl_type)
        return 1;

      /* Before we give up, see whether it is a non-static field
         inherited from the enclosing context we are considering.  */
      if (!DECL_CONTEXT (TYPE_NAME (type_root))
          && !is_static
          && inherits_from_p (type_root, decl_type))
        return 1;
    }

The "if" inside the for loop is a dead statement overridden
by the "continuation condition" of the "for" loop. This was
a rather silly mistake on my part.

So we can either rework that "for" loop, or just remove
that "if" block and take it out of the loop as you have
done in your patch.

Thanks,
Ranjit.

-- 
Ranjit Mathew      Email: rmathew AT gmail DOT com

Bangalore, INDIA.    Web: http://ranjitmathew.hostingzero.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]