1/// This should not be opaque; we can see the attributes and can pack the 2/// struct. 3struct AlignedToOne { 4 int i; 5} __attribute__ ((packed,aligned(1))); 6 7/// This should be opaque because although we can see the attributes, Rust before 8/// 1.33 doesn't have `#[repr(packed(N))]`. 9struct AlignedToTwo { 10 int i; 11} __attribute__ ((packed,aligned(2))); 12 13#pragma pack(1) 14 15/// This should not be opaque because although `libclang` doesn't give us the 16/// `#pragma pack(1)`, we can detect that alignment is 1 and add 17/// `#[repr(packed)]` to the struct ourselves. 18struct PackedToOne { 19 int x; 20 int y; 21}; 22 23#pragma pack() 24 25#pragma pack(2) 26 27/// In this case, even if we can detect the weird alignment triggered by 28/// `#pragma pack(2)`, we can't do anything about it because Rust before 1.33 29/// doesn't have `#[repr(packed(N))]`. Therefore, we must make it opaque. 30struct PackedToTwo { 31 int x; 32 int y; 33}; 34 35#pragma pack() 36