Subject: bug#22186: Use {C,CPLUS,OBJC}_INCLUDE_PATH instead of CPATH

From: Efraim Flashner <[email-masked]>
Date: Wed, 16 Dec 2015 22:18:37 +0200

On Wed, 16 Dec 2015 14:41:11 +0000
Andy Wingo <[email-masked]> wrote:

> Hi,
> 
> I am building GDB from git, because I want to hack on GDB.  I have a few
> build-related things in my profile, including GCC.  I enter an
> environment for GDB like this:
> 
>   guix environment gdb --ad-hoc flex autoconf-2.64
> 
> Cool.  Very good.  I build:
> 
>   mkdir +2.0
>   cd +2.0
>   ../configure --prefix=/opt/gdb
>   make
> 
[...]
> The answer is interesting!  I quote the GCC manual, section "Environment
> Variables":
> 
>     Some additional environment variables affect the behavior of the
>     preprocessor.
> 
>     'CPATH'
>     'C_INCLUDE_PATH'
>     'CPLUS_INCLUDE_PATH'
>     'OBJC_INCLUDE_PATH'
[...]
> 
> So!  CPATH is like -I but C_INCLUDE_PATH et al are like -isystem.
> Here's the docs for -isystem ("Preprocessor Options"):
> 
>     '-isystem DIR'
>          Search DIR for header files, after all directories specified by
>          '-I' but before the standard system directories.  Mark it as a
>          system directory, so that it gets the same special treatment as is
>          applied to the standard system directories.  If DIR begins with
>          '=', then the '=' will be replaced by the sysroot prefix; see
>          '--sysroot' and '-isysroot'.
> 
> What is a system directory?  Well, it's searched for after all -I
> includes, but also header files in it are marked as system headers.
> Many warnings are not issued for system headers; search the manual for
> the phrase "system headers".  For example:
> 
>     '-Wsystem-headers'
>          Issue warnings for code in system headers.  These are normally
>          unhelpful in finding bugs in your own code, therefore suppressed.
>          If you are responsible for the system library, you may want to see
>          them.
> 
> So.  We should be using C_INCLUDE_PATH instead of CPATH, to mark system
> headers as system headers.  Except that C_INCLUDE_PATH only works for C,
> so we need to also set CPLUS_INCLUDE_PATH and OBJC_INCLUDE_PATH.  And
> that's the proposal of this bug :)
> 
> Andy
> 

Are there other ones that could be set? Every time I compile it I see options
for java and go.

-- 
Efraim Flashner   <[email-masked]>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted