Suppress cast_ptr_alignment clippy errors.

These are only used in places that use `write_unaligned`, so it's ok
that the pointer might be misaligned.
This commit is contained in:
Dan Gohman
2018-04-17 16:02:10 -07:00
parent 58380f38e8
commit 5c6cb202d8
2 changed files with 8 additions and 0 deletions

View File

@@ -238,14 +238,17 @@ impl<'simple_jit_backend> Backend for SimpleJITBackend {
match reloc {
Reloc::Abs4 => {
// TODO: Handle overflow.
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe { write_unaligned(at as *mut u32, what as u32) };
}
Reloc::Abs8 => {
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe { write_unaligned(at as *mut u64, what as u64) };
}
Reloc::X86PCRel4 => {
// TODO: Handle overflow.
let pcrel = ((what as isize) - (at as isize)) as i32;
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe { write_unaligned(at as *mut i32, pcrel) };
}
Reloc::X86GOTPCRel4 |
@@ -295,9 +298,11 @@ impl<'simple_jit_backend> Backend for SimpleJITBackend {
match reloc {
Reloc::Abs4 => {
// TODO: Handle overflow.
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe { write_unaligned(at as *mut u32, what as u32) };
}
Reloc::Abs8 => {
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe { write_unaligned(at as *mut u64, what as u64) };
}
Reloc::X86PCRel4 |