builder: replace single `goto start` usage, with `for { ... continue ... break}`

pull/7079/head
Delyan Angelov 2020-12-01 22:10:02 +02:00
parent c5cd53ca79
commit 394e9c4c56
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 326 additions and 324 deletions

View File

@ -225,9 +225,9 @@ fn (mut v Builder) cc() {
//
mut tried_compilation_commands := []string{}
original_pwd := os.getwd()
// TODO remove the start: goto start construct;
// use a labeled for break instead
start:
for {
// try to compile with the choosen compiler
// if compilation fails, retry again with another
mut ccompiler := v.pref.ccompiler
$if windows {
if ccompiler == 'msvc' {
@ -560,7 +560,7 @@ fn (mut v Builder) cc() {
}
eprintln('recompilation with tcc failed; retrying with cc ...')
v.pref.ccompiler = pref.default_c_compiler()
goto start
continue
}
if res.exit_code == 127 {
verror('C compiler error, while attempting to run: \n' +
@ -577,6 +577,8 @@ fn (mut v Builder) cc() {
println('$ccompiler took $diff ms')
println('=========\n')
}
break
}
// Link it if we are cross compiling and need an executable
/*
if v.os == .linux && !linux_host && v.pref.build_mode != .build {