forked from M-Labs/nac3
1
0
Fork 0

fixed new compiler warnings

This commit is contained in:
pca006132 2021-01-15 17:55:58 +08:00
parent 93493397ae
commit 35204d4716
4 changed files with 6 additions and 8 deletions

View File

@ -3,7 +3,7 @@ use core::{
mem, mem,
slice, slice,
}; };
use alloc::alloc::{alloc_zeroed, dealloc, Layout, LayoutErr}; use alloc::alloc::{alloc_zeroed, dealloc, Layout, LayoutError};
use super::{ use super::{
elf::*, elf::*,
Error, Error,
@ -27,7 +27,7 @@ pub struct Image {
} }
impl Image { impl Image {
pub fn new(size: usize, align: usize) -> Result<Self, LayoutErr> { pub fn new(size: usize, align: usize) -> Result<Self, LayoutError> {
let layout = Layout::from_size_align(size, align)?; let layout = Layout::from_size_align(size, align)?;
let data = unsafe { let data = unsafe {
let ptr = alloc_zeroed(layout); let ptr = alloc_zeroed(layout);

View File

@ -16,7 +16,6 @@ static CORE1_RESTART: AtomicBool = AtomicBool::new(false);
#[link_section = ".text.boot"] #[link_section = ".text.boot"]
#[no_mangle] #[no_mangle]
#[naked]
pub unsafe extern "C" fn IRQ() { pub unsafe extern "C" fn IRQ() {
if MPIDR.read().cpu_id() == 1 { if MPIDR.read().cpu_id() == 1 {
let mpcore = mpcore::RegisterBlock::mpcore(); let mpcore = mpcore::RegisterBlock::mpcore();

View File

@ -6,7 +6,6 @@
#![feature(c_variadic)] #![feature(c_variadic)]
#![feature(const_btree_new)] #![feature(const_btree_new)]
#![feature(const_in_array_repeat_expressions)] #![feature(const_in_array_repeat_expressions)]
#![feature(naked_functions)]
extern crate alloc; extern crate alloc;

View File

@ -75,7 +75,7 @@ async unsafe fn recv_value<F>(stream: &TcpStream, tag: Tag<'async_recursion>, da
} }
Tag::List(it) => { Tag::List(it) => {
#[repr(C)] #[repr(C)]
struct List { elements: *mut (), length: u32 }; struct List { elements: *mut (), length: u32 }
consume_value!(List, |ptr| { consume_value!(List, |ptr| {
let length = proto_async::read_i32(stream).await? as usize; let length = proto_async::read_i32(stream).await? as usize;
(*ptr).length = length as u32; (*ptr).length = length as u32;
@ -228,7 +228,7 @@ unsafe fn send_value<W>(writer: &mut W, tag: Tag, data: &mut *const ())
} }
Tag::List(it) => { Tag::List(it) => {
#[repr(C)] #[repr(C)]
struct List { elements: *const (), length: u32 }; struct List { elements: *const (), length: u32 }
consume_value!(List, |ptr| { consume_value!(List, |ptr| {
let length = (*ptr).length as isize; let length = (*ptr).length as isize;
writer.write_u32((*ptr).length)?; writer.write_u32((*ptr).length)?;
@ -336,7 +336,7 @@ unsafe fn send_value<W>(writer: &mut W, tag: Tag, data: &mut *const ())
} }
Tag::Keyword(it) => { Tag::Keyword(it) => {
#[repr(C)] #[repr(C)]
struct Keyword<'a> { name: CSlice<'a, u8> }; struct Keyword<'a> { name: CSlice<'a, u8> }
consume_value!(Keyword, |ptr| { consume_value!(Keyword, |ptr| {
writer.write_string(str::from_utf8((*ptr).name.as_ref()).unwrap())?; writer.write_string(str::from_utf8((*ptr).name.as_ref()).unwrap())?;
let tag = it.clone().next().expect("truncated tag"); let tag = it.clone().next().expect("truncated tag");
@ -348,7 +348,7 @@ unsafe fn send_value<W>(writer: &mut W, tag: Tag, data: &mut *const ())
} }
Tag::Object => { Tag::Object => {
#[repr(C)] #[repr(C)]
struct Object { id: u32 }; struct Object { id: u32 }
consume_value!(*const Object, |ptr| consume_value!(*const Object, |ptr|
writer.write_u32((**ptr).id)) writer.write_u32((**ptr).id))
} }