This is the mail archive of the
mailing list for the GDB project.
GDB's #include file policy
- To: GDB Discussion <gdb at sources dot redhat dot com>
- Subject: GDB's #include file policy
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Wed, 14 Mar 2001 18:51:44 -0500
(or lack there off :-)
Several recent patches have prompted the question of what guidelines, if
any, are there for GDB and its include files.
I think the short answer is that it hasn't had one and people have
simply done what was necessary to keep it building. I'd like to tighten
this, just a little, so that people don't need to guess what goes where
so here goes...
Every GDB file looks like:
the random bits are randomly ordered vis:
trying to do otherwize would likely break things on some target.
"defs.h" contains all the basic declarations including key types
(LONGEST) and some very standard includes. It also sucks in "config.h",
"bfd.h", "tm.h", "xm.h" and "nm.h". For the moment it sucks in
"gdbarch.h" and a few other headers as well. Header files should assume
that "defs.h" has already been included.
Outside of "defs.h", GDB header files should try to be self contained
(struct foo * VS typedef ...). If a header file uses typedefs from
another GDB header (but not defs.h) then that should really be dragged
in. This includes "tm.h" (until they are deleted). This includes
functions in macros (until they are deleted also :-).
GDB has wrapper system headers (eg "gdb_wait.h"). Where added, they
should try to use POSIX or ISO-C as guidelines. No real need to
introduce them until needed.
(Now the tricky bit) GDB headers should try to avoid sucking in system
header files. The exceptions are "defs.h" and "gdb_*.h". Probably also
"xm.h", "nm.h" and "terminal.h". I think the pratical reality is that
either "defs.h" will have already dragged the header file in (<stdio.h>)
or that a .C rather than a .H file should be doing the include.
"tm.h" and "xm.h" are definitly on the way out.
"nm.h" is probably heading the same way.
Hopefully this is sufficiently vague and waffly for no one to even