Commit dbead49c by Nathan Sidwell Committed by Nathan Sidwell

cppinit.c (remove_dup_dirs): Inform if a system include directory is being reordered.

	* cppinit.c (remove_dup_dirs): Inform if a system include
        directory is being reordered.
	* doc/invoke.texi (Directory Options): GCC warns if you hide a
	system include.
	* doc/cpp.texi (Search Paths): Likewise.
	* doc/gcc.texi (Interoperation): Remove information about
	-I/usr/include.

From-SVN: r43769
parent 0cf97c8b
2001-07-04 Nathan Sidwell <nathan@codesourcery.com> 2001-07-04 Nathan Sidwell <nathan@codesourcery.com>
* cppinit.c (remove_dup_dirs): Inform if a system include
directory is being reordered.
* doc/invoke.texi (Directory Options): GCC warns if you hide a
system include.
* doc/cpp.texi (Search Paths): Likewise.
* doc/gcc.texi (Interoperation): Remove information about
-I/usr/include.
2001-07-04 Nathan Sidwell <nathan@codesourcery.com>
* varray.h (VARRAY_TOP_GENERIC_PTR): Remove spurious parameter. * varray.h (VARRAY_TOP_GENERIC_PTR): Remove spurious parameter.
(VARRAY_TOP_CHAR_PTR): Likewise. (VARRAY_TOP_CHAR_PTR): Likewise.
......
...@@ -297,6 +297,21 @@ remove_dup_dirs (pfile, head) ...@@ -297,6 +297,21 @@ remove_dup_dirs (pfile, head)
for (other = head; other != cur; other = other->next) for (other = head; other != cur; other = other->next)
if (INO_T_EQ (cur->ino, other->ino) && cur->dev == other->dev) if (INO_T_EQ (cur->ino, other->ino) && cur->dev == other->dev)
{ {
if (cur->sysp)
{
cpp_warning (pfile,
"changing search order for system directory \"%s\"",
cur->name);
if (strcmp (cur->name, other->name))
cpp_warning (pfile, other->sysp
? " as it is the same as system directory \"%s\""
: " as it is the same as non-system directory \"%s\"",
other->name);
else
cpp_warning (pfile, other->sysp
? " as it has already been specified as a system directory"
: " as it has already been specified as a non-system directory");
}
cur = remove_dup_dir (pfile, prev); cur = remove_dup_dir (pfile, prev);
break; break;
} }
......
...@@ -834,6 +834,12 @@ For example, if @file{/usr/include/sys/stat.h} contains ...@@ -834,6 +834,12 @@ For example, if @file{/usr/include/sys/stat.h} contains
@code{@w{#include "types.h"}}, GCC looks for @file{types.h} first in @code{@w{#include "types.h"}}, GCC looks for @file{types.h} first in
@file{/usr/include/sys}, then in its usual search path. @file{/usr/include/sys}, then in its usual search path.
If you name a search directory with @option{-I@var{dir}} that is also a
system include directory, the @option{-I} wins; the directory will be
searched according to the @option{-I} ordering, and it will not be
treated as a system include directory. GCC will warn you when a system
include directory is hidden in this way.
@samp{#line} (@pxref{Line Control}) does not change GCC's idea of the @samp{#line} (@pxref{Line Control}) does not change GCC's idea of the
directory containing the current file. directory containing the current file.
...@@ -1067,7 +1073,7 @@ All directories named by @option{-isystem} are searched @emph{after} all ...@@ -1067,7 +1073,7 @@ All directories named by @option{-isystem} are searched @emph{after} all
directories named by @option{-I}, no matter what their order was on the directories named by @option{-I}, no matter what their order was on the
command line. If the same directory is named by both @option{-I} and command line. If the same directory is named by both @option{-I} and
@option{-isystem}, @option{-I} wins; it is as if the @option{-isystem} option @option{-isystem}, @option{-I} wins; it is as if the @option{-isystem} option
had never been specified at all. had never been specified at all. GCC warns you when this happens.
@findex #pragma GCC system_header @findex #pragma GCC system_header
There is also a directive, @code{@w{#pragma GCC system_header}}, which There is also a directive, @code{@w{#pragma GCC system_header}}, which
......
...@@ -4363,6 +4363,17 @@ system header files (use @option{-isystem} for that). If you use more than ...@@ -4363,6 +4363,17 @@ system header files (use @option{-isystem} for that). If you use more than
one @option{-I} option, the directories are scanned in left-to-right one @option{-I} option, the directories are scanned in left-to-right
order; the standard system directories come after. order; the standard system directories come after.
If a standard system include directory, or a directory specified with
@option{-isystem}, is also specified with @option{-I}, it will be
searched only in the position requested by @option{-I}. Also, it will
not be considered a system include directory. If that directory really
does contain system headers, there is a good chance that they will
break. For instance, if GCC's installation procedure edited the headers
in @file{/usr/include} to fix bugs, @samp{-I/usr/include} will cause the
original, buggy headers to be found instead of the corrected ones. GCC
will issue a warning when a system include directory is hidden in this
way.
@item -I- @item -I-
@opindex I- @opindex I-
Any directories you specify with @option{-I} options before the @option{-I-} Any directories you specify with @option{-I} options before the @option{-I-}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment