-
Notifications
You must be signed in to change notification settings - Fork 717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__attribute__((aligned(2), packed)) generates both repr(packed) and repr(aligned) #2240
Comments
Ah, so I thought this was just a matter of something like #2246, but it seems For that struct, which doesn't have padding, |
The document seems describing
|
I misunderstood the description. #[repr(C, packed(2))]
struct S1 {
field: [u8; 16],
}
#[repr(C, packed(2))]
struct S2 {
field: [u16; 8],
}
fn main() {
println!("align of {} {}",
std::mem::align_of::<S1>(),
std::mem::align_of::<S2>(),
);
} $ ./x
align of 1 2 It was not affected because the inner type was not aligned |
I can tell my suggestion for expected result came from lack of knowledge of rust For my case, I may be able to fix it with the patch + opaque_type option to |
The patch seems to be working -- any reason not to merge at this point? |
Input C/C++ Header
part of
MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/hfs/hfs_format.h
Bindgen Invocation
Actual Results
Expected Results
The actual result is illegal in Rust.
any of below will be accepted
#[repr(C, packed(2))]
The text was updated successfully, but these errors were encountered: