CPLUS_INCLUDE_PATH confused by colons

Zack Weinberg zack@codesourcery.com
Mon Mar 25 13:12:00 GMT 2002


On Sun, Mar 24, 2002 at 05:49:26PM +0000, Nathan Sidwell wrote:
> Neil Booth wrote:
> 
> > These environment variables are a colon-separated list of
> > paths.  So you effectively have an empty-path here, which
> > is being treated as the current directory.  This is a
> > deliberate feature; whether it's a good idea I'm not
> This is a normal feature of the shell's PATH variable treatment.
> (One which I did not know about until 5 seconds ago.) So I guess
> existing practice makes it a '.'

Since we have decided to keep this behavior, it should be documented.
What do you think of this patch?  (It also corrects the description of
CPATH, which is equivalent to -isystem, not -I.)

zw

===================================================================
Index: doc/cppenv.texi
--- doc/cppenv.texi	2002/03/11 21:11:35	1.2
+++ doc/cppenv.texi	2002/03/25 20:57:43
@@ -24,14 +24,20 @@ determined at GCC build time.  For Windo
 semicolon, and for almost all other targets it is a colon.
 
 @env{CPATH} specifies a list of directories to be searched as if
-specified with @option{-I}, but after any paths given with @option{-I}
-options on the command line.  The environment variable is used
-regardless of which language is being preprocessed.
+specified with @option{-isystem}, hence after any paths given with
+@option{-I} options on the command line.  This environment variable is
+used regardless of which language is being preprocessed.
 
 The remaining environment variables apply only when preprocessing the
 particular language indicated.  Each specifies a list of directories
 to be searched as if specified with @option{-isystem}, but after any
 paths given with @option{-isystem} options on the command line.
+
+In all these variables, an empty element instructs the compiler to
+search its current working directory.  Empty elements can appear at the
+beginning or end of a path.  For instance, if the value of
+@env{C_INCLUDE_PATH} is @code{:/special/include}, that has the same
+effect as @samp{@w{-I. -I/special/include}}.
 
 @ifset cppmanual
 See also @ref{Search Path}.



More information about the Gcc-bugs mailing list