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