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:
parent
22b4ac2266
commit
77d8336db9
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user