Re: [RFA]: Remove unused header files.

J.T. Conklin
2001-03-02T16:34:00Z

>>>>> " Andrew" == Andrew Cagney <ac131313@cygnus.com> writes:
Andrew> GDB currently has some really obscure and effectivly hidden include
Andrew> dependencies. For instance, given the target mn10200-elf you find:
Andrew>
Andrew> values.c uses EXTRACT_RETURN_VALUE
Andrew>
Andrew> config/mn10200/tm-mn10200.h's definition
Andrew> refers to something declared in regcache.h
Andrew>
Andrew> values.c includes "tm.h" to get at EXTRACT_RETURN_VALUE and
Andrew> consequently needs a declaration for regcache.h.
Andrew>
Andrew> Does your lint handle this?

Yes and no. If I was linting GDB configured for the mn10200, it
regcache.h would be considered necessary, but for other cases it
would not. Since I'm not planning on linting every possible config
before deciding whether a header is unnecessary, it's not up to the
job.

However, I question whether it has to be. Why should GDB have obscure
and effectively hidden include dependencies? We can eliminate them so
that *.c files include the headers that are required by all configs,
and have tm-, nm-, or xm- headers that require extra headers due to
macro definitions to include them themselves. Alternatively, we can
include all the headers in defs.h to ensure that all such headers have
access to the declarations. I'm not fond of the latter --- I'm trying
to decrease the number of headers being processed for each module, not
increase them.

I think requiring the tm-, nm-, and xm- headers to include dependent
headers is desirable. While it will add some compilation overhead to
some configs, it should be only until they are multi-arched. That can
be addressed even before multi-arch, since the macros can be converted
to functions and moved to the appropriate -tdep.c or -nat.c file.

--jtc