boring-sys: Disable alignment tests for iOS ARM64 targets
As pointed out in the comment, bindgen generates tests that cause compiler warnings about misaligned references. bindgen people are aware of the issue, but we have to deal with our warnings that are treated as errors. For the time being, suppress alignment tests on platforms that are known to be triggering UB. I suspect that other non-x86 platforms are affected as well, but I can't get the tests to compile for those tests at the moment, so I'm not sure. Dealing with the issues one platform at a time.
This commit is contained in:
parent
51e99ea9c0
commit
76ba5429d7
|
|
@ -385,6 +385,22 @@ fn main() {
|
||||||
.clang_args(get_extra_clang_args_for_bindgen())
|
.clang_args(get_extra_clang_args_for_bindgen())
|
||||||
.clang_args(&["-I", &include_path]);
|
.clang_args(&["-I", &include_path]);
|
||||||
|
|
||||||
|
let target = std::env::var("TARGET").unwrap();
|
||||||
|
match target.as_ref() {
|
||||||
|
// bindgen produces alignment tests that cause undefined behavior [1]
|
||||||
|
// when applied to explicitly unaligned types like OSUnalignedU64.
|
||||||
|
//
|
||||||
|
// There is no way to disable these tests for only some types
|
||||||
|
// and it's not nice to suppress warnings for the entire crate,
|
||||||
|
// so let's disable all alignment tests and hope for the best.
|
||||||
|
//
|
||||||
|
// [1]: https://github.com/rust-lang/rust-bindgen/issues/1651
|
||||||
|
"aarch64-apple-ios" | "aarch64-apple-ios-sim" => {
|
||||||
|
builder = builder.layout_tests(false);
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
let headers = [
|
let headers = [
|
||||||
"aes.h",
|
"aes.h",
|
||||||
"asn1_mac.h",
|
"asn1_mac.h",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue