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

cgen: format generated c codes of sorted structs (#18898)

This commit is contained in:
yuyi 2023-07-19 02:08:43 +08:00 committed by GitHub
parent e5a727c3e1
commit e71370dc40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -5868,7 +5868,6 @@ fn (mut g Gen) write_types(symbols []&ast.TypeSymbol) {
}
}
g.type_definitions.writeln('};')
g.type_definitions.writeln('')
}
ast.ArrayFixed {
elem_sym := g.table.sym(sym.info.elem_type)

View File

@ -517,8 +517,6 @@ fn (mut g Gen) struct_decl(s ast.Struct, name string, is_anon bool) {
} else {
g.type_definitions.writeln('\tEMPTY_STRUCT_DECLARATION;')
}
// g.type_definitions.writeln('} $name;\n')
//
ti_attrs := if !g.is_cc_msvc && s.attrs.contains('packed') {
'__attribute__((__packed__))'
} else {
@ -528,9 +526,11 @@ fn (mut g Gen) struct_decl(s ast.Struct, name string, is_anon bool) {
if !is_anon {
g.type_definitions.write_string(';')
}
g.type_definitions.writeln('\n')
g.type_definitions.writeln('')
if post_pragma.len > 0 {
g.type_definitions.writeln(post_pragma)
}
}
fn (mut g Gen) struct_init_field(sfield ast.StructInitField, language ast.Language) {
field_name := if language == .v { c_name(sfield.name) } else { sfield.name }