Re: Weeding out unwanted include files

gary@Intrepid.COM (Gary Funck)
Tue, 2 Aug 1994 22:35:26 GMT

          From comp.compilers

Related articles
Weeding out unwanted include files sriram@tcs.com (1994-07-28)
Re: Weeding out unwanted include files nandu@cs.clemson.edu (1994-07-29)
Re: Weeding out unwanted include files pzola@us.oracle.com (1994-07-30)
Re: Weeding out unwanted include files bill@amber.ssd.csd.harris.com (1994-08-02)
Re: Weeding out unwanted include files gary@Intrepid.COM (1994-08-02)
Re: Weeding out unwanted include files g9gwaigh@cdf.toronto.edu (1994-08-03)
Re: Weeding out unwanted include files zstern@adobe.com (1994-08-04)
Re: Weeding out unwanted include files steve@cegelecproj.co.uk (1994-08-04)
Re: Weeding out unwanted include files bkoehler@sol.UVic.CA (1994-08-04)
Re: Weeding out unwanted include files Don.Caldwell@DallasTX.NCR.COM (Don Caldwell) (1994-08-05)
Comparing object files shawn@grok90.columbiasc.NCR.COM (Shawn Shealy) (1994-08-08)
[8 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: gary@Intrepid.COM (Gary Funck)
Keywords: C, tools
Organization: Intrepid Technology, Inc.
References: 94-07-090
Date: Tue, 2 Aug 1994 22:35:26 GMT
Status: RO

Sriram Srinivasan (sriram@tcs.com) wrote:
: I want to develop a tool that finds out which include files are
: useless, so as to reduce compile time.


: My idea was to keep track of all global declarations, such as macro
: definitions, typedefs etc, and then look for usage of these declarations.
: I would keep track of the include file dependencies, and identify those
: include files that are not being referred to at all.


Well, the following method lacks elegance, but might give you the
result you're after.


1) run mkdepnd to derive the list of header files that a given source
file depends on.


2) iteratively remove the #include of each file mentioned in mkdepend
list. If the file still compiles, leave that #include out, and
continue to iterate. Otherwise, add the #include back in and
try removing the next mentioned header file, and continue to iterate.


This method probably works best if you use a strict ANSI compiler
that will complain if the prototype for a gaiven routine definition
is missing. You may have to consider type mismatch warnings as
"fatal" also.


This method won't give an optimal arrangement of #includes, but
may at least give a simple method for removing unwanted #include files.
--
| Gary Funck gary@intrepid.com
| Intrepid Technology Inc., Mountain View CA (415) 964-8135
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.