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

cgen: [packed] struct attribute

This commit is contained in:
Alexander Medvednikov 2021-04-05 06:49:43 +03:00
parent 22b4ac2266
commit 77d8336db9

View File

@ -1247,7 +1247,12 @@ fn (mut g Gen) stmt(node ast.Stmt) {
if node.is_union {
g.typedefs.writeln('typedef union $name $name;')
} else {
g.typedefs.writeln('typedef struct $name $name;')
attrs := if node.attrs.contains('packed') {
'__attribute__((__packed__))'
} else {
''
}
g.typedefs.writeln('typedef struct $attrs $name $name;')
}
}
ast.TypeDecl {