-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AIX] Lint on structs that have a different alignment in AIX's C ABI
- Loading branch information
Showing
7 changed files
with
411 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
//@ check-pass | ||
//@ compile-flags: --target powerpc64-ibm-aix | ||
//@ needs-llvm-components: powerpc | ||
//@ add-core-stubs | ||
#![feature(no_core)] | ||
#![no_core] | ||
#![no_std] | ||
|
||
extern crate minicore; | ||
use minicore::*; | ||
|
||
#[warn(uses_power_alignment)] | ||
|
||
#[repr(C)] | ||
pub struct Floats { | ||
a: f64, | ||
b: u8, | ||
c: f64, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
d: f32, | ||
} | ||
|
||
pub struct Floats2 { | ||
a: f64, | ||
b: u32, | ||
c: f64, | ||
} | ||
|
||
#[repr(C)] | ||
pub struct Floats3 { | ||
a: f32, | ||
b: f32, | ||
c: i64, | ||
} | ||
|
||
#[repr(C)] | ||
pub struct Floats4 { | ||
a: u64, | ||
b: u32, | ||
c: f32, | ||
} | ||
|
||
#[repr(C)] | ||
pub struct Floats5 { | ||
a: f32, | ||
b: f64, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
c: f32, | ||
} | ||
|
||
#[repr(C)] | ||
pub struct FloatAgg1 { | ||
x: Floats, | ||
y: f64, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
} | ||
|
||
#[repr(C)] | ||
pub struct FloatAgg2 { | ||
x: i64, | ||
y: Floats, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
} | ||
|
||
#[repr(C)] | ||
pub struct FloatAgg3 { | ||
x: FloatAgg1, | ||
// NOTE: the "power" alignment rule is infectious to nested struct fields. | ||
y: FloatAgg2, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
z: FloatAgg2, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
} | ||
|
||
#[repr(C)] | ||
pub struct FloatAgg4 { | ||
x: FloatAgg1, | ||
y: FloatAgg2, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
} | ||
|
||
#[repr(C)] | ||
pub struct FloatAgg5 { | ||
x: FloatAgg1, | ||
y: FloatAgg2, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
z: FloatAgg3, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
} | ||
|
||
#[repr(C)] | ||
pub struct FloatAgg6 { | ||
x: i64, | ||
y: Floats, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
z: u8, | ||
} | ||
|
||
#[repr(C)] | ||
pub struct FloatAgg7 { | ||
x: i64, | ||
y: Floats, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
z: u8, | ||
zz: f32, | ||
} | ||
|
||
#[repr(C)] | ||
pub struct A { | ||
d: f64, | ||
} | ||
#[repr(C)] | ||
pub struct B { | ||
a: A, | ||
f: f32, | ||
d: f64, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
} | ||
#[repr(C)] | ||
pub struct C { | ||
c: u8, | ||
b: B, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
} | ||
#[repr(C)] | ||
pub struct D { | ||
x: f64, | ||
} | ||
#[repr(C)] | ||
pub struct E { | ||
x: i32, | ||
d: D, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
} | ||
#[repr(C)] | ||
pub struct F { | ||
a: u8, | ||
b: f64, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
} | ||
#[repr(C)] | ||
pub struct G { | ||
a: u8, | ||
b: u8, | ||
c: f64, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
d: f32, | ||
e: f64, //~ WARNING repr(C) does not follow the power alignment rule. This may affect platform C ABI compatibility for this type | ||
} | ||
// Should not warn on #[repr(packed)]. | ||
#[repr(packed)] | ||
pub struct H { | ||
a: u8, | ||
b: u8, | ||
c: f64, | ||
d: f32, | ||
e: f64, | ||
} | ||
#[repr(C, packed)] | ||
pub struct I { | ||
a: u8, | ||
b: u8, | ||
c: f64, | ||
d: f32, | ||
e: f64, | ||
} | ||
|
||
fn main() { } |
Oops, something went wrong.