Re: Weeding out unwanted include files

zstern@adobe.com (Zalman Stern)
Thu, 4 Aug 1994 08:06:35 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)
Comparing object files meissner@osf.org (Michael Meissner) (1994-08-09)
Re: Weeding out unwanted include files ddunn@netcom.com (1994-08-13)
[6 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: zstern@adobe.com (Zalman Stern)
Keywords: C, tools
Organization: Adobe Systems Incorporated
References: 94-08-031
Date: Thu, 4 Aug 1994 08:06:35 GMT
Status: RO

Gary Funck writes
> 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.


In the following, is the include of foo.h in foo.c "required?" (Lest you
think I'm nitpicking, such situations exist in the project I'm working on
now. I consider at least one of them a bug, but not all code in the world is
well written.)


-----Contents of foo.h-----
#define foo "foo"
-----Contents of bar.h-----
#ifndef foo
#define foo "bar"
#endif


/* Make bar.h definitely required. */
#define output_function puts
-----Contents of foo.c-----
#include <stdio.h>
#include "foo.h"
#include "bar.h"


int main(void)
{
output_function(foo);
exit(0);
}
--
Zalman Stern zalman@adobe.com (415) 962 3824
Adobe Systems, 1585 Charleston Rd., POB 7900, Mountain View, CA 94039-7900
--


Post a followup to this message

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