1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: initialize globals with default initializer when none is given. (#10979)

This commit is contained in:
Uwe Krüger
2021-07-27 19:14:30 +02:00
committed by GitHub
parent a56f579e0d
commit abd17ddb6a
3 changed files with 51 additions and 2 deletions

View File

@ -266,6 +266,10 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
tls_bench.no_cstep = true
dot_relative_file := p.get_item<string>(idx)
mut relative_file := dot_relative_file.replace('./', '')
mut cmd_options := [ts.vargs]
if relative_file.contains('global') && !ts.vargs.contains('fmt') {
cmd_options << ' -enable-globals'
}
if ts.root_relative {
relative_file = relative_file.replace(ts.vroot + os.path_separator, '')
}
@ -285,7 +289,6 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
os.rm(generated_binary_fpath) or { panic(err) }
}
}
mut cmd_options := [ts.vargs]
if !ts.vargs.contains('fmt') {
cmd_options << ' -o "$generated_binary_fpath"'
}