Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove broken newlib support #1571

Merged
merged 1 commit into from
Dec 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 35 additions & 56 deletions src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ impl ClockId {
#[cfg(not(any(
target_os = "macos",
target_os = "ios",
all(
not(any(target_env = "uclibc", target_env = "newlibc")),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with dropping uclibc here since we don't support it at the moment, but it's worth noting #1603 may need to put it back.

any(target_os = "redox", target_os = "hermit",),
),
target_os = "redox",
target_os = "hermit",
)))]
pub fn set_time(self, timespec: TimeSpec) -> Result<()> {
clock_settime(self, timespec)
Expand All @@ -66,72 +64,65 @@ 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"
))]
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"
))]
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"
))]
pub const CLOCK_MONOTONIC_COARSE: ClockId = ClockId(libc::CLOCK_MONOTONIC_COARSE);
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
pub const CLOCK_MONOTONIC_FAST: ClockId = ClockId(libc::CLOCK_MONOTONIC_FAST);
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
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"
))]
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"
))]
pub const CLOCK_PROCESS_CPUTIME_ID: ClockId = ClockId(libc::CLOCK_PROCESS_CPUTIME_ID);
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
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"
))]
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"
))]
pub const CLOCK_REALTIME_COARSE: ClockId = ClockId(libc::CLOCK_REALTIME_COARSE);
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
Expand All @@ -141,38 +132,27 @@ impl ClockId {
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
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")
))]
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"
))]
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"
))]
pub const CLOCK_THREAD_CPUTIME_ID: ClockId = ClockId(libc::CLOCK_THREAD_CPUTIME_ID);
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
Expand Down Expand Up @@ -229,10 +209,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",
)))]
pub fn clock_settime(clock_id: ClockId, timespec: TimeSpec) -> Result<()> {
let ret = unsafe { libc::clock_settime(clock_id.as_raw(), timespec.as_ref()) };
Expand Down