Jonathan Wakely <jwakely.gcc@xxxxxxxxx> writes: > On 30 April 2011 12:39, ali hagigat wrote: >> 3.14 Options for Directory Search >> -Idir >> This is to ensure that GCCâs procedure to fix buggy system >> headers and the ordering for the include next directive are not >> inadvertently hanged. >> ----------------------------- >> Sorry I do not have the answer yet!! I understood "include_next" >> directive but what is the procedure of GCC to fix the system headers? > > GCC installs fixed versions of buggy system headers, as part of the > gcc installation tree. Those headers are used instead of the original > system ones. > > >> When we specify a path with -I and it is ignored because there is the >> same name in the system directories, how it can fix the system headers >> then? > > Because the system directories (including the one containing the fixed > headers) are still searched as normal. > > It really isn't complicated: if a directory is considered as a system > directory and it is also named with -I, then the -I option is ignored. > BUT THE DIRECTORY IS STILL SEARCHED AS A SYSTEM DIRECTORY. > > Like Ian said, if you say: > -isystem foo -I foo > then the -I option is ignored and it is equivalent to: > -isystem foo > > This ensures that if 'foo' contains buggy system headers then those > headers will not be found before the fixed versions, because gcc > searches the directory containing the fixed headers before it searches > other system directories. It is straightforward to test these options with a working version of gcc, to help clarify the documentation in your own mind. Ian