From ba9a9fdc2a4d86c7639b973e629bb17cfaca4f12 Mon Sep 17 00:00:00 2001 From: Riccardo <68387948+RIC217@users.noreply.github.com> Date: Thu, 9 Feb 2023 23:24:03 +0100 Subject: [PATCH] builder: fix bug for incorrectly detecting `tcc` as `icc`, when V was installed in a path containing `icc` (#17271) --- vlib/v/builder/cc.v | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index b9ccee2298..a20746b7ac 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -196,12 +196,14 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) { } } } - // - ccoptions.is_cc_tcc = ccompiler.contains('tcc') || ccoptions.guessed_compiler == 'tcc' - ccoptions.is_cc_gcc = ccompiler.contains('gcc') || ccoptions.guessed_compiler == 'gcc' - ccoptions.is_cc_icc = ccompiler.contains('icc') || ccoptions.guessed_compiler == 'icc' - ccoptions.is_cc_msvc = ccompiler.contains('msvc') || ccoptions.guessed_compiler == 'msvc' - ccoptions.is_cc_clang = ccompiler.contains('clang') || ccoptions.guessed_compiler == 'clang' + ccompiler_file_name := os.file_name(ccompiler) + ccoptions.is_cc_tcc = ccompiler_file_name.contains('tcc') || ccoptions.guessed_compiler == 'tcc' + ccoptions.is_cc_gcc = ccompiler_file_name.contains('gcc') || ccoptions.guessed_compiler == 'gcc' + ccoptions.is_cc_icc = ccompiler_file_name.contains('icc') || ccoptions.guessed_compiler == 'icc' + ccoptions.is_cc_msvc = ccompiler_file_name.contains('msvc') + || ccoptions.guessed_compiler == 'msvc' + ccoptions.is_cc_clang = ccompiler_file_name.contains('clang') + || ccoptions.guessed_compiler == 'clang' // For C++ we must be very tolerant if ccoptions.guessed_compiler.contains('++') { ccoptions.args << '-fpermissive'