When passing -nostdinc to Clang, the builtin header search path is also removed. I find that surprising, since -nobuiltininc also removes the builtin header search path. I would find the following more natural:
-nostdinc removes the standard C system headers, but not the builtin headers
-nobuiltininc removes the builtin headers, but nothing else
-nostdinc++ removes the standard C++ system headers, and nothing else
Is there a rationale for the current behavior? Is this the kind of thing that we could change, or would that absolutely require introducing a new flag for fear of breaking users?
Re: Why does -nostdinc also remove builtin headers?
On Thu, Sep 05, 2019 at 05:21:45PM -0400, Louis Dionne via cfe-dev wrote:
> When passing -nostdinc to Clang, the builtin header search path is also
> removed. I find that surprising, since -nobuiltininc also removes the
> builtin header search path.
The option has been around like that for a long time and quite a bit of
code depends on it. The separation between "builtin" headers and
"system" headers is also quite platform specific, e.g. often
non-existing on the BSDs.