[C++] Optimize comptypes for the common case

Steven Bosscher stevenb@suse.de
Wed Mar 23 20:41:00 GMT 2005


On Wednesday 23 March 2005 21:09, Mike Stump wrote:
> On Mar 23, 2005, at 8:25 AM, Steven Bosscher wrote:
> > This patch moves the check for target attributes down as the last
> > check in cp/typeck.c:comptypes.
>
> I checked this out in detail, looks good, except...
>
> > -      /* We may be dealing with Objective-C instances...  */
> > +      /* We may be dealing with Objective-C instances.  */
> >        if (TREE_CODE (t1) == RECORD_TYPE
> > -      && ((retval = objc_comptypes (t1, t2, 0)) >= 0))
> > -         return retval;
> > -      /* ...but fall through if we are not.  */
> > +      && objc_comptypes (t1, t2, 0) >= 0)
> > +    break;
>
> this looks wrong.
>
> if (TREE_CODE (t1) == RECORD_TYPE
>      && objc_comptypes (t1, t2, 0) > 0)
>    break;
>
> I think comes closer.

You are right.  I'll fix the patch accordingly.

Gr.
Steven



More information about the Gcc-patches mailing list