home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!linac!att!att!dptg!ulysses!ulysses.att.com!gsf
- From: gsf@ulysses.att.com (Glenn S. Fowler)
- Subject: Re: Include file directory search path
- Message-ID: <1992Nov21.033034.12368@ulysses.att.com>
- Date: Sat, 21 Nov 1992 03:30:34 GMT
- References: <SIM.92Nov18151448@mdtf14.fnal.gov> <1992Nov19.171758.14067@eagercon.com>
- Organization: AT&T Bell Labs
- Lines: 38
-
- In article <1992Nov19.171758.14067@eagercon.com> eager@eagercon.com writes:
- >In article 92Nov18151448@mdtf14.fnal.gov, sim@mdtf14.fnal.gov (Jim Sim) writes:
- >>Is there a way to force the C preprocessor to use the same search path to
- >>locate nested include files (files included by another include file)
- >>that it uses to locate non-nested include files. My motivation for doing
- >>this is to allow developers to make "test" changes to nested include files
- >>that don't affect "official" versions of those include files.
- >
- >The compiler uses the same directory search path for all included files.
-
- true if all includes are <...>
- "..." include searching, however, is up to the compiler implementation
- there are two popular "..." include search styles
-
- 1) K&R: first check the current directory, then the <...> directories,
- where the current directory is usually the directory of the top level
- source file
- 2) "Reiser" (the traditional standalone UNIX cpp): first check the directory
- of the including file, then the <...> directories
-
- there is no standard "..." include style
- ANSI C leaves it as implementation-defined
-
- 1 & 2 cause trouble in the case mentioned above -- for most C compilers
- it is impossible to override a nested "..." include from a local dir
-
- AT&T does a lot a viewpathing, so this situation is not acceptable
- our local cpp accepts the option -I- that treats all includes as <...>
- to avoid the problem -- note, however, that using -I- may require
- additional -I dirs, e.g., for a "sys/foo.h" in -Ixxx that includes "sys/bar.h"
- as "bar.h" (using 2 above), an additional -Ixxx/sys is required
- our local make generates the -I options, so we avoid most of the
- -I maintenance problems
-
- GNU cc picked up -I- a few years back
-
- Glenn Fowler (908)-582-2195 AT&T Bell Laboratories, Murray Hill, NJ
- uucp: {att,ucbvax}!ulysses!gsf internet: gsf@ulysses.att.com
-