tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] #include_next troubles


From: Edmund Grimley Evans
Subject: Re: [Tinycc-devel] #include_next troubles
Date: Wed, 21 Oct 2015 09:59:40 +0100

> From the clang code:
> ...
> // If this is a system #include, ignore the user #include locs.
> unsigned i = isAngled ? SystemDirIdx : 0;
> ...
> // If this is a #include_next request, start searching after the directory the
> // file was found in.
> if (FromDir)
>     i = FromDir-&SearchDirs[0];

That's nice, readable code! But you also need to understand how GCC
handles duplicate directories in the search path. Some documentation
says this:

"Duplicate directories are removed from the quote and bracket search
chains before the two chains are merged to make the final search
chain. Thus, it is possible for a directory to occur twice in the
final search chain if it was specified in both the quote and bracket
chains."

It seems, from strace and ltrace, that GCC detects duplicates by
stat-ing the path and looking at st_dev and st_ino. If you do "ln -s
xx xx1" then GCC does not search in xx when you do "gcc -E -Ixx1
-Ixx".

Edmund



reply via email to

[Prev in Thread] Current Thread [Next in Thread]