home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16739 < prev    next >
Encoding:
Text File  |  1992-11-18  |  2.2 KB  |  64 lines

  1. Xref: sparky comp.lang.c:16739 gnu.gcc.help:2556
  2. Newsgroups: comp.lang.c,gnu.gcc.help
  3. Path: sparky!uunet!ukma!darwin.sura.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!newsaintmail
  4. From: sim@mdtf14.fnal.gov (Jim Sim)
  5. Subject: Include file directory search path
  6. Message-ID: <SIM.92Nov18151448@mdtf14.fnal.gov>
  7. Sender: daemon@linac.fnal.gov (The Background Man)
  8. Nntp-Posting-Host: mdtf14.fnal.gov
  9. Organization: Fermilab, Batavia, IL
  10. Distribution: usa
  11. Date: Wed, 18 Nov 1992 21:14:48 GMT
  12. Lines: 50
  13.  
  14. Is there a way to force the C preprocessor to use the same search path to
  15. locate nested include files (files included by another include file) 
  16. that it uses to locate non-nested include files. My motivation for doing 
  17. this is to allow developers to make "test" changes to nested include files 
  18. that don't affect "official" versions of those include files. Consider the 
  19. following:
  20.  
  21. main.c:
  22.  
  23. #include "non-nested.h"
  24.  
  25. main()
  26. {
  27.   /* Statements that use variables / macros declared / defined in 
  28.      nested.h. */
  29. }
  30.  
  31. non-nested.h:
  32.  
  33. #include "nested.h"
  34.  
  35. nested.h:
  36.  
  37. variables/macros 
  38.  
  39. cc -c main.c -I/usr/local/official main.c
  40.  
  41. or 
  42.  
  43. gcc -c main.c -I/usr/local/official main.c
  44.  
  45. If /usr/local/official contains both nested.h and non-nested.h files, while 
  46. the "test" directory contains only nested.h, the version of nested.h from the
  47. /usr/local/official directory is used by the preprocessor.  I would prefer it 
  48. to use /usr/local/official/non-nested.h and the version of nested.h 
  49. in the "test" directory.
  50.  
  51. There is no problem if the "test" directory contains non-nested.h in addition
  52. to nested.h.  In this case, the preprocessor uses both nested.h and 
  53. non-nested.h from the "test" directory.  However, I would prefer not to
  54. be required to copy /usr/local/official/non-nested.h to the "test" directory
  55. when I am not making changes to that file.
  56.  
  57. There is also no problem if I delete /usr/local/official/nested.h. In this
  58. case, because nested.h did not exist in the /usr/local/official directory,
  59. the preprocessor looked for it in the "test" directory. However, since 
  60. my make procedures have dependencies that force re-compilation of "official" 
  61. code (after SCCS extraction of /usr/local/official/nested.h), this results in 
  62. unnecessary recompilations.
  63.  
  64.