diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-04-21 20:19:48 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-04-25 00:06:58 -0400 |
| commit | e1bf74fca3de7943b8f7c15be4da3dbc8e3da17e (patch) | |
| tree | 177a4093eae23bd6e1f5bb3c990dee4cccbdf033 /src/codegen.cpp | |
| parent | 535d4195907de8a7e494b0480c394634d4c6034a (diff) | |
| download | zig-e1bf74fca3de7943b8f7c15be4da3dbc8e3da17e.tar.gz zig-e1bf74fca3de7943b8f7c15be4da3dbc8e3da17e.zip | |
translate-c: put -x c back in there, it's necessary
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 27e2195a3c..8d39c60ef7 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -8155,6 +8155,11 @@ static void detect_libc(CodeGen *g) { // does not add the "cc" arg void add_cc_args(CodeGen *g, ZigList<const char *> &args, const char *out_dep_path, bool translate_c) { + if (translate_c) { + args.append("-x"); + args.append("c"); + } + if (out_dep_path != nullptr) { args.append("-MD"); args.append("-MV"); @@ -8166,13 +8171,6 @@ void add_cc_args(CodeGen *g, ZigList<const char *> &args, const char *out_dep_pa args.append("-fno-spell-checking"); if (translate_c) { - // TODO these args shouldn't be special from the non-translate-c args, probably. - args.append("-nobuiltininc"); - args.append("-nostdinc++"); - if (g->libc_link_lib == nullptr) { - args.append("-nolibc"); - } - // this gives us access to preprocessing entities, presumably at // the cost of performance args.append("-Xclang"); @@ -8293,9 +8291,16 @@ void codegen_translate_c(CodeGen *g, Buf *full_path, FILE *out_file, bool use_us ZigList<const char *> clang_argv = {0}; add_cc_args(g, clang_argv, nullptr, true); - clang_argv.append("-c"); clang_argv.append(buf_ptr(full_path)); + if (g->verbose_cc) { + fprintf(stderr, "clang"); + for (size_t i = 0; i < clang_argv.length; i += 1) { + fprintf(stderr, " %s", clang_argv.at(i)); + } + fprintf(stderr, "\n"); + } + clang_argv.append(nullptr); // to make the [start...end] argument work const char *resources_path = buf_ptr(g->zig_c_headers_dir); |
