public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* ARI `asection' and `sec_ptr'
@ 2003-02-24  6:41 Andrew Cagney
  2003-02-24 14:25 ` Daniel Jacobowitz
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Cagney @ 2003-02-24  6:41 UTC (permalink / raw)
  To: gdb

Hello,

Assuming I'm reading the code right.  BFD has the declarations:

typedef struct sec
{
   ...
} asection;
typedef struct sec *sec_ptr;

GDB uses all three (sec_ptr, asection, struct sec) and that makes things 
pretty confusing.  Consequently, I've added asection and sec_ptr to the 
ARI.  Instead people can use `struct sec *' which is consistent with 
GDB's other types.

enjoy,
Andrew

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ARI `asection' and `sec_ptr'
  2003-02-24  6:41 ARI `asection' and `sec_ptr' Andrew Cagney
@ 2003-02-24 14:25 ` Daniel Jacobowitz
  2003-02-24 15:05   ` Andrew Cagney
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Jacobowitz @ 2003-02-24 14:25 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb

On Mon, Feb 24, 2003 at 01:43:26AM -0500, Andrew Cagney wrote:
> Hello,
> 
> Assuming I'm reading the code right.  BFD has the declarations:
> 
> typedef struct sec
> {
>   ...
> } asection;
> typedef struct sec *sec_ptr;
> 
> GDB uses all three (sec_ptr, asection, struct sec) and that makes things 
> pretty confusing.  Consequently, I've added asection and sec_ptr to the 
> ARI.  Instead people can use `struct sec *' which is consistent with 
> GDB's other types.

Must you?  BFD makes a conscious effort to (almost always) use
asection* in its interfaces.  If you want to reduce bfd.h includes,
solve this one in BFD too.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ARI `asection' and `sec_ptr'
  2003-02-24 14:25 ` Daniel Jacobowitz
@ 2003-02-24 15:05   ` Andrew Cagney
  2003-02-24 15:18     ` Daniel Jacobowitz
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Cagney @ 2003-02-24 15:05 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

> On Mon, Feb 24, 2003 at 01:43:26AM -0500, Andrew Cagney wrote:
> 
>> Hello,
>> 
>> Assuming I'm reading the code right.  BFD has the declarations:
>> 
>> typedef struct sec
>> {
>>   ...
>> } asection;
>> typedef struct sec *sec_ptr;
>> 
>> GDB uses all three (sec_ptr, asection, struct sec) and that makes things 
>> pretty confusing.  Consequently, I've added asection and sec_ptr to the 
>> ARI.  Instead people can use `struct sec *' which is consistent with 
>> GDB's other types.
> 
> 
> Must you?  BFD makes a conscious effort to (almost always) use
> asection* in its interfaces.  If you want to reduce bfd.h includes,
> solve this one in BFD too.

Que?  Where, in the above did I mention #includes?  As I pointed out, 
GDB uses all three of these vis:

	asection *foo;
	sec_ptr foo;
	struct sec *foo;

so unless the developer happens to know this relationship, they can miss 
some vital relationships.

GDB's preference is `struct sec' however, yes, BFD may have other 
preferences.  You'll note that I've already sent out a patch to clarify 
the status of `struct _bfd'.

Andrew


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ARI `asection' and `sec_ptr'
  2003-02-24 15:05   ` Andrew Cagney
@ 2003-02-24 15:18     ` Daniel Jacobowitz
  2003-02-24 15:40       ` Andrew Cagney
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Jacobowitz @ 2003-02-24 15:18 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb

On Mon, Feb 24, 2003 at 10:08:00AM -0500, Andrew Cagney wrote:
> >On Mon, Feb 24, 2003 at 01:43:26AM -0500, Andrew Cagney wrote:
> >
> >>Hello,
> >>
> >>Assuming I'm reading the code right.  BFD has the declarations:
> >>
> >>typedef struct sec
> >>{
> >>  ...
> >>} asection;
> >>typedef struct sec *sec_ptr;
> >>
> >>GDB uses all three (sec_ptr, asection, struct sec) and that makes things 
> >>pretty confusing.  Consequently, I've added asection and sec_ptr to the 
> >>ARI.  Instead people can use `struct sec *' which is consistent with 
> >>GDB's other types.
> >
> >
> >Must you?  BFD makes a conscious effort to (almost always) use
> >asection* in its interfaces.  If you want to reduce bfd.h includes,
> >solve this one in BFD too.
> 
> Que?  Where, in the above did I mention #includes?  As I pointed out, 

I was just guessing at reasons for the preference.  Apparently I was
wrong.

> GDB uses all three of these vis:
> 
> 	asection *foo;
> 	sec_ptr foo;
> 	struct sec *foo;
> 
> so unless the developer happens to know this relationship, they can miss 
> some vital relationships.
> 
> GDB's preference is `struct sec' however, yes, BFD may have other 
> preferences.  You'll note that I've already sent out a patch to clarify 
> the status of `struct _bfd'.

Why is GDB's preference 'struct sec', and why should GDB have a
preference?  This is a BFD export; I believe we should use the one
which BFD prefers.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ARI `asection' and `sec_ptr'
  2003-02-24 15:18     ` Daniel Jacobowitz
@ 2003-02-24 15:40       ` Andrew Cagney
  2003-02-24 15:49         ` Daniel Jacobowitz
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Cagney @ 2003-02-24 15:40 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

> GDB's preference is `struct sec' however, yes, BFD may have other 
>> preferences.  You'll note that I've already sent out a patch to clarify 
>> the status of `struct _bfd'.
> 
> 
> Why is GDB's preference 'struct sec'

Please read GDB's internal document.

 >, and why should GDB have a
> preference?  This is a BFD export; I believe we should use the one
> which BFD prefers.

As I noted above, rather than guessing, I'm going to find out what the 
preference is.

Andrew


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ARI `asection' and `sec_ptr'
  2003-02-24 15:40       ` Andrew Cagney
@ 2003-02-24 15:49         ` Daniel Jacobowitz
  2003-02-24 16:18           ` Andrew Cagney
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Jacobowitz @ 2003-02-24 15:49 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb

On Mon, Feb 24, 2003 at 10:43:01AM -0500, Andrew Cagney wrote:
> >GDB's preference is `struct sec' however, yes, BFD may have other 
> >>preferences.  You'll note that I've already sent out a patch to clarify 
> >>the status of `struct _bfd'.
> >
> >
> >Why is GDB's preference 'struct sec'
> 
> Please read GDB's internal document.

It says:

   Declarations like `struct foo *' should be used in preference to
declarations like `typedef struct foo { ... } *foo_ptr'.

I believe that to be a different issue; I'm not suggesting we use
sec_ptr.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ARI `asection' and `sec_ptr'
  2003-02-24 15:49         ` Daniel Jacobowitz
@ 2003-02-24 16:18           ` Andrew Cagney
  2003-02-24 16:20             ` Daniel Jacobowitz
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Cagney @ 2003-02-24 16:18 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

It also says:

> A typedef definition should only appear in one include file.
> 
> An opaque struct declaration can appear in multiple `.h' files. Where possible, a `.h' file should use an opaque struct declaration instead of an include.

That should be clarified further.

Andrew

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ARI `asection' and `sec_ptr'
  2003-02-24 16:18           ` Andrew Cagney
@ 2003-02-24 16:20             ` Daniel Jacobowitz
  2003-03-01 13:41               ` Mark Kettenis
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Jacobowitz @ 2003-02-24 16:20 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb

On Mon, Feb 24, 2003 at 11:20:45AM -0500, Andrew Cagney wrote:
> It also says:
> 
> >A typedef definition should only appear in one include file.
> >
> >An opaque struct declaration can appear in multiple `.h' files. Where 
> >possible, a `.h' file should use an opaque struct declaration instead of 
> >an include.
> 
> That should be clarified further.

Thanks, that was what I was looking for.  I still prefer asection,
since it's the interface that binutils uses in exported interfaces, but
I don't have a strong preference.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ARI `asection' and `sec_ptr'
  2003-02-24 16:20             ` Daniel Jacobowitz
@ 2003-03-01 13:41               ` Mark Kettenis
  2003-03-01 15:13                 ` Andrew Cagney
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Kettenis @ 2003-03-01 13:41 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Andrew Cagney, gdb

Daniel Jacobowitz <drow@mvista.com> writes:

> Thanks, that was what I was looking for.  I still prefer asection,
> since it's the interface that binutils uses in exported interfaces, but
> I don't have a strong preference.

I really agree with Daniel here in that I think we should use the
types used in the interface definitions as much as possible.  For
stuff internal to GDB we whould of course prefer `struct *foo' over
using a typedf `foo_ptr'.

Mark

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ARI `asection' and `sec_ptr'
  2003-03-01 13:41               ` Mark Kettenis
@ 2003-03-01 15:13                 ` Andrew Cagney
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Cagney @ 2003-03-01 15:13 UTC (permalink / raw)
  To: Mark Kettenis, Daniel Jacobowitz; +Cc: gdb

> Daniel Jacobowitz <drow@mvista.com> writes:
> 
> 
>> Thanks, that was what I was looking for.  I still prefer asection,
>> since it's the interface that binutils uses in exported interfaces, but
>> I don't have a strong preference.


> I really agree with Daniel here in that I think we should use the
> types used in the interface definitions as much as possible.  For
> stuff internal to GDB we whould of course prefer `struct *foo' over
> using a typedf `foo_ptr'.

The interfaces defined in "bfd.h" uses both "asection" (~35) and "struct 
sec" (~25) so it is not that clear cut.

Per my earlier post, I've sort clarification on this matter.  So far, 
`struct bfd *' has already been formalized.

Andrew


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-03-01 15:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-24  6:41 ARI `asection' and `sec_ptr' Andrew Cagney
2003-02-24 14:25 ` Daniel Jacobowitz
2003-02-24 15:05   ` Andrew Cagney
2003-02-24 15:18     ` Daniel Jacobowitz
2003-02-24 15:40       ` Andrew Cagney
2003-02-24 15:49         ` Daniel Jacobowitz
2003-02-24 16:18           ` Andrew Cagney
2003-02-24 16:20             ` Daniel Jacobowitz
2003-03-01 13:41               ` Mark Kettenis
2003-03-01 15:13                 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).