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.
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:
Created attachment 6406 [details]
I removed the paragraph about dirs appearing twice based on my
testing, however you should verify before committing.