Skip to content

Commit ba9a9fd

Browse files
authored
builder: fix bug for incorrectly detecting tcc as icc, when V was installed in a path containing icc (#17271)
1 parent dcb9c3b commit ba9a9fd

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

vlib/v/builder/cc.v

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,14 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
196196
}
197197
}
198198
}
199-
//
200-
ccoptions.is_cc_tcc = ccompiler.contains('tcc') || ccoptions.guessed_compiler == 'tcc'
201-
ccoptions.is_cc_gcc = ccompiler.contains('gcc') || ccoptions.guessed_compiler == 'gcc'
202-
ccoptions.is_cc_icc = ccompiler.contains('icc') || ccoptions.guessed_compiler == 'icc'
203-
ccoptions.is_cc_msvc = ccompiler.contains('msvc') || ccoptions.guessed_compiler == 'msvc'
204-
ccoptions.is_cc_clang = ccompiler.contains('clang') || ccoptions.guessed_compiler == 'clang'
199+
ccompiler_file_name := os.file_name(ccompiler)
200+
ccoptions.is_cc_tcc = ccompiler_file_name.contains('tcc') || ccoptions.guessed_compiler == 'tcc'
201+
ccoptions.is_cc_gcc = ccompiler_file_name.contains('gcc') || ccoptions.guessed_compiler == 'gcc'
202+
ccoptions.is_cc_icc = ccompiler_file_name.contains('icc') || ccoptions.guessed_compiler == 'icc'
203+
ccoptions.is_cc_msvc = ccompiler_file_name.contains('msvc')
204+
|| ccoptions.guessed_compiler == 'msvc'
205+
ccoptions.is_cc_clang = ccompiler_file_name.contains('clang')
206+
|| ccoptions.guessed_compiler == 'clang'
205207
// For C++ we must be very tolerant
206208
if ccoptions.guessed_compiler.contains('++') {
207209
ccoptions.args << '-fpermissive'

0 commit comments

Comments
 (0)