From bdb8b30e4d8837c92899e983d3ce47317ddac12b Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 26 Oct 2023 05:46:25 +0300 Subject: [PATCH] pref,cgen: turn off [minify] struct field reordering, when -cross is used (stabler vc/v.c and vc/v_win.c, when generated on different hosts) --- vlib/v/checker/struct.v | 2 +- vlib/v/gen/c/struct.v | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/v/checker/struct.v b/vlib/v/checker/struct.v index 2018d0b511..08129ce164 100644 --- a/vlib/v/checker/struct.v +++ b/vlib/v/checker/struct.v @@ -42,7 +42,7 @@ fn (mut c Checker) struct_decl(mut node ast.StructDecl) { } } } - if struct_sym.info.is_minify { + if struct_sym.info.is_minify && !c.pref.output_cross_c { node.fields.sort_with_compare(minify_sort_fn) struct_sym.info.fields.sort_with_compare(minify_sort_fn) } diff --git a/vlib/v/gen/c/struct.v b/vlib/v/gen/c/struct.v index e226d233c2..98c2fa94df 100644 --- a/vlib/v/gen/c/struct.v +++ b/vlib/v/gen/c/struct.v @@ -510,7 +510,7 @@ fn (mut g Gen) struct_decl(s ast.Struct, name string, is_anon bool) { field_name := c_name(field.name) volatile_prefix := if field.is_volatile { 'volatile ' } else { '' } mut size_suffix := '' - if is_minify && !g.is_cc_msvc { + if is_minify && !g.is_cc_msvc && !g.pref.output_cross_c { if field.typ == ast.bool_type_idx { size_suffix = ' : 1' } else {