modify header precedence for zig cc, resolves intrinsics issues (#3027)

This commit is contained in:
Ryan Saunderson 2019-08-07 12:51:30 -05:00 committed by Andrew Kelley
parent 7f23dac6dc
commit 8fcf21fefc

View File

@ -8292,15 +8292,18 @@ void add_cc_args(CodeGen *g, ZigList<const char *> &args, const char *out_dep_pa
}
}
//note(dimenus): appending libc headers before c_headers breaks intrinsics
//and other compiler specific items
// According to Rich Felker libc headers are supposed to go before C language headers.
args.append("-isystem");
args.append(buf_ptr(g->zig_c_headers_dir));
for (size_t i = 0; i < g->libc_include_dir_len; i += 1) {
Buf *include_dir = g->libc_include_dir_list[i];
args.append("-isystem");
args.append(buf_ptr(include_dir));
}
// According to Rich Felker libc headers are supposed to go before C language headers.
args.append("-isystem");
args.append(buf_ptr(g->zig_c_headers_dir));
if (g->zig_target->is_native) {
args.append("-march=native");