Skip to content

Commit 4420bbb

Browse files
committed
fix remaining master CI regressions
1 parent 14e5ba3 commit 4420bbb

22 files changed

Lines changed: 208 additions & 66 deletions

cmd/tools/vtest-self.v

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ const skip_on_ubuntu_musl = [
295295
'vlib/orm/orm_serial_attribute_test.v',
296296
'vlib/orm/orm_option_subselect_test.v',
297297
'vlib/orm/orm_func_test.v',
298+
'vlib/orm/orm_module_table_prefix/orm_module_table_prefix_test.v',
298299
'vlib/orm/orm_where_in_test.v',
299300
'vlib/sokol/gfx/gfx_test.v', // sokol_app.h needs GL/gl.h, not installed in the musl Docker image
300301
'vlib/v/gen/c/sql_assert_temp_var_test.v', // sqlite header dependency pulls in glibc sys/cdefs.h on musl-gcc

vlib/db/pg/pg_escape_literal_test.v

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// vtest build: started_postgres?
12
module main
23

34
import db.pg

vlib/io/buffered_reader_test.v

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ fn test_read_handles_eof_with_unread_data() {
244244
}
245245

246246
fn test_read_line_handles_eof_with_unread_data() {
247-
b := rand.bytes(8)!
247+
// Keep the payload delimiter-free; random bytes can contain `\n` and make
248+
// read_line correctly return a shorter first line.
249+
b := 'abcdefgh'.bytes()
248250
data := arrays.concat(b, `\n`)
249251
mut br := new_one_byte_buffered_reader(data, 16)
250252
mut p := br.peek(10)!

vlib/sync/mutex_zero_value_darwin_test.c.v

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// vtest build: macos
12
import sync
23

34
struct MutexHolder {

vlib/v/gen/c/cgen.v

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13632,6 +13632,11 @@ fn (mut g Gen) type_default_impl(typ_ ast.Type, decode_sumtype bool) string {
1363213632
return '{0}'
1363313633
}
1363413634
.thread {
13635+
// Windows uses a struct for typed thread handles, while untyped Windows
13636+
// handles and POSIX pthread_t values are scalar types.
13637+
if g.pref.os == .windows && g.styp(typ) != '__v_thread' {
13638+
return '{0}'
13639+
}
1363513640
return '0'
1363613641
}
1363713642
.alias {

vlib/v/gen/c/struct.v

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,18 @@ fn (mut g Gen) struct_init_field_default(field_unwrap_typ ast.Type, sfield &ast.
12971297

12981298
if sfield.expected_type.has_flag(.option) && field_unwrap_typ.has_flag(.option)
12991299
&& g.styp(sfield.expected_type) != g.styp(field_unwrap_typ) {
1300-
g.expr_opt_with_cast(sfield.expr, field_unwrap_typ, sfield.expected_type)
1300+
expr_base_typ := g.table.unaliased_type(field_unwrap_typ.clear_flag(.option))
1301+
expected_base_typ := g.table.unaliased_type(sfield.expected_type.clear_flag(.option))
1302+
expr_base_sym := g.table.final_sym(expr_base_typ)
1303+
expected_base_sym := g.table.final_sym(expected_base_typ)
1304+
if expr_base_typ == expected_base_typ
1305+
|| (expr_base_sym.kind == .function && expected_base_sym.kind == .function) {
1306+
// Alias-equivalent payloads have the same representation. Clone the complete
1307+
// option so `none` and error state are preserved along with the payload.
1308+
g.expr_opt_with_alias(sfield.expr, field_unwrap_typ, sfield.expected_type)
1309+
} else {
1310+
g.expr_opt_with_cast(sfield.expr, field_unwrap_typ, sfield.expected_type)
1311+
}
13011312
} else if (sfield.expected_type.has_flag(.option) && !field_unwrap_typ.has_flag(.option))
13021313
|| (sfield.expected_type.has_flag(.result) && !field_unwrap_typ.has_flag(.result)) {
13031314
g.expr_with_opt(sfield.expr, field_unwrap_typ, sfield.expected_type)

vlib/v/tests/gnu_make_tcc_fallback_test.v

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ printf "%s\\n" "\$*" >> ${os.quoted_path(rsync_trace)}
140140
archive=0
141141
delete_destination=0
142142
exclude_root_github=0
143+
exclude_root_git=0
143144
while [ "\$#" -gt 0 ]; do
144145
case "\$1" in
145146
-a)
@@ -154,6 +155,10 @@ while [ "\$#" -gt 0 ]; do
154155
exclude_root_github=1
155156
shift
156157
;;
158+
--exclude=/.git|--exclude=/.git/)
159+
exclude_root_git=1
160+
shift
161+
;;
157162
--)
158163
shift
159164
break
@@ -195,12 +200,12 @@ for source_path in "\$@"; do
195200
case "\$source_path" in
196201
*/)
197202
mkdir -p -- "\$destination_path"
198-
if [ "\$exclude_root_github" = 1 ]; then
203+
if [ "\$exclude_root_github" = 1 ] || [ "\$exclude_root_git" = 1 ]; then
199204
for source_entry in "\${source_path}".[!.]* "\${source_path}"..?* "\${source_path}"*; do
200205
if [ ! -e "\$source_entry" ] && [ ! -L "\$source_entry" ]; then
201206
continue
202207
fi
203-
if [ "\${source_entry##*/}" = ".github" ]; then
208+
if { [ "\$exclude_root_github" = 1 ] && [ "\${source_entry##*/}" = ".github" ]; } || { [ "\$exclude_root_git" = 1 ] && [ "\${source_entry##*/}" = ".git" ]; }; then
204209
continue
205210
fi
206211
cp -a -- "\$source_entry" "\$destination_path/"
@@ -254,14 +259,16 @@ fi
254259
assert trace_lines[i].starts_with('${option_prefix}${operation}'), trace_lines.str()
255260
}
256261
rsync_lines := (os.read_file(rsync_trace) or { panic(err) }).trim_space().split_into_lines()
257-
assert rsync_lines.len == 7, rsync_lines.str()
258-
assert rsync_lines[0].starts_with('-a thirdparty/tcc/ '), rsync_lines.str()
259-
assert rsync_lines[1].starts_with('-a --delete --exclude=/.github/ '), rsync_lines.str()
260-
assert rsync_lines[2].contains('thirdparty/tcc.original/.git/'), rsync_lines.str()
261-
assert rsync_lines[3].contains('thirdparty/tcc.original/lib/libgc'), rsync_lines.str()
262-
assert rsync_lines[4].contains('thirdparty/tcc.original/lib/build'), rsync_lines.str()
263-
assert rsync_lines[5].contains('thirdparty/tcc.original/README.md'), rsync_lines.str()
264-
assert rsync_lines[6].ends_with('/build.sh'), rsync_lines.str()
262+
assert rsync_lines.len == 8, rsync_lines.str()
263+
assert rsync_lines[0].starts_with('-a --exclude=/.git --exclude=/.git/ thirdparty/tcc/ '), rsync_lines.str()
264+
265+
assert rsync_lines[1].starts_with('-a thirdparty/tcc/ '), rsync_lines.str()
266+
assert rsync_lines[2].starts_with('-a --delete --exclude=/.github/ '), rsync_lines.str()
267+
assert rsync_lines[3].contains('thirdparty/tcc.original/.git/'), rsync_lines.str()
268+
assert rsync_lines[4].contains('thirdparty/tcc.original/lib/libgc'), rsync_lines.str()
269+
assert rsync_lines[5].contains('thirdparty/tcc.original/lib/build'), rsync_lines.str()
270+
assert rsync_lines[6].contains('thirdparty/tcc.original/README.md'), rsync_lines.str()
271+
assert rsync_lines[7].ends_with('/build.sh'), rsync_lines.str()
265272
assert os.execute('${os.quoted_path(os.join_path(tcc_dir, 'tcc.exe'))} --version').output.trim_space() == 'source-test-tcc'
266273
staged_source_workflow := os.join_path(root, 'tinycc', 'thirdparty', 'tcc', '.github',
267274
'workflows', 'preserve.yml')

vlib/v3/driver/driver.v

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4426,9 +4426,16 @@ fn monomorph_cache_semantic_signature(a &flat.FlatAst, source_files []string) st
44264426
file_ids << idx
44274427
}
44284428
}
4429-
file_ids.sort_with_compare(fn [a] (left &int, right &int) int {
4430-
return a.nodes[*left].value.compare(a.nodes[*right].value)
4431-
})
4429+
// Keep the self-hosting path capture-free so V can be built with `-no-closures`.
4430+
for i in 1 .. file_ids.len {
4431+
value := file_ids[i]
4432+
mut j := i
4433+
for j > 0 && a.nodes[file_ids[j - 1]].value > a.nodes[value].value {
4434+
file_ids[j] = file_ids[j - 1]
4435+
j--
4436+
}
4437+
file_ids[j] = value
4438+
}
44324439
for idx in file_ids {
44334440
hash = c_hash_monomorph_node(hash, a, flat.NodeId(idx), cacheable_strings,
44344441
declaration_attributes)

vlib/v3/eval/eval.v

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5974,7 +5974,6 @@ fn (e &Eval) sizeof_type_name(name string) i64 {
59745974
'bool', 'i8', 'u8', 'byte', 'char' { i64(1) }
59755975
'i16', 'u16' { i64(2) }
59765976
'int', 'i32', 'u32', 'rune', 'f32' { i64(4) }
5977-
'i64', 'u64', 'isize', 'usize', 'f64' { i64(8) }
59785977
else { i64(8) }
59795978
}
59805979
}

vlib/v3/gen/c/cleanc.v

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2730,18 +2730,22 @@ pub fn (mut g FlatGen) gen_with_used_options(a &flat.FlatAst, used_fns map[strin
27302730
mut parallel_iface_scan := false
27312731
mut iface_worker := &FlatGen{}
27322732
mut iface_threads := []thread voidptr{cap: 1}
2733-
$if !v3_no_parallel ? {
2734-
parallel_iface_scan = g.scope_parallel_workers && !effective_no_parallel
2733+
$if !windows {
2734+
$if !v3_no_parallel ? {
2735+
parallel_iface_scan = g.scope_parallel_workers && !effective_no_parallel
2736+
}
27352737
}
27362738
if parallel_iface_scan {
2737-
$if !v3_no_parallel ? {
2738-
iface_worker = g.new_parallel_worker(4)
2739-
iface_worker.interface_boxed_types = map[string]bool{}
2740-
iface_worker.interface_boxed_types_done = false
2741-
iface_worker.iface_impls = map[string][]string{}
2742-
iface_worker.iface_type_ids = map[string]int{}
2743-
iface_worker.ierror_method_emit_names = map[string]bool{}
2744-
iface_threads << spawn interface_impl_scan_thread(voidptr(iface_worker))
2739+
$if !windows {
2740+
$if !v3_no_parallel ? {
2741+
iface_worker = g.new_parallel_worker(4)
2742+
iface_worker.interface_boxed_types = map[string]bool{}
2743+
iface_worker.interface_boxed_types_done = false
2744+
iface_worker.iface_impls = map[string][]string{}
2745+
iface_worker.iface_type_ids = map[string]int{}
2746+
iface_worker.ierror_method_emit_names = map[string]bool{}
2747+
iface_threads << spawn interface_impl_scan_thread(voidptr(iface_worker))
2748+
}
27452749
}
27462750
} else {
27472751
g.collect_interface_impls()
@@ -2767,12 +2771,14 @@ pub fn (mut g FlatGen) gen_with_used_options(a &flat.FlatAst, used_fns map[strin
27672771
g.timing_profile(' [ttime] cg preseeds ${f64(cgsw.elapsed().microseconds()) / 1000.0:7.2f} ms')
27682772
cgsw.restart()
27692773
if parallel_iface_scan {
2770-
$if !v3_no_parallel ? {
2771-
_ = iface_threads[0].wait()
2772-
g.publish_interface_impl_scan(mut iface_worker)
2773-
g.precompute_required_interface_dispatch_methods()
2774-
g.timing_profile(' [ttime] cg iface wait ${f64(cgsw.elapsed().microseconds()) / 1000.0:7.2f} ms (overlapped)')
2775-
cgsw.restart()
2774+
$if !windows {
2775+
$if !v3_no_parallel ? {
2776+
_ = iface_threads[0].wait()
2777+
g.publish_interface_impl_scan(mut iface_worker)
2778+
g.precompute_required_interface_dispatch_methods()
2779+
g.timing_profile(' [ttime] cg iface wait ${f64(cgsw.elapsed().microseconds()) / 1000.0:7.2f} ms (overlapped)')
2780+
cgsw.restart()
2781+
}
27762782
}
27772783
}
27782784
parallel_prep_done := g.run_pre_dispatch_parallel(effective_no_parallel)
@@ -3122,7 +3128,7 @@ fn (mut g FlatGen) gen_global_declaration_block() {
31223128
fn (mut g FlatGen) gen_type_declaration_block() {
31233129
g.enum_decls()
31243130
g.type_forward_decls()
3125-
g.type_alias_decls()
3131+
g.type_alias_decls(false)
31263132
// Forward-declare multi-return structs before fn-ptr typedefs, which may name a
31273133
// multi-return as a by-value return type (full bodies come after struct_decls).
31283134
g.multi_return_forward_decls()
@@ -3131,6 +3137,7 @@ fn (mut g FlatGen) gen_type_declaration_block() {
31313137
// array in param or return position) and the function declarations.
31323138
g.fixed_array_early_typedefs()
31333139
g.fn_ptr_typedefs()
3140+
g.type_alias_decls(true)
31343141
g.struct_decls()
31353142
g.fixed_array_typedefs()
31363143
g.multi_return_typedefs()

0 commit comments

Comments
 (0)