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

From: Mark Wielaard <[email-masked]>
Date: Sat, 14 Dec 2019 15:23:51 +0100

I am seeing this issue with guix (GNU Guix)
f69439dff438e59fbd24b76949b8767360f2cd72 using gcc (GCC) 9.2.0.

e.g.

$ cat > t.c 
#include <error.h>

int main()
{
  error (0, 0, "what!?");
  return 0;
}

$ gcc -Wformat -Wformat-nonliteral -Werror -g -O2 -o t t.c
In file included from /home/mark/.guix-profile/include/error.h:52,
                 from t.c:1:
/home/mark/.guix-profile/include/bits/error.h: In function ‘error’:
/home/mark/.guix-profile/include/bits/error.h:39:5: error: format not a
string literal, argument types not checked [-Werror=format-nonliteral]
   39 |     __error_noreturn (__status, __errnum, __format,
__va_arg_pack ());
      |     ^~~~~~~~~~~~~~~~
/home/mark/.guix-profile/include/bits/error.h:41:5: error: format not a
string literal, argument types not checked [-Werror=format-nonliteral]
   41 |     __error_alias (__status, __errnum, __format, __va_arg_pack
());
      |     ^~~~~~~~~~~~~
/home/mark/.guix-profile/include/bits/error.h: In function
‘error_at_line’:
/home/mark/.guix-profile/include/bits/error.h:68:10: error: format not
a string literal, argument types not checked [-Werror=format-
nonliteral]
   68 |          __va_arg_pack ());
      |          ^~~~~~~~~~~~~
/home/mark/.guix-profile/include/bits/error.h:71:7: error: format not a
string literal, argument types not checked [-Werror=format-nonliteral]
   71 |       __format, __va_arg_pack ());
      |       ^~~~~~~~
cc1: all warnings being treated as errors

And indeed only CPATH is set, but not C_INCLUDE_PATH.
unsetting CPATH and setting C_INCLUDE_PATH does resolve the issue.