You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[repr(align(n), C)] markers on a struct should be translated to __attribute__((align(n)), similarly for #[repr(packed, C)] for __attribute__((packed)). Right now they are generated as being opaque structs. This is necessary to implement a Rust-based __attribute__((packed)) (by setting #[repr(align(1))]).
Additionally, #[repr(align(n))] and #[repr(C)] separately applied on the same struct (which AFAIK is equivalent to #[repr(align(n), C)]) will result in the structure being generated as a non-opaque struct but with the wrong alignment (resulting in C code passing incorrect structs to Rust code -- which won't end well).
The text was updated successfully, but these errors were encountered:
cyphar
changed the title
#[repr(align(n))] is not represented correctly
#[repr(align(n), C)] and #[repr(packed, C)] are not represented correctly
Dec 13, 2019
#[repr(align(n), C)]
markers on a struct should be translated to__attribute__((align(n))
, similarly for#[repr(packed, C)]
for__attribute__((packed))
. Right now they are generated as being opaque structs. This is necessary to implement a Rust-based__attribute__((packed))
(by setting#[repr(align(1))]
).Additionally,
#[repr(align(n))]
and#[repr(C)]
separately applied on the same struct (which AFAIK is equivalent to#[repr(align(n), C)]
) will result in the structure being generated as a non-opaque struct but with the wrong alignment (resulting in C code passing incorrect structs to Rust code -- which won't end well).The text was updated successfully, but these errors were encountered: