From mboxrd@z Thu Jan 1 00:00:00 1970 From: jtc@redback.com (J.T. Conklin) To: Andrew Cagney Cc: gdb-patches@sourceware.cygnus.com Subject: Re: [RFA]: Remove unused header files. Date: Tue, 06 Mar 2001 13:02:00 -0000 Message-id: <5m8zmi626r.fsf@jtc.redback.com> References: <5mitltndwn.fsf@jtc.redback.com> <3AA2C7A5.82230F3D@cygnus.com> X-SW-Source: 2001-03/msg00120.html >>>>> "Andrew" == Andrew Cagney writes: >> 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. Andrew> I'm aware of two strategies: Andrew> Andrew> o Every module include a Andrew> single header file and Andrew> that suck in all the other Andrew> header files. I've seen this technique used for small systems and it works well --- that is until it grows into a medium sized or large system. By then, the effort to convert to a sane include convention is so large it may never get done. IMO GDB is far beyond the size where this could work. Andrew> o Every module define their Andrew> own header and each component Andrew> pull in the header files it Andrew> is using. Andrew> Andrew> A variation on this theme has Andrew> each of these header files Andrew> [not] sucking in anything they Andrew> refer to. I'm in favor of this approach, including the variation where header files include the headers containing any macros, declarations, etc., they refer to. I've seen cases when this is not true, where a header must be included before another because of some implementation detail rather than a public interface. When the implementation changes, the header is no longer needed; but then all the source files need to be updated. This never seems to happen. Andrew> To get back to your question. I expect the status quo to Andrew> largely remain: Andrew> Andrew> o defs.h provide declarations for Andrew> the things that all of GDB uses. I agree. I do think there could be some culling of declarations in defs.h to module specific headers. Andrew> o module headers try to be largely Andrew> self contained. If they refer to other Andrew> headers then suck those headers in. Again I agree. In the absense of any objections, this sounds like this is a beginning of a include convention. Andrew> So should be included but (to give a counter example) Andrew> should be given the boot (see TODO file for details). So if we agree that should be included in defs.h, there is no reason why it should not be removed from all the *.c files that include defs.h. --jtc -- J.T. Conklin RedBack Networks