Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: Jim Blandy <jimb@redhat.com>
Cc: gdb-patches@sources.redhat.com, Kris Warkentin <kewarken@qnx.com>,
	Daniel Jacobowitz <drow@mvista.com>
Subject: Re: RFA: osabi: correct test for compatible handlers
Date: Wed, 22 Oct 2003 22:32:00 -0000	[thread overview]
Message-ID: <3F970598.9020908@redhat.com> (raw)
In-Reply-To: <vt23cdlvy21.fsf@zenia.home>

> Andrew Cagney <ac131313@redhat.com> writes:
> 
> 
>> > +   /* BFD's 'A->compatible (A, B)' functions return zero if A and B are
>> > +      incompatible.  But if they are compatible, it returns the 'more
>> > +      featureful' of the two arches.  That is, if A can run code
>> > +      written for B, but B can't run code written for A, then it'll
>> > +      return A.
>> > + +      struct bfd_arch_info objects are atoms: that is, there's
>> > supposed
>> > +      to be exactly one instance for a given machine.  So you can tell
>> > +      whether two are equivalent by comparing pointers.  */
>> > +   return (a == b || a->compatible (a, b) == a);
> 
>> 
>> Hey, nice.
>> 
>> Don't worry about a can_run_code_for function though, having the logic
>> inline makes what's happening easier to understand (and will simplify
>> a follow-on wild-card patch I've got pending).
> 
> 
> It may be easier for you, but the original author did get the test
> backwards, and I had to go through an embarrassing number of wrong
> tries before I got it right.  I'd really like to leave the function
> separate.

I had to go through an equally enbarrassing number of tries before I 
established exactly what the patch was doing.  Changing:

	if (compatible == handler->arch_info)

to:

	if (compatible == arch_info)

(correct?)  The really important thing here is your commentary as that 
explains exactly what is going on.  Having it as close as possible to 
the problem (the call site) is, I think, going to make things easier to 
understand.

Andrew



  reply	other threads:[~2003-10-22 22:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-21 22:23 Jim Blandy
2003-10-22 19:09 ` Andrew Cagney
     [not found]   ` <vt23cdlvy21 dot fsf at zenia dot home>
     [not found]     ` <3F970598 dot 9020908 at redhat dot com>
2003-10-22 19:11   ` Daniel Jacobowitz
2003-10-22 19:33     ` Andrew Cagney
2003-10-22 20:04   ` Jim Blandy
2003-10-22 22:32     ` Andrew Cagney [this message]
2003-10-22 23:16       ` Jim Blandy
2003-10-22 23:28         ` David Carlton
2003-10-23 15:39           ` Mark Kettenis
2003-10-23 21:20             ` Jim Blandy
2003-10-23  1:29         ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F970598.9020908@redhat.com \
    --to=ac131313@redhat.com \
    --cc=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jimb@redhat.com \
    --cc=kewarken@qnx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox