From 570f84933c3d5019a543e0134d75f28d89a17e25 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 19 Dec 2024 14:19:57 +0200 Subject: [PATCH] v.builder: move filtering logic for `-parallel-cc` to parallel_cc.v --- vlib/v/builder/cbuilder/parallel_cc.v | 3 ++- vlib/v/builder/cc.v | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/vlib/v/builder/cbuilder/parallel_cc.v b/vlib/v/builder/cbuilder/parallel_cc.v index 9c19853f3d..c3d403089c 100644 --- a/vlib/v/builder/cbuilder/parallel_cc.v +++ b/vlib/v/builder/cbuilder/parallel_cc.v @@ -84,6 +84,7 @@ fn parallel_cc(mut b builder.Builder, result c.GenOutput) { } scompile_args := compile_args.join(' ') slinker_args := linker_args.join(' ') + scompile_args_for_linker := compile_args.filter(it != '-x objective-c').join(' ') mut o_postfixes := ['0', 'x'] mut cmds := []string{} @@ -100,7 +101,7 @@ fn parallel_cc(mut b builder.Builder, result c.GenOutput) { eprint_time(sw, 'C compilation on ${util.nr_jobs} thread(s), processing ${cmds.len} commands') obj_files := fnames.map(it.replace('.c', '.o')).join(' ') - link_cmd := '${cc} ${scompile_args} -o ${os.quoted_path(b.pref.out_name)} ${tmp_dir}/out_0.o ${obj_files} ${tmp_dir}/out_x.o ${slinker_args} ${cc_ldflags}' + link_cmd := '${cc} ${scompile_args_for_linker} -o ${os.quoted_path(b.pref.out_name)} ${tmp_dir}/out_0.o ${obj_files} ${tmp_dir}/out_x.o ${slinker_args} ${cc_ldflags}' sw_link := time.new_stopwatch() link_res := os.execute(link_cmd) eprint_result_time(sw_link, 'link_cmd', link_cmd, link_res) diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index e14b653fe9..0ff9f5b0d5 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -371,9 +371,7 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) { // macOS code can include objective C TODO remove once objective C is replaced with C if v.pref.os in [.macos, .ios] { if ccoptions.cc != .tcc && !user_darwin_ppc && !v.pref.is_bare && ccompiler != 'musl-gcc' { - if !v.pref.parallel_cc { - ccoptions.source_args << '-x objective-c' - } + ccoptions.source_args << '-x objective-c' } } // The C file we are compiling