diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:39:07 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:39:07 +0000 |
commit | af6b8ed095f88f1df2116cdc7a9d44872cfa6074 (patch) | |
tree | 1f2df671c1f8033d5ed83f056167a0911f8d2a57 /tests/rust/layout_aligned_opaque.rs | |
parent | Initial commit. (diff) | |
download | rust-cbindgen-upstream/0.26.0.tar.xz rust-cbindgen-upstream/0.26.0.zip |
Adding upstream version 0.26.0.upstream/0.26.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rust/layout_aligned_opaque.rs')
-rw-r--r-- | tests/rust/layout_aligned_opaque.rs | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/rust/layout_aligned_opaque.rs b/tests/rust/layout_aligned_opaque.rs new file mode 100644 index 0000000..c499124 --- /dev/null +++ b/tests/rust/layout_aligned_opaque.rs @@ -0,0 +1,67 @@ +#[repr(packed, C)] +pub struct PackedStruct { + pub arg1: usize, + pub arg2: *mut u8, +} + +#[repr(packed, C)] +pub union PackedUnion { + pub variant1: usize, + pub variant2: *mut u8, +} + +// Opaque because aligned_n is not defined. +#[repr(align(1), C)] +pub union OpaqueAlign1Union { + pub variant1: usize, + pub variant2: *mut u8, +} + +// Opaque because aligned_n is not defined. +#[repr(align(4), C)] +pub union OpaqueAlign4Union { + pub variant1: usize, + pub variant2: *mut u8, +} + +// Opaque because aligned_n is not defined. +#[repr(align(16), C)] +pub union OpaqueAlign16Union { + pub variant1: usize, + pub variant2: *mut u8, +} + +// Opaque because aligned_n is not defined. +#[repr(align(1), C)] +pub struct OpaqueAlign1Struct { + pub arg1: usize, + pub arg2: *mut u8, +} + +// Opaque because aligned_n is not defined. +#[repr(align(2), C)] +pub struct OpaqueAlign2Struct { + pub arg1: usize, + pub arg2: *mut u8, +} + +// Opaque because aligned_n is not defined. +#[repr(align(4), C)] +pub struct OpaqueAlign4Struct { + pub arg1: usize, + pub arg2: *mut u8, +} + +// Opaque because aligned_n is not defined. +#[repr(align(8), C)] +pub struct OpaqueAlign8Struct { + pub arg1: usize, + pub arg2: *mut u8, +} + +// Opaque because aligned_n is not defined. +#[repr(align(32), C)] +pub struct OpaqueAlign32Struct { + pub arg1: usize, + pub arg2: *mut u8, +} |