|Weeding out unwanted include files email@example.com (1994-07-28)|
|Re: Weeding out unwanted include files firstname.lastname@example.org (1994-07-29)|
|Re: Weeding out unwanted include files email@example.com (1994-07-30)|
|Re: Weeding out unwanted include files firstname.lastname@example.org (1994-08-02)|
|Re: Weeding out unwanted include files gary@Intrepid.COM (1994-08-02)|
|Re: Weeding out unwanted include files email@example.com (1994-08-03)|
|Re: Weeding out unwanted include files firstname.lastname@example.org (1994-08-04)|
|Re: Weeding out unwanted include files email@example.com (1994-08-04)|
|[9 later articles]|
|Date:||Fri, 29 Jul 1994 14:16:28 GMT|
!I want to develop a tool that finds out which include files are
!useless, so as to reduce compile time.
Rather than work at the high level of weeding out header files, you could
attempt to only retain those definitions and prototypes from header files
that are required in the program.
The pre-processor can do nothing to solve this problem because identifying
dead declarations involves flow analysis that can only be performed after
the intermediate representation is constructed. It is also hard for the
compiler to tell which header files are totally unnecessary because the
pre-processor would have already expanded it. Another problem arises when
definitions from a header file are never used in the file that includes
the header but are accessed as "extern" variables from another module! For
example, assume a.c and b.c are two source files constituting an
application. If file a.c includes math.h and never uses the enumerated
type fp_pi_type, the compiler would probably weed out the declaration.
But, what if b.c declares a variable as follows?
extern enum fp_pi_type my_fp_pi;
If you construct use-def chains, those chains that lack a definition would
probably trigger your definition-searcher. However, to solve the problem
described above, you probably can not weed out anything until link time.
I don't really see how you can reduce the compilation time. Object code
size, probably, since you will not carry unwanted information. The search
for definitions has to be performed each time a file is compiled since you
never know if any changes result in including some definitions that were
previously not required.
Nandakumar Sankaran, G34 Jordan, Comp. Sci. Dept., Clemson Univ. SC 29634
311-8 Old Greenville Hwy. Clemson SC 29631-1651 (803)653-7749
Return to the
Search the comp.compilers archives again.