Unit test for Bitfields and Flexible Array Members (FAM).
This test verifies the functionality of two advanced C type features:
- Flexible Array Members:
- Tests the
[?:type] signature syntax.
- Tests the
infix_type_create_flexible_array Manual API.
- Verifies that the struct layout (size and offsets) correctly handles the FAM (i.e., it adds no size to the struct but respects alignment).
- Bitfields:
- Tests the
name:type:width signature syntax.
- Tests the
infix_type_create_bitfield_member Manual API.
- Verifies packing of
uint8_t bitfields.
- Verifies the behavior of zero-width bitfields for alignment forcing.
- Note
- The current implementation of bitfields primarily supports byte-granular packing (typical of
uint8_t flags). Complex packing of larger integers across byte boundaries (e.g., uint32_t) is implementation-defined in C and currently simplified in infix to flush to the next byte on overflow.