From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cagney To: jtc@redback.com Cc: gdb-patches@sourceware.cygnus.com Subject: Re: [RFA]: Remove unused header files. Date: Mon, 05 Mar 2001 08:11:00 -0000 Message-id: <3AA2C7A5.82230F3D@cygnus.com> References: <5mitltndwn.fsf@jtc.redback.com> X-SW-Source: 2001-03/msg00062.html "J.T. Conklin" wrote: > In several instances it identified two header files, and > , as unnecessary because 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 header files. Makes for very simple but absolutely lethal make file dependencies :-) o Every module define their own header and each component pull in the header files it is using. A variation on this theme has each of these header files [not] sucking in anything they refer to. 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 remain: 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 should be included but (to give a counter example) should be given the boot (see TODO file for details). Andrew