cbindgen/tests/rust/layout_aligned_opaque.toml
Aleksa Sarai f23d4ee6e8 tests: add tests for #[repr(packed)] and #[repr(align(...))]
The tests are very straightforward, and effecitvely are just ensuring
that the formatting works correctly and is included in all of the
important cases.

It's also very important to ensure we do not generate laid-out structs
for layouts which we cannot reasonably represent in C (such as in cases
where we weren't told what annotation to use for packed and
specifically-aligned structures). Thus, add some tests to verify that
this is the case.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2019-12-15 11:52:23 +01:00

23 lines
440 B
TOML

header = """
#define CBINDGEN_PACKED __attribute__ ((packed))
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
"""
[layout]
# We do not define aligned_n.
packed = "CBINDGEN_PACKED"
[export]
include = [
"PackedStruct",
"PackedUnion",
"OpaqueAlign1Union",
"OpaqueAlign4Union",
"OpaqueAlign16Union",
"OpaqueAlign1Struct",
"OpaqueAlign2Struct",
"OpaqueAlign4Struct",
"OpaqueAlign8Struct",
"OpaqueAlign32Struct",
]