let convert_struct_field ~env (size, field) =
match field with
NormalField { sf_id = id; sf_type = ty } ->
let sq, dc = convert_declarator ~env ty id in
[ PstructDecl (sq, [PstructDeclNormal dc]) ]
| BitField { s_bf_fields = bfs } ->
List.map
(fun (id_opt, ty, width, _) ->
match id_opt with
None ->
let sq, dc = convert_declarator_anonymous ~env ty in
PstructDecl
(sq, [PstructDeclBitfield (None, constant_exp_of_int ~loc:dummy_loc width)])
| Some n ->
let sq, dc = convert_declarator ~env ty n in
PstructDecl
(sq, [PstructDeclBitfield (Some dc, constant_exp_of_int ~loc:dummy_loc width)])
)
bfs