zig
zig copied to clipboard
User-provided `-isystem` ordered after Zig-provided libc
Zig Version
0.11.0-dev.106+e53a542e0
Steps to Reproduce and Observed Behavior
clang -xc -isystem test -E /dev/null -v shows -isystem at the top of the system search list:
#include <...> search starts here:
test
/usr/lib/llvm-14/lib/clang/14.0.6/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
Running zig build-obj foo.c -isystem test --verbose-cc and then adding -v to the invocation shows that Zig's stdlib and host-detected libc directories appear first:
#include <...> search starts here:
/home/topolarity/repos/zig/lib/include
/usr/include
/usr/include/x86_64-linux-gnu
test
Expected Behavior
Behavior should match clang - automatic standard library includes should come after user-provided ones.
This ordering is required to be able to provide libc++ via -isystem (e.g. from the LLVM docs)
Related: https://github.com/ziglang/zig/issues/12888