Fix warnings
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
//! assert implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/assert.h.html
|
||||
|
||||
use crate::{
|
||||
c_str::CStr,
|
||||
header::{stdio, stdlib},
|
||||
platform::types::*,
|
||||
};
|
||||
use crate::{c_str::CStr, platform::types::*};
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn __assert_fail(
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
|
||||
use crate::platform::types::*;
|
||||
|
||||
use crate::header::sched::sched_param;
|
||||
|
||||
use crate::sync::AtomicLock;
|
||||
use core::sync::atomic::{AtomicI32 as AtomicInt, AtomicU32 as AtomicUint};
|
||||
|
||||
// XXX: https://github.com/eqrion/cbindgen/issues/685
|
||||
//
|
||||
// We need to write the opaque types ourselves, and apparently cbindgen doesn't even support
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
use crate::platform::types::*;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
use core::{convert::TryInto, ptr};
|
||||
|
||||
use crate::{
|
||||
header::{ctype, errno::*, stdlib::*, wctype::iswspace},
|
||||
header::{ctype, errno::*, stdlib::*},
|
||||
platform::{self, types::*},
|
||||
};
|
||||
|
||||
@@ -10,7 +8,6 @@ pub extern "C" fn imaxabs(i: intmax_t) -> intmax_t {
|
||||
i.abs()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
#[repr(C)]
|
||||
pub struct imaxdiv_t {
|
||||
quot: intmax_t,
|
||||
|
||||
@@ -9,7 +9,6 @@ const EMPTY_PTR: *const c_char = "\0" as *const _ as *const c_char;
|
||||
static mut C_LOCALE: [c_char; 2] = [b'C' as c_char, 0];
|
||||
|
||||
#[repr(C)]
|
||||
#[no_mangle]
|
||||
pub struct lconv {
|
||||
currency_symbol: *const c_char,
|
||||
decimal_point: *const c_char,
|
||||
|
||||
+10
-44
@@ -11,46 +11,10 @@
|
||||
pub use self::{answer::DnsAnswer, query::DnsQuery};
|
||||
|
||||
use alloc::{string::String, vec::Vec};
|
||||
use core::{slice, u16};
|
||||
|
||||
mod answer;
|
||||
mod query;
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(packed)]
|
||||
pub struct n16 {
|
||||
inner: u16,
|
||||
}
|
||||
|
||||
impl n16 {
|
||||
pub fn as_bytes(&self) -> &[u8] {
|
||||
unsafe { slice::from_raw_parts(core::ptr::addr_of!(self.inner).cast::<u8>(), 2) }
|
||||
}
|
||||
|
||||
pub fn from_bytes(bytes: &[u8]) -> Self {
|
||||
n16 {
|
||||
inner: unsafe {
|
||||
slice::from_raw_parts(bytes.as_ptr() as *const u16, bytes.len() / 2)[0]
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u16> for n16 {
|
||||
fn from(value: u16) -> Self {
|
||||
n16 {
|
||||
inner: value.to_be(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<n16> for u16 {
|
||||
fn from(value: n16) -> Self {
|
||||
u16::from_be(value.inner)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Dns {
|
||||
pub transaction_id: u16,
|
||||
@@ -67,13 +31,13 @@ impl Dns {
|
||||
($value:expr) => {
|
||||
data.push($value);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! push_n16 {
|
||||
($value:expr) => {
|
||||
data.extend_from_slice(n16::from($value).as_bytes());
|
||||
data.extend_from_slice(&u16::to_be_bytes($value));
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
push_n16!(self.transaction_id);
|
||||
push_n16!(self.flags);
|
||||
@@ -106,17 +70,19 @@ impl Dns {
|
||||
}
|
||||
data[i - 1]
|
||||
}};
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! pop_n16 {
|
||||
() => {{
|
||||
use core::convert::TryInto;
|
||||
i += 2;
|
||||
if i > data.len() {
|
||||
return Err(format!("{}: {}: pop_n16", file!(), line!()));
|
||||
}
|
||||
u16::from(n16::from_bytes(&data[i - 2..i]))
|
||||
let bytes: [u8; 2] = data[i - 2..i].try_into().unwrap();
|
||||
u16::from_be_bytes(bytes)
|
||||
}};
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! pop_data {
|
||||
() => {{
|
||||
@@ -129,7 +95,7 @@ impl Dns {
|
||||
|
||||
data
|
||||
}};
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! pop_name {
|
||||
() => {{
|
||||
@@ -160,7 +126,7 @@ impl Dns {
|
||||
|
||||
name
|
||||
}};
|
||||
};
|
||||
}
|
||||
|
||||
let transaction_id = pop_n16!();
|
||||
let flags = pop_n16!();
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//! pthread.h implementation for Redox, following https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pthread.h.html
|
||||
|
||||
use core::{cell::Cell, ptr::NonNull};
|
||||
use core::cell::Cell;
|
||||
|
||||
use crate::{
|
||||
header::{sched::*, time::timespec},
|
||||
platform::{self, types::*, Pal, Sys},
|
||||
platform::{types::*, Pal, Sys},
|
||||
pthread,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
use super::*;
|
||||
|
||||
use crate::{header::errno::*, pthread::Errno};
|
||||
|
||||
use core::sync::atomic::AtomicI32 as AtomicInt;
|
||||
use crate::pthread::Errno;
|
||||
|
||||
// PTHREAD_MUTEX_INITIALIZER is defined in bits_pthread/cbindgen.toml
|
||||
|
||||
|
||||
@@ -352,7 +352,7 @@ pub extern "C" fn sigwait(set: *const sigset_t, sig: *mut c_int) -> c_int {
|
||||
return -1;
|
||||
}
|
||||
unsafe {
|
||||
let mut info = pinfo.assume_init();
|
||||
let info = pinfo.assume_init();
|
||||
(*sig) = info.si_signo;
|
||||
}
|
||||
0
|
||||
|
||||
@@ -1238,7 +1238,7 @@ pub unsafe extern "C" fn vsscanf(s: *const c_char, format: *const c_char, ap: va
|
||||
pub unsafe fn flush_io_streams() {
|
||||
let flush = |stream: *mut FILE| {
|
||||
let stream = &mut *stream;
|
||||
stream.flush()
|
||||
let _ = stream.flush();
|
||||
};
|
||||
flush(stdout);
|
||||
flush(stderr);
|
||||
|
||||
@@ -239,13 +239,13 @@ unsafe fn inner_scanf(
|
||||
}
|
||||
}};
|
||||
(c_double) => {
|
||||
parse_type!(noformat c_double);
|
||||
parse_type!(noformat c_double)
|
||||
};
|
||||
(c_float) => {
|
||||
parse_type!(noformat c_float);
|
||||
parse_type!(noformat c_float)
|
||||
};
|
||||
($type:ident) => {
|
||||
parse_type!($type, $type);
|
||||
parse_type!($type, $type)
|
||||
};
|
||||
($type:ident, $final:ty) => {{
|
||||
let n = if n.is_empty() {
|
||||
|
||||
+5
-5
@@ -31,9 +31,7 @@ static mut STATIC_TCB_MASTER: Master = Master {
|
||||
fn panic_notls(msg: impl core::fmt::Display) -> ! {
|
||||
eprintln!("panicked in ld.so: {}", msg);
|
||||
|
||||
unsafe {
|
||||
core::intrinsics::abort();
|
||||
}
|
||||
core::intrinsics::abort();
|
||||
}
|
||||
|
||||
pub trait ExpectTlsFree {
|
||||
@@ -140,12 +138,14 @@ pub fn static_init(sp: &'static Stack) {
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "redox"))]
|
||||
pub unsafe fn init(sp: &'static Stack) {
|
||||
let mut tp = 0usize;
|
||||
let tp: usize;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
const ARCH_GET_FS: usize = 0x1003;
|
||||
syscall!(ARCH_PRCTL, ARCH_GET_FS, &mut tp as *mut usize);
|
||||
let mut val = 0usize;
|
||||
syscall!(ARCH_PRCTL, ARCH_GET_FS, &mut val as *mut usize);
|
||||
tp = val;
|
||||
}
|
||||
#[cfg(all(target_os = "redox", target_arch = "aarch64"))]
|
||||
{
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
use core::{arch::global_asm, mem::size_of};
|
||||
|
||||
use alloc::{boxed::Box, vec::Vec};
|
||||
|
||||
use syscall::{
|
||||
data::Map,
|
||||
error::{Error, Result, EINVAL, ENAMETOOLONG},
|
||||
error::Result,
|
||||
flag::{MapFlags, O_CLOEXEC},
|
||||
SIGCONT,
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::{
|
||||
c_str::{CStr, CString},
|
||||
core_io::{prelude::*, BufReader, SeekFrom},
|
||||
fs::File,
|
||||
header::{fcntl, string::strlen},
|
||||
header::string::strlen,
|
||||
platform::{
|
||||
sys::{S_ISGID, S_ISUID},
|
||||
types::*,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use core::{mem::size_of, ptr, slice};
|
||||
use core::{ptr, slice};
|
||||
|
||||
use crate::platform::{sys::e, types::*};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use core::{arch::asm, convert::TryFrom, mem, ptr, result::Result as CoreResult, slice, str};
|
||||
use core::{convert::TryFrom, mem, ptr, result::Result as CoreResult, slice, str};
|
||||
|
||||
use syscall::{
|
||||
self,
|
||||
@@ -13,7 +13,6 @@ use crate::{
|
||||
dirent::dirent,
|
||||
errno::{EINVAL, EIO, ENOMEM, ENOSYS, EPERM, ERANGE},
|
||||
fcntl,
|
||||
string::strlen,
|
||||
sys_mman::{MAP_ANONYMOUS, PROT_READ, PROT_WRITE},
|
||||
sys_random,
|
||||
sys_resource::{rlimit, RLIM_INFINITY},
|
||||
@@ -25,7 +24,7 @@ use crate::{
|
||||
time::timespec,
|
||||
unistd::{F_OK, R_OK, W_OK, X_OK},
|
||||
},
|
||||
io::{self, prelude::*, BufReader, SeekFrom},
|
||||
io::{self, prelude::*, BufReader},
|
||||
};
|
||||
|
||||
pub use redox_exec::FdGuard;
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
use syscall::{data::Stat, error::*, flag::*};
|
||||
|
||||
use alloc::{
|
||||
borrow::{Cow, ToOwned},
|
||||
boxed::Box,
|
||||
string::String,
|
||||
vec::Vec,
|
||||
};
|
||||
use alloc::{borrow::ToOwned, boxed::Box, string::String, vec::Vec};
|
||||
|
||||
use super::FdGuard;
|
||||
use crate::sync::Mutex;
|
||||
|
||||
@@ -14,7 +14,7 @@ use crate::{
|
||||
fs::File,
|
||||
header::{errno as errnoh, fcntl, signal, sys_ptrace},
|
||||
io::{self, prelude::*},
|
||||
sync::{Mutex, Once},
|
||||
sync::Mutex,
|
||||
};
|
||||
|
||||
use alloc::collections::{btree_map::Entry, BTreeMap};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![no_std]
|
||||
#![feature(array_chunks, map_first_last)]
|
||||
#![feature(array_chunks)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
|
||||
+2
-4
@@ -3,10 +3,10 @@
|
||||
use core::{
|
||||
cell::{Cell, UnsafeCell},
|
||||
ptr::NonNull,
|
||||
sync::atomic::{AtomicBool, AtomicU32, AtomicUsize, Ordering},
|
||||
sync::atomic::{AtomicBool, AtomicUsize, Ordering},
|
||||
};
|
||||
|
||||
use alloc::{boxed::Box, collections::BTreeMap, vec::Vec};
|
||||
use alloc::{boxed::Box, collections::BTreeMap};
|
||||
|
||||
use crate::{
|
||||
header::{errno::*, pthread as header, sched::sched_param, sys_mman},
|
||||
@@ -84,8 +84,6 @@ pub struct OsTid {
|
||||
unsafe impl Send for Pthread {}
|
||||
unsafe impl Sync for Pthread {}
|
||||
|
||||
use crate::header::bits_pthread::pthread_attr_t;
|
||||
|
||||
/// Positive error codes (EINVAL, not -EINVAL).
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
// TODO: Move to a more generic place.
|
||||
|
||||
+1
-5
@@ -1,8 +1,4 @@
|
||||
use core::{
|
||||
cmp,
|
||||
num::NonZeroU32,
|
||||
sync::atomic::{AtomicU32 as AtomicUint, Ordering},
|
||||
};
|
||||
use core::num::NonZeroU32;
|
||||
|
||||
pub struct Barrier {
|
||||
original_count: NonZeroU32,
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// Used design from https://www.remlab.net/op/futex-condvar.shtml
|
||||
|
||||
use crate::{
|
||||
header::{bits_pthread::*, pthread::*, time::timespec},
|
||||
header::{pthread::*, time::timespec},
|
||||
pthread::Errno,
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use super::{AtomicLock, AttemptStatus};
|
||||
use super::AttemptStatus;
|
||||
use crate::platform::types::*;
|
||||
use core::{
|
||||
cell::UnsafeCell,
|
||||
|
||||
@@ -4,7 +4,7 @@ use core::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
header::{errno::*, pthread::*, sys_wait::*, time::timespec},
|
||||
header::{errno::*, pthread::*, time::timespec},
|
||||
pthread::*,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// From https://www.remlab.net/op/futex-misc.shtml
|
||||
//TODO: improve implementation
|
||||
|
||||
use super::AtomicLock;
|
||||
use crate::{
|
||||
header::time::{clock_gettime, timespec, CLOCK_MONOTONIC},
|
||||
platform::{types::*, Pal, Sys},
|
||||
platform::types::*,
|
||||
};
|
||||
|
||||
use core::sync::atomic::{AtomicU32, Ordering};
|
||||
|
||||
Reference in New Issue
Block a user