From e1bf74fca3de7943b8f7c15be4da3dbc8e3da17e Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 21 Apr 2019 20:19:48 -0400 Subject: translate-c: put -x c back in there, it's necessary --- src/codegen.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/codegen.cpp') 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 &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 &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 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); -- cgit v1.2.3