When C_INCLUDE_PATH is defined and -I/usr/include is used, /usr/include should
have the precedence, but examples show that it is not taken into account.

vin:~> cat test.c
#include <mpfr.h>
vin:~> C_INCLUDE_PATH=/home/vlefevre/include gcc -E -I/usr/include test.c |
grep mpfr.h
# 1 "/home/vlefevre/include/mpfr.h" 1 3
[...]
vin:~> gcc -E -I/usr/include test.c | grep mpfr.h
# 1 "/usr/include/mpfr.h" 1 3 4
[...]
vin:~> C_INCLUDE_PATH=/home/vlefevre/include gcc -E
-I/usr/milip-local/stow/mpfr-2.2.0/mpfr/include test.c | grep mpfr.h
# 1 "/usr/milip-local/stow/mpfr-2.2.0/mpfr/include/mpfr.h" 1
[...]

The gcc man page says:

       -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.

so that in the first case, the search path should be:

  /usr/include /home/vlefevre/include /usr/include

equivalent to:

  /usr/include /home/vlefevre/include

Note: this introduces an inconsistency when both -I/usr/include and -L/usr/lib
are used, since the header file is taken from C_INCLUDE_PATH and the library
file is taken from /usr/lib.


-- 
           Summary: -I/usr/include not taken into account
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vincent at vinc17 dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31186

Reply via email to