diff --git a/.travis.yml b/.travis.yml index 6cebb8ea0..bac7be27b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -145,7 +145,9 @@ matrix: - cargo build --target=x86_64-unknown-netbsd - cargo build --target=x86_64-unknown-redox - cargo build --target=x86_64-fortanix-unknown-sgx - - cargo xbuild --target=x86_64-unknown-cloudabi + # This builds currently fails with: + # Could not find specification for target "x86_64-unknown-cloudabi" + #- cargo xbuild --target=x86_64-unknown-cloudabi - cargo xbuild --target=x86_64-unknown-uefi - cargo xbuild --target=x86_64-unknown-hermit - cargo xbuild --target=x86_64-unknown-l4re-uclibc @@ -158,7 +160,7 @@ matrix: - cargo build --target=x86_64-unknown-netbsd - cargo build --target=x86_64-unknown-redox - cargo build --target=x86_64-fortanix-unknown-sgx - - cargo xbuild --target=x86_64-unknown-cloudabi + #- cargo xbuild --target=x86_64-unknown-cloudabi - cargo xbuild --target=x86_64-unknown-uefi - cargo xbuild --target=x86_64-unknown-hermit - cargo xbuild --target=x86_64-unknown-l4re-uclibc @@ -229,3 +231,4 @@ notifications: branches: only: - master + - 0.1 diff --git a/appveyor.yml b/appveyor.yml index 7a34e3268..c176544bd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -50,3 +50,4 @@ test_script: branches: only: - master + - 0.1 \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index c30540623..af55df58a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -158,75 +158,85 @@ cfg_if! { mod error; pub use crate::error::Error; -#[allow(dead_code)] mod util; -#[cfg(target_os = "vxworks")] -#[allow(dead_code)] -mod util_libc; - -cfg_if! { - // Unlike the other Unix, Fuchsia and iOS don't use the libc to make any calls. - if #[cfg(any(target_os = "android", target_os = "dragonfly", target_os = "emscripten", - target_os = "freebsd", target_os = "haiku", target_os = "illumos", - target_os = "linux", target_os = "macos", target_os = "netbsd", - target_os = "openbsd", target_os = "redox", target_os = "solaris"))] { - #[allow(dead_code)] - mod util_libc; - // Keep std-only trait definitions for backwards compatibility - mod error_impls; - } else if #[cfg(feature = "std")] { - mod error_impls; - } -} - -// These targets read from a file as a fallback method. +// For backwards compatibility, we provide the std-only trait implementations +// for some platforms, even if they don't enable the "std" feature. #[cfg(any( + feature = "std", + all(windows, not(getrandom_uwp)), target_os = "android", + target_os = "dragonfly", + target_os = "emscripten", + target_os = "freebsd", + target_os = "fuchsia", + target_os = "haiku", + target_os = "illumos", + target_os = "ios", target_os = "linux", target_os = "macos", + target_os = "netbsd", + target_os = "openbsd", + target_os = "redox", target_os = "solaris", - target_os = "illumos", ))] -mod use_file; +mod error_impls; // System-specific implementations. // // These should all provide getrandom_inner with the same signature as getrandom. cfg_if! { if #[cfg(target_os = "android")] { + mod util_libc; + mod use_file; #[path = "linux_android.rs"] mod imp; } else if #[cfg(target_os = "cloudabi")] { #[path = "cloudabi.rs"] mod imp; } else if #[cfg(target_os = "dragonfly")] { + mod util_libc; #[path = "use_file.rs"] mod imp; } else if #[cfg(target_os = "emscripten")] { + mod util_libc; #[path = "use_file.rs"] mod imp; } else if #[cfg(target_os = "freebsd")] { + mod util_libc; #[path = "bsd_arandom.rs"] mod imp; } else if #[cfg(target_os = "fuchsia")] { #[path = "fuchsia.rs"] mod imp; } else if #[cfg(target_os = "haiku")] { + mod util_libc; #[path = "use_file.rs"] mod imp; } else if #[cfg(target_os = "illumos")] { + mod util_libc; + mod use_file; #[path = "solaris_illumos.rs"] mod imp; } else if #[cfg(target_os = "ios")] { #[path = "ios.rs"] mod imp; } else if #[cfg(target_os = "linux")] { + mod util_libc; + mod use_file; #[path = "linux_android.rs"] mod imp; } else if #[cfg(target_os = "macos")] { + mod util_libc; + mod use_file; #[path = "macos.rs"] mod imp; } else if #[cfg(target_os = "netbsd")] { + mod util_libc; #[path = "bsd_arandom.rs"] mod imp; } else if #[cfg(target_os = "openbsd")] { + mod util_libc; #[path = "openbsd.rs"] mod imp; } else if #[cfg(target_os = "redox")] { + mod util_libc; #[path = "use_file.rs"] mod imp; } else if #[cfg(target_os = "solaris")] { + mod util_libc; + mod use_file; #[path = "solaris_illumos.rs"] mod imp; } else if #[cfg(target_os = "wasi")] { #[path = "wasi.rs"] mod imp; } else if #[cfg(target_os = "vxworks")] { + mod util_libc; #[path = "vxworks.rs"] mod imp; } else if #[cfg(all(windows, getrandom_uwp))] { #[path = "windows_uwp.rs"] mod imp; diff --git a/src/util.rs b/src/util.rs index 8dbd8ae80..06e23c28c 100644 --- a/src/util.rs +++ b/src/util.rs @@ -5,7 +5,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. - +#![allow(dead_code)] use core::sync::atomic::{AtomicUsize, Ordering::Relaxed}; // This structure represents a lazily initialized static usize value. Useful diff --git a/src/util_libc.rs b/src/util_libc.rs index 1cdc13e5a..3cecb1dd6 100644 --- a/src/util_libc.rs +++ b/src/util_libc.rs @@ -5,6 +5,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +#![allow(dead_code)] use crate::error::ERRNO_NOT_POSITIVE; use crate::util::LazyUsize; use crate::Error;