@@ -1638,6 +1638,9 @@ impl ImproperCTypesDefinitions { |
|
|
1638 |
1638 |
return true; |
1639 |
1639 |
} else if let Adt(adt_def, _) = ty.kind() |
1640 |
1640 |
&& adt_def.is_struct() |
|
1641 |
+ && adt_def.repr().c() |
|
1642 |
+ && !adt_def.repr().packed() |
|
1643 |
+ && adt_def.repr().align.is_none() |
1641 |
1644 |
{ |
1642 |
1645 |
let struct_variant = adt_def.variant(VariantIdx::ZERO); |
1643 |
1646 |
// Within a nested struct, all fields are examined to correctly |
@@ -1659,8 +1662,11 @@ impl ImproperCTypesDefinitions { |
|
|
1659 |
1662 |
item: &'tcx hir::Item<'tcx>, |
1660 |
1663 |
) { |
1661 |
1664 |
let adt_def = cx.tcx.adt_def(item.owner_id.to_def_id()); |
|
1665 |
+// repr(C) structs also with packed or aligned representation |
|
1666 |
+// should be ignored. |
1662 |
1667 |
if adt_def.repr().c() |
1663 |
1668 |
&& !adt_def.repr().packed() |
|
1669 |
+ && adt_def.repr().align.is_none() |
1664 |
1670 |
&& cx.tcx.sess.target.os == "aix" |
1665 |
1671 |
&& !adt_def.all_fields().next().is_none() |
1666 |
1672 |
{ |