[RFA]: Remove unused header files.
Mon Mar 5 08:11:00 GMT 2001
"J.T. Conklin" wrote:
> In several instances it identified two header files, <errno.h> and
> <linespec.h>, as unnecessary because <errno.h> is unconditionally
> included in defs.h; and the only declaration in linespec.h
> (decode_line_1) is also defined in symtab.h.
> I'm unsure about the correct way to handle those are. As long as
> errno.h is included in defs.h, I see no reason to include it in any
> *.c file. One could argue that errno.h should be remove from defs.h,
> but since errno (or the E* macros) is used in almost every file, I
> suspect we'd have to #include it in many files.
I'm aware of two strategies:
o Every module include a
single header file and
that suck in all the other
Makes for very simple but
absolutely lethal make file
o Every module define their
own header and each component
pull in the header files it
A variation on this theme has
each of these header files
[not] sucking in anything they
GDB clearly has a foot in both of those camps (and the second foot has
both of those variations squished between its toes .... :-).
"defs.h" contains declarations that various modules can't live without.
Each module header contains declarations specific to their module. How
self contained a module header file is, is pretty arbitrary.
To get back to your question. I expect the status quo to largely
o defs.h provide declarations for
the things that all of GDB uses.
o module headers try to be largely
self contained. If they refer
to other headers then suck
those headers in.
So <errno.h> should be included but (to give a counter example)
<endian.h> should be given the boot (see TODO file for details).
More information about the Gdb-patches