1#define __packed __attribute__((packed)) 2 3typedef unsigned char u8; 4typedef __UINT16_TYPE__ u16; 5typedef __UINT32_TYPE__ u32; 6typedef __UINT64_TYPE__ u64; 7 8struct a { 9 u8 a; 10 u8 b; 11 u16 c; 12} __packed; 13_Static_assert(__alignof(struct a) == 1, "align struct"); 14_Static_assert( sizeof(struct a) == 4, " size struct"); 15 16struct b { 17 u32 a; 18 u32 b; 19} __packed; 20_Static_assert(__alignof(struct b) == 1, "align struct"); 21_Static_assert( sizeof(struct b) == 8, "size struct"); 22 23struct c { 24 u16 a; 25 u32 b; 26} __packed; 27_Static_assert(__alignof(struct c) == 1, "align struct"); 28_Static_assert( sizeof(struct c) == 6, "size struct"); 29 30/* 31 * check-name: packed-struct 32 */ 33