From 5817aa47d8d24c9fa39849cecdf8f209ce068408 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sat, 17 Apr 2021 19:19:25 +0300 Subject: [PATCH] Revert "cgen: fix empty struct init (#9769)" This reverts commit 0cc04850d7d8432658b79a7e11c088fbd84b2183. --- vlib/v/gen/c/cgen.v | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index 8793da1558..c5dcd109f9 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -5122,12 +5122,9 @@ fn (mut g Gen) struct_init(struct_init ast.StructInit) { } // The rest of the fields are zeroed. // `inited_fields` is a list of fields that have been init'ed, they are skipped - mut nr_fields := 1 + // mut nr_fields := 0 if sym.kind == .struct_ { info := sym.info as ast.Struct - $if !msvc { - nr_fields = info.fields.len - } if info.is_union && struct_init.fields.len > 1 { verror('union must not have more than 1 initializer') } @@ -5222,7 +5219,7 @@ fn (mut g Gen) struct_init(struct_init ast.StructInit) { g.indent-- } - if !initialized && nr_fields > 0 { + if !initialized { g.write('0') }