Skip to content

Commit

Permalink
cgen: format generated c codes of sorted structs (#18898)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyi98 committed Jul 18, 2023
1 parent e5a727c commit e71370d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion vlib/v/gen/c/cgen.v
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions vlib/v/gen/c/struct.v
Expand Up @@ -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 {
Expand All @@ -528,8 +526,10 @@ 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(post_pragma)
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) {
Expand Down

0 comments on commit e71370d

Please sign in to comment.