This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB 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: [RFC] missing #include in frame.h?


On Wed, 9 Apr 2003 16:38:42 -0400, Joel Brobecker <brobecker at gnat dot com> said:

> I am trying to see how much effort it needs to be able to build GDB on
> LynxOS 4.0, and found that gcc emits the following warning:

>     frame.h:698: warning: `struct gdbarch' declared inside parameter list
>     frame.h:698: warning: its scope is only this definition or declaration, which is probably not what you want.

> I am not sure whether we want to include gdbarch.h or not. Should we?
> Or maybe we should be including "defs.h". Shall I go ahead and do that
> (add #include "defs.h", and update Makefile.in)?

My impression is that the right thing in these situations is normally
to put an opaque declaration of the struct in question at the top of
the header file:

  struct gdbarch;

That way, header files can be included in any order without forcing
them to include each other.

But shouldn't all .c files inculde defs.h first?  (Indeed, that's what
GDB Internals says.)  Which file were you compiling when you got this
error?  Probably that file should be fixed to include defs.h before
frame.h, instead of changing frame.h.

David Carlton
carlton at math dot stanford dot edu


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