diff options
| author | Florian Hahn <flo@fhahn.com> | 2015-12-18 13:29:49 +0100 |
|---|---|---|
| committer | Florian Hahn <flo@fhahn.com> | 2015-12-29 16:07:01 +0100 |
| commit | e27cbeff370897b8450caa204c08049651a10c13 (patch) | |
| tree | 471ed007f694634c94b22bfcc5ff4aa2bcc8be16 /src/libstd/sys/unix | |
| parent | 27a1834ce522e3ec7fe4726b1661de16ee30c503 (diff) | |
| download | rust-e27cbeff370897b8450caa204c08049651a10c13.tar.gz rust-e27cbeff370897b8450caa204c08049651a10c13.zip | |
Fix warnings when compiling stdlib with --test
Diffstat (limited to 'src/libstd/sys/unix')
| -rw-r--r-- | src/libstd/sys/unix/mod.rs | 5 | ||||
| -rw-r--r-- | src/libstd/sys/unix/process.rs | 5 | ||||
| -rw-r--r-- | src/libstd/sys/unix/stack_overflow.rs | 11 |
3 files changed, 13 insertions, 8 deletions
diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index 68b0c3d6b0e..929fd2fb0c3 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -45,7 +45,7 @@ pub mod thread_local; pub mod time; pub mod stdio; -#[cfg(not(target_os = "nacl"))] +#[cfg(not(any(target_os = "nacl", test)))] pub fn init() { use libc::signal; // By default, some platforms will send a *signal* when an EPIPE error @@ -59,7 +59,8 @@ pub fn init() { assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != !0); } } -#[cfg(target_os = "nacl")] + +#[cfg(all(target_os = "nacl", not(test)))] pub fn init() { } pub fn decode_error_kind(errno: i32) -> ErrorKind { diff --git a/src/libstd/sys/unix/process.rs b/src/libstd/sys/unix/process.rs index 407fcb0a1b8..495f45f5c7e 100644 --- a/src/libstd/sys/unix/process.rs +++ b/src/libstd/sys/unix/process.rs @@ -462,8 +462,7 @@ mod tests { use mem; use ptr; use libc; - use slice; - use sys::{self, cvt, pipe}; + use sys::{self, cvt}; macro_rules! t { ($e:expr) => { @@ -482,6 +481,8 @@ mod tests { #[cfg(target_os = "android")] unsafe fn sigaddset(set: *mut libc::sigset_t, signum: libc::c_int) -> libc::c_int { + use slice; + let raw = slice::from_raw_parts_mut(set as *mut u8, mem::size_of::<libc::sigset_t>()); let bit = (signum - 1) as usize; raw[bit / 8] |= 1 << (bit % 8); diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs index 9a7f98d24cd..776acd20b06 100644 --- a/src/libstd/sys/unix/stack_overflow.rs +++ b/src/libstd/sys/unix/stack_overflow.rs @@ -7,11 +7,13 @@ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. +#![cfg_attr(test, allow(dead_code))] use libc; use self::imp::{make_handler, drop_handler}; -pub use self::imp::{init, cleanup}; +pub use self::imp::cleanup; +pub use self::imp::init; pub struct Handler { _data: *mut libc::c_void @@ -40,12 +42,11 @@ impl Drop for Handler { target_os = "openbsd"))] mod imp { use super::Handler; - use sys_common::util::report_overflow; use mem; use ptr; + use libc::{sigaltstack, SIGSTKSZ}; use libc::{sigaction, SIGBUS, SIG_DFL, - SA_SIGINFO, SA_ONSTACK, sigaltstack, - SIGSTKSZ, sighandler_t}; + SA_SIGINFO, SA_ONSTACK, sighandler_t}; use libc; use libc::{mmap, munmap}; use libc::{SIGSEGV, PROT_READ, PROT_WRITE, MAP_PRIVATE, MAP_ANON}; @@ -94,6 +95,8 @@ mod imp { unsafe extern fn signal_handler(signum: libc::c_int, info: *mut libc::siginfo_t, _data: *mut libc::c_void) { + use sys_common::util::report_overflow; + let guard = thread_info::stack_guard().unwrap_or(0); let addr = siginfo_si_addr(info) as usize; |
