-
Notifications
You must be signed in to change notification settings - Fork 794
Open
Description
bindgen version: 0.72.1
for the following struct
typedef struct
{
NvU32 vic : 8;
NvU32 pixelRepeat : 5;
NvU32 colorSpace : 3;
NvU32 colorimetry : 3;
NvU32 extendedColorimetry : 4;
NvU32 rgbQuantizationRange : 3;
NvU32 yccQuantizationRange : 3;
NvU32 itContent : 2;
NvU32 contentTypes : 3;
NvU32 scanInfo : 3;
NvU32 activeFormatInfoPresent : 2;
NvU32 activeFormatAspectRatio : 5;
NvU32 picAspectRatio : 3;
NvU32 nonuniformScaling : 3;
NvU32 barInfo : 3;
NvU32 top_bar : 17;
NvU32 bottom_bar : 17;
NvU32 left_bar : 17;
NvU32 right_bar : 17;
NvU32 Future17 : 2;
NvU32 Future47 : 2;
} NV_INFOFRAME_VIDEO;bindgen gives:
- a 23 * 8 size struct (which doesn't pass assertions) normally
- a 4 * 32 size struct (which is wrong) with --opaque-type
The right size would be probably [32; 6] because this is a struct built with 32 bit integers (so aligned on 4 bytes) as both latest clang and msvc report: godbolt.
Notably bindgen outputs the right alignment (#[repr(align(4))]) but then ignores it when computing what the actual size of the struct should be.
normal output
#[repr(C)]
pub struct NV_INFOFRAME_VIDEO {
pub _bitfield_align_1: [u32; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 23usize]>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of NV_INFOFRAME_VIDEO"][::core::mem::size_of::<NV_INFOFRAME_VIDEO>() - 16usize];
["Alignment of NV_INFOFRAME_VIDEO"][::core::mem::align_of::<NV_INFOFRAME_VIDEO>() - 4usize];
};output with --opaque-type
#[repr(C)]
#[repr(align(4))]
pub struct NV_INFOFRAME_VIDEO {
pub _bindgen_opaque_blob: [u32; 4usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of NV_INFOFRAME_VIDEO"][::core::mem::size_of::<NV_INFOFRAME_VIDEO>() - 16usize];
["Alignment of NV_INFOFRAME_VIDEO"][::core::mem::align_of::<NV_INFOFRAME_VIDEO>() - 4usize];
};Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels