User account creation filtered due to spam.

Bug 13498 - CPP include search path documentation is incorrect
Summary: CPP include search path documentation is incorrect
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 3.3.2
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: documentation
Depends on:
Reported: 2003-12-27 18:09 UTC by fcusack
Modified: 2005-11-02 01:41 UTC (History)
1 user (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2005-11-02 01:41:20

documentation patch (909 bytes, patch)
2004-05-27 23:52 UTC, fcusack
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description fcusack 2003-12-27 18:09:14 UTC
The Search Path node of the CPP docs says:

On a normal Unix system, if you do not instruct it otherwise, it will look for headers requested with 
#include <file> in:

This is incorrect AFAICT.  The default search path on my system (as seen from gcc -v ...) is:

I didn't pass any special options to configure (eg --with-local-prefix), and the path doesn't seem 
to come from a specs file, so I'm guessing this is the hardcoded default.  To be absolutely clear, 
the two errors I see are the missing GCC_EXEC_PREFIX/include (2nd dir in path), and the doc 
simply says "/usr" when actually it's GCC_EXEC_PREFIX.  (I'm using GCC_EXEC_PREFIX as shorthand 
for the --exec-prefix arg I passed to configure.)

On a system where GCC_EXEC_PREFIX = /usr, the docs are correct, however that is a specific 
configuration; for the general case the docs are in error (apparently).  It's especially worth noting 
that the /usr/include dir is always last even if, by the rules for the general case, it would be 2nd.

Ultimately, I guess it comes down to, what is a "normal unix system"?  Given that /usr/local is the 
default prefix, I think the docs should be updated.
Comment 1 Andrew Pinski 2003-12-27 19:35:14 UTC
It is better on the mainline, In the manual:

Which is closer than before.
Here is what I get from cpp -v x.c -o /dev/null:
Comment 2 fcusack 2004-05-27 23:52:40 UTC
Created attachment 6406 [details]
documentation patch

I removed the paragraph about dirs appearing twice based on my
testing, however you should verify before committing.