On Mon, Jan 17, 2005 at 10:21:14AM -0800, Linus Torvalds wrote:
>
> Is the gcc logic documented somewhere? Ie what are the relevant rules for
> -I, -isystem, -iprefix, -idirafter etc, and how do they interact with
>
> #include "file.h"
> #include <file.h>
After browsing info files this is my current understanding:
gcc has a built-in set of systemdirs
user can add userdirs with -I
Duplicate directories added with -I does not change type from system to
user and is not added.
userdirs are searched before systemdirs
"." is searched as the very first directory if -I- is not present.
-nostdinc causes all systemdirs know to gcc to be invalidated - so one
may add systemdirs later (with -isystem)
-I- causes gcc to
1) do not search home dir of .c file
2) all userdirs (-I dir) specified before -I- are used to find files included
with include ""
3) all userdirs specified after -I- are used as usual for both include
"" and include <>
4) -I- has no impact on systemdirs
-dirafter DIR
add a directory as the very last dir to be searched in the chain
-prefix and friends are to braindead to support
I'm trying to implement the above 'logic' right now.
The basis datastructure looks like this so far:
struct includepath {
int searchlocaldir; /* =0 if -I- has been given */
struct path {
enum dirtype {
systemdir, /* defined here or by -isystemdir */
userdir, /* defined by -I */
userlim, /* limited to include "" (by -I-) */
empty /* skip, try next */
} dirtype;
const char *dirpath;
} path[INCLUDEPATHS];
};
struct xincludepath xxincludepath = {
.searchlocaldir = 1,
.path = {
{ .dirtype = systemdir, .dirpath = "/usr/include" },
{ .dirtype = systemdir, .dirpath = "/usr/local/include" },
{ .dirtype = systemdir, .dirpath = GCC_INTERNAL_INCLUDE },
{ .dirtype = userdir, .dirpath = "." }
}
};
This is just what I have mocked up so far - may change considerably..
Sam
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html