Article View: comp.unix.programmer
Article #104Re: #include file dependancies
From: Michael Salmon
Date: Fri, 24 Jul 1992 07:20
Date: Fri, 24 Jul 1992 07:20
40 lines
2057 bytes
2057 bytes
In article <1992Jul23.212852.28935@cs.cornell.edu>, ressler@cs.cornell.edu (Gene Ressler) writes: |> >>>>>> On Wed, 22 Jul 1992 16:45:44 GMT, ajg@controls.ccd.harris.com |> >>>>>> (Arnold Goldberg) said: |> > |> > Arnold> What I'm looking for is a script or utility that will |> > Arnold> somehow tell me which #include files are not actually |> > Arnold> needed for a source file. [...] |> A more direct approach: |> |> Write an awk script that omits the n'th #include from foo.c, |> to create, say foo.<n>.c. |> |> Write a shell script checkincludes so that `checkincludes foo.c' does this: |> |> Compile foo.c to foo.o (without debug info), saving cc's warnings. |> |> Run the awk script for n=1,2,...,(stop when it can't find an n'th include) |> and apply cc to the result. If cc completes on foo.<n>.c with the |> same warnings (by a `cmp') as for foo.c, and foo.<n>.o matches foo.o |> (again by a `cmp'), then print `The <n>'th #include is not necessary.' |> |> I'm sure you can see the possible problems and refinements. I also thought of this approach but consider an include file that just has prototypes. Strictly speaking this isn't required for successful compilation but it is required for reliability and even perhaps for the program to run. -- Michael Salmon #include <standard.disclaimer> #include <witty.saying> #include <fancy.pseudo.graphics> Ericsson Telecom AB Stockholm
Technical Details
Message-ID:
<1992Jul24.072020.4090@ericsson.se>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!ericom!eos.ericsson.se!etxmesaReferences:
<AJG.92Jul22114544@sp1.ccd.harris.com> <1992Jul23.144652.1785@b11.b11.ingr.com> <1992Jul23.212852.28935@cs.cornell.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.programmer,comp.unix.questions,comp.lang.c Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!ericom!eos.ericsson.se!etxmesa From: etxmesa@eos.ericsson.se (Michael Salmon) Subject: Re: #include file dependancies Message-ID: <1992Jul24.072020.4090@ericsson.se> Sender: news@ericsson.se Nntp-Posting-Host: eos6c02.ericsson.se Reply-To: etxmesa@eos.ericsson.se (Michael Salmon) Organization: Ericsson Telecom AB References: <AJG.92Jul22114544@sp1.ccd.harris.com> <1992Jul23.144652.1785@b11.b11.ingr.com> <1992Jul23.212852.28935@cs.cornell.edu> Date: Fri, 24 Jul 1992 07:20:20 GMT Lines: 40