Re: Weeding out unwanted include files

g9gwaigh@cdf.toronto.edu (Geoffrey P Waigh)
Wed, 3 Aug 1994 22:40:55 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)
Re: Weeding out unwanted include files ddunn@netcom.com (1994-08-13)
Re: Weeding out unwanted include files throop@aur.alcatel.com (1994-08-14)
[5 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: g9gwaigh@cdf.toronto.edu (Geoffrey P Waigh)
Keywords: C, tools
Organization: University of Toronto Computing Disciplines Facility
References: 94-08-031
Date: Wed, 3 Aug 1994 22:40:55 GMT
Status: RO

gary@Intrepid.COM (Gary Funck) writes:
>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.


The problem is "compiles" and generates the correct code are different
things. In some cases header files remap function names to deal with
linkage conflicts or contain ifdefs that select a code variant depending
on the environment. If you remove one of these headers, you may get a
binary but it won't do you much good.


To support the full complexity of the C preprocessor requires a detailed
pass over the source - especially if you want the tool to examine the
contents of conditional compilation blocks.


Geoffrey Waigh
g9gwaigh@cdf.utoronto.ca
--


Post a followup to this message

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