Skip to content

Commit b274bb5

Browse files
committed
[Clang][Docs][NFC] Correct documentation for the CPATH environment variable.
Clang's current documentation for the `CPATH` environment variable states that paths it specifies are added as system header search paths. The actual behavior is that such paths are treated as though they were passed via `-I` options at the end of the driver command line and are thus added as non-system (user) header search paths. Clang's behavior is consistent with gcc as documented at https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html#index-CPATH. This change aligns Clang's documentation with the behavior actually observed. Additional editorial changes are included to clarify that the related `C_INCLUDE_PATH`, `CPLUS_INCLUDE_PATH`, `OBJC_INCLUDE_PATH`, and `OBJCPLUS_INCLUDE_PATH` environment variables specify additional paths that are treated as system header search paths (in contrast to `CPATH`).
1 parent 30a7c81 commit b274bb5

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

clang/docs/CommandGuide/clang.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -733,16 +733,17 @@ ENVIRONMENT
733733

734734
.. envvar:: CPATH
735735

736-
If this environment variable is present, it is treated as a delimited list of
737-
paths to be added to the default system include path list. The delimiter is
738-
the platform dependent delimiter, as used in the PATH environment variable.
739-
740-
Empty components in the environment variable are ignored.
736+
This environment variable specifies additional header file search paths which
737+
behave as if they were specified with the :option:`-I\<directory\>` option at
738+
the end of the driver command line. Paths are delimited by the platform
739+
dependent delimiter as used in the ``PATH`` environment variable. Empty
740+
components in the environment variable are ignored.
741741

742742
.. envvar:: C_INCLUDE_PATH, OBJC_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJCPLUS_INCLUDE_PATH
743743

744-
These environment variables specify additional paths, as for :envvar:`CPATH`, which are
745-
only used when processing the appropriate language.
744+
These environment variables specify additional system header file search
745+
paths to be used when processing the corresponding language. Search paths are
746+
delimited as for the :envvar:`CPATH` environment variable.
746747

747748
.. envvar:: MACOSX_DEPLOYMENT_TARGET
748749

0 commit comments

Comments
 (0)