mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: fix msvc packed attr (#18437)
This commit is contained in:
parent
530f73b927
commit
23da2128d5
@ -3798,7 +3798,11 @@ fn (mut g Gen) enum_decl(node ast.EnumDecl) {
|
||||
g.enum_typedefs.writeln(', // ${cur_value}')
|
||||
cur_enum_offset++
|
||||
}
|
||||
packed_attribute := if node.typ != ast.int_type { '__attribute__((packed))' } else { '' }
|
||||
packed_attribute := if !g.is_cc_msvc && node.typ != ast.int_type {
|
||||
'__attribute__((packed))'
|
||||
} else {
|
||||
''
|
||||
}
|
||||
g.enum_typedefs.writeln('} ${packed_attribute} ${enum_name};')
|
||||
if node.typ != ast.int_type {
|
||||
g.enum_typedefs.writeln('#pragma pack(pop)\n')
|
||||
|
@ -507,7 +507,7 @@ fn (mut g Gen) struct_decl(s ast.Struct, name string, is_anon bool) {
|
||||
}
|
||||
// g.type_definitions.writeln('} $name;\n')
|
||||
//
|
||||
ti_attrs := if s.attrs.contains('packed') {
|
||||
ti_attrs := if !g.is_cc_msvc && s.attrs.contains('packed') {
|
||||
'__attribute__((__packed__))'
|
||||
} else {
|
||||
''
|
||||
|
Loading…
Reference in New Issue
Block a user