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:
parent
e5a727c3e1
commit
e71370dc40
@ -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)
|
||||
|
@ -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 }
|
||||
|
Loading…
Reference in New Issue
Block a user