| ... | ... | @@ -8155,6 +8155,11 @@ static void detect_libc(CodeGen *g) { |
| 8155 | 8155 | |
| 8156 | 8156 | // does not add the "cc" arg |
| 8157 | 8157 | void add_cc_args(CodeGen *g, ZigList<const char *> &args, const char *out_dep_path, bool translate_c) { |
| 8158 | if (translate_c) { |
| 8159 | args.append("-x"); |
| 8160 | args.append("c"); |
| 8161 | } |
| 8162 | |
| 8158 | 8163 | if (out_dep_path != nullptr) { |
| 8159 | 8164 | args.append("-MD"); |
| 8160 | 8165 | args.append("-MV"); |
| ... | ... | @@ -8166,13 +8171,6 @@ void add_cc_args(CodeGen *g, ZigList<const char *> &args, const char *out_dep_pa |
| 8166 | 8171 | args.append("-fno-spell-checking"); |
| 8167 | 8172 | |
| 8168 | 8173 | if (translate_c) { |
| 8169 | | // TODO these args shouldn't be special from the non-translate-c args, probably. |
| 8170 | | args.append("-nobuiltininc"); |
| 8171 | | args.append("-nostdinc++"); |
| 8172 | | if (g->libc_link_lib == nullptr) { |
| 8173 | | args.append("-nolibc"); |
| 8174 | | } |
| 8175 | | |
| 8176 | 8174 | // this gives us access to preprocessing entities, presumably at |
| 8177 | 8175 | // the cost of performance |
| 8178 | 8176 | args.append("-Xclang"); |
| ... | ... | @@ -8293,9 +8291,16 @@ void codegen_translate_c(CodeGen *g, Buf *full_path, FILE *out_file, bool use_us |
| 8293 | 8291 | ZigList<const char *> clang_argv = {0}; |
| 8294 | 8292 | add_cc_args(g, clang_argv, nullptr, true); |
| 8295 | 8293 | |
| 8296 | | clang_argv.append("-c"); |
| 8297 | 8294 | clang_argv.append(buf_ptr(full_path)); |
| 8298 | 8295 | |
| 8296 | if (g->verbose_cc) { |
| 8297 | fprintf(stderr, "clang"); |
| 8298 | for (size_t i = 0; i < clang_argv.length; i += 1) { |
| 8299 | fprintf(stderr, " %s", clang_argv.at(i)); |
| 8300 | } |
| 8301 | fprintf(stderr, "\n"); |
| 8302 | } |
| 8303 | |
| 8299 | 8304 | clang_argv.append(nullptr); // to make the [start...end] argument work |
| 8300 | 8305 | |
| 8301 | 8306 | const char *resources_path = buf_ptr(g->zig_c_headers_dir); |