summaryrefslogtreecommitdiff
path: root/src/time.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-12-21 22:40:13 +0000
committerGitHub <noreply@github.com>2021-12-21 22:40:13 +0000
commit8eac0ee273d3bc7fa127b95db7f9021570c21c04 (patch)
tree8e03028b17cbe7f19207c81f41928a0419e8507c /src/time.rs
parent4f7119c61da6ab3a11d5e52b5e6cf7105a66efb9 (diff)
parent54587ec651a53dd096754c1623ae8c4624d3740f (diff)
downloadnix-8eac0ee273d3bc7fa127b95db7f9021570c21c04.zip
Merge #1571
1571: Remove broken newlib support r=rtzoeller a=asomers Nix has never supported a newlib target, but there were a few cfg checks for it in our codebase. Some of them were misspelled (newlibc vs newlib), and some of the checks were wrong. Removing them makes the code much more readable. Co-authored-by: Alan Somers <asomers@gmail.com>
Diffstat (limited to 'src/time.rs')
-rw-r--r--src/time.rs91
1 files changed, 35 insertions, 56 deletions
diff --git a/src/time.rs b/src/time.rs
index 6fd06ec8..959769f4 100644
--- a/src/time.rs
+++ b/src/time.rs
@@ -57,10 +57,8 @@ impl ClockId {
#[cfg(not(any(
target_os = "macos",
target_os = "ios",
- all(
- not(any(target_env = "uclibc", target_env = "newlibc")),
- any(target_os = "redox", target_os = "hermit",),
- ),
+ target_os = "redox",
+ target_os = "hermit",
)))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub fn set_time(self, timespec: TimeSpec) -> Result<()> {
@@ -73,30 +71,27 @@ impl ClockId {
}
#[cfg(any(
+ target_os = "android",
+ target_os = "emscripten",
target_os = "fuchsia",
- all(
- not(any(target_env = "uclibc", target_env = "newlib")),
- any(target_os = "linux", target_os = "android", target_os = "emscripten"),
- )
+ target_os = "linux"
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub const CLOCK_BOOTTIME: ClockId = ClockId(libc::CLOCK_BOOTTIME);
#[cfg(any(
+ target_os = "android",
+ target_os = "emscripten",
target_os = "fuchsia",
- all(
- not(any(target_env = "uclibc", target_env = "newlib")),
- any(target_os = "linux", target_os = "android", target_os = "emscripten")
- )
+ target_os = "linux"
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub const CLOCK_BOOTTIME_ALARM: ClockId = ClockId(libc::CLOCK_BOOTTIME_ALARM);
pub const CLOCK_MONOTONIC: ClockId = ClockId(libc::CLOCK_MONOTONIC);
#[cfg(any(
+ target_os = "android",
+ target_os = "emscripten",
target_os = "fuchsia",
- all(
- not(any(target_env = "uclibc", target_env = "newlib")),
- any(target_os = "linux", target_os = "android", target_os = "emscripten")
- )
+ target_os = "linux"
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub const CLOCK_MONOTONIC_COARSE: ClockId = ClockId(libc::CLOCK_MONOTONIC_COARSE);
@@ -107,25 +102,23 @@ impl ClockId {
#[cfg_attr(docsrs, doc(cfg(all())))]
pub const CLOCK_MONOTONIC_PRECISE: ClockId = ClockId(libc::CLOCK_MONOTONIC_PRECISE);
#[cfg(any(
+ target_os = "android",
+ target_os = "emscripten",
target_os = "fuchsia",
- all(
- not(any(target_env = "uclibc", target_env = "newlib")),
- any(target_os = "linux", target_os = "android", target_os = "emscripten")
- )
+ target_os = "linux"
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub const CLOCK_MONOTONIC_RAW: ClockId = ClockId(libc::CLOCK_MONOTONIC_RAW);
#[cfg(any(
+ target_os = "android",
+ target_os = "emscripten",
target_os = "fuchsia",
- target_env = "uclibc",
target_os = "macos",
target_os = "ios",
target_os = "freebsd",
target_os = "dragonfly",
- all(
- not(target_env = "newlib"),
- any(target_os = "linux", target_os = "android", target_os = "emscripten")
- )
+ target_os = "redox",
+ target_os = "linux"
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub const CLOCK_PROCESS_CPUTIME_ID: ClockId = ClockId(libc::CLOCK_PROCESS_CPUTIME_ID);
@@ -134,20 +127,18 @@ impl ClockId {
pub const CLOCK_PROF: ClockId = ClockId(libc::CLOCK_PROF);
pub const CLOCK_REALTIME: ClockId = ClockId(libc::CLOCK_REALTIME);
#[cfg(any(
+ target_os = "android",
+ target_os = "emscripten",
target_os = "fuchsia",
- all(
- not(any(target_env = "uclibc", target_env = "newlib")),
- any(target_os = "linux", target_os = "android", target_os = "emscripten")
- )
+ target_os = "linux"
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub const CLOCK_REALTIME_ALARM: ClockId = ClockId(libc::CLOCK_REALTIME_ALARM);
#[cfg(any(
+ target_os = "android",
+ target_os = "emscripten",
target_os = "fuchsia",
- all(
- not(any(target_env = "uclibc", target_env = "newlib")),
- any(target_os = "linux", target_os = "android", target_os = "emscripten")
- )
+ target_os = "linux"
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub const CLOCK_REALTIME_COARSE: ClockId = ClockId(libc::CLOCK_REALTIME_COARSE);
@@ -161,40 +152,29 @@ impl ClockId {
#[cfg_attr(docsrs, doc(cfg(all())))]
pub const CLOCK_SECOND: ClockId = ClockId(libc::CLOCK_SECOND);
#[cfg(any(
+ target_os = "emscripten",
target_os = "fuchsia",
- all(
- not(any(target_env = "uclibc", target_env = "newlib")),
- any(
- target_os = "emscripten",
- all(target_os = "linux", target_env = "musl")
- )
- )
+ all(target_os = "linux", target_env = "musl")
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub const CLOCK_SGI_CYCLE: ClockId = ClockId(libc::CLOCK_SGI_CYCLE);
#[cfg(any(
+ target_os = "android",
+ target_os = "emscripten",
target_os = "fuchsia",
- all(
- not(any(target_env = "uclibc", target_env = "newlib")),
- any(
- target_os = "emscripten",
- all(target_os = "linux", target_env = "musl")
- )
- )
+ target_os = "linux"
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub const CLOCK_TAI: ClockId = ClockId(libc::CLOCK_TAI);
#[cfg(any(
- target_env = "uclibc",
+ target_os = "android",
+ target_os = "emscripten",
target_os = "fuchsia",
target_os = "ios",
target_os = "macos",
target_os = "freebsd",
target_os = "dragonfly",
- all(
- not(target_env = "newlib"),
- any(target_os = "linux", target_os = "android", target_os = "emscripten",),
- ),
+ target_os = "linux"
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub const CLOCK_THREAD_CPUTIME_ID: ClockId = ClockId(libc::CLOCK_THREAD_CPUTIME_ID);
@@ -257,10 +237,9 @@ pub fn clock_gettime(clock_id: ClockId) -> Result<TimeSpec> {
#[cfg(not(any(
target_os = "macos",
target_os = "ios",
- all(
- not(any(target_env = "uclibc", target_env = "newlibc")),
- any(target_os = "redox", target_os = "hermit",),
- ),
+ target_env = "uclibc",
+ target_os = "redox",
+ target_os = "hermit",
)))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub fn clock_settime(clock_id: ClockId, timespec: TimeSpec) -> Result<()> {