ci: use -Wno-excess-initializers for clang -cstrict, cleanup cgen

pull/12838/head^2
Delyan Angelov 2021-12-14 17:14:45 +02:00
parent 96e9cc62b0
commit c900dc1053
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 2 additions and 9 deletions

View File

@ -185,6 +185,7 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
// enable additional warnings:
'-Wno-unknown-warning' /* if a C compiler does not understand a certain flag, it should just ignore it */,
'-Wno-unknown-warning-option' /* clang equivalent of the above */,
'-Wno-excess-initializers' /* vlib/v/tests/struct_init_with_complex_fields_test.v fails without that on macos clang 13 */,
'-Wdate-time',
'-Wduplicated-branches',
'-Wduplicated-cond',

View File

@ -6816,15 +6816,7 @@ fn (mut g Gen) type_default(typ_ ast.Type) string {
}
init_str += '.$field_name = $expr_str,'
} else {
mut zero_str := g.type_default(field.typ)
if zero_str == '{0}' {
if field_sym.info is ast.Struct {
if field_sym.info.fields.len == 0
&& field_sym.info.embeds.len == 0 {
zero_str = '{0}'
}
}
}
zero_str := g.type_default(field.typ)
init_str += '.$field_name = $zero_str,'
}
has_none_zero = true