home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / programm / 3883 < prev    next >
Encoding:
Text File  |  1992-07-23  |  2.0 KB  |  55 lines

  1. Xref: sparky comp.unix.programmer:3883 comp.unix.questions:9372 comp.lang.c:11551
  2. Newsgroups: comp.unix.programmer,comp.unix.questions,comp.lang.c
  3. Path: sparky!uunet!mcsun!sunic!ericom!eos.ericsson.se!etxmesa
  4. From: etxmesa@eos.ericsson.se (Michael Salmon)
  5. Subject: Re: #include file dependancies
  6. Message-ID: <1992Jul24.072020.4090@ericsson.se>
  7. Sender: news@ericsson.se
  8. Nntp-Posting-Host: eos6c02.ericsson.se
  9. Reply-To: etxmesa@eos.ericsson.se (Michael Salmon)
  10. Organization: Ericsson Telecom AB
  11. References: <AJG.92Jul22114544@sp1.ccd.harris.com> <1992Jul23.144652.1785@b11.b11.ingr.com> <1992Jul23.212852.28935@cs.cornell.edu>
  12. Date: Fri, 24 Jul 1992 07:20:20 GMT
  13. Lines: 40
  14.  
  15. In article <1992Jul23.212852.28935@cs.cornell.edu>,
  16. ressler@cs.cornell.edu (Gene Ressler) writes:
  17. |> >>>>>> On Wed, 22 Jul 1992 16:45:44 GMT, ajg@controls.ccd.harris.com
  18. |> >>>>>> (Arnold Goldberg) said:
  19. |> >
  20. |> >    Arnold> What I'm looking for is a script or utility that will
  21. |> >    Arnold> somehow tell me which #include files are not actually
  22. |> >    Arnold> needed for a source file.
  23. [...]
  24. |> A more direct approach:
  25. |> 
  26. |> Write an awk script that omits the n'th #include from foo.c,
  27. |> to create, say foo.<n>.c.
  28. |> 
  29. |> Write a shell script checkincludes so that `checkincludes foo.c' does this:
  30. |> 
  31. |> Compile foo.c to foo.o (without debug info), saving cc's warnings.
  32. |> 
  33. |> Run the awk script for n=1,2,...,(stop when it can't find an n'th include)
  34. |> and apply cc to the result.  If cc completes on foo.<n>.c with the 
  35. |> same warnings (by a `cmp') as for foo.c, and foo.<n>.o matches foo.o
  36. |> (again by a `cmp'), then print `The <n>'th #include is not necessary.'
  37. |> 
  38. |> I'm sure you can see the possible problems and refinements.
  39.  
  40. I also thought of this approach but consider an include file that just
  41. has prototypes. Strictly speaking this isn't required for successful
  42. compilation but it is required for reliability and even perhaps for the
  43. program to run.
  44.  
  45. -- 
  46.  
  47. Michael Salmon
  48.  
  49. #include    <standard.disclaimer>
  50. #include    <witty.saying>
  51. #include    <fancy.pseudo.graphics>
  52.  
  53. Ericsson Telecom AB
  54. Stockholm
  55.