Skip to content

Commit 8eac0ee

Browse files
bors[bot]asomers
andauthored
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 <[email protected]>
2 parents 4f7119c + 54587ec commit 8eac0ee

File tree

1 file changed

+35
-56
lines changed

1 file changed

+35
-56
lines changed

src/time.rs

+35-56
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ impl ClockId {
5757
#[cfg(not(any(
5858
target_os = "macos",
5959
target_os = "ios",
60-
all(
61-
not(any(target_env = "uclibc", target_env = "newlibc")),
62-
any(target_os = "redox", target_os = "hermit",),
63-
),
60+
target_os = "redox",
61+
target_os = "hermit",
6462
)))]
6563
#[cfg_attr(docsrs, doc(cfg(all())))]
6664
pub fn set_time(self, timespec: TimeSpec) -> Result<()> {
@@ -73,30 +71,27 @@ impl ClockId {
7371
}
7472

7573
#[cfg(any(
74+
target_os = "android",
75+
target_os = "emscripten",
7676
target_os = "fuchsia",
77-
all(
78-
not(any(target_env = "uclibc", target_env = "newlib")),
79-
any(target_os = "linux", target_os = "android", target_os = "emscripten"),
80-
)
77+
target_os = "linux"
8178
))]
8279
#[cfg_attr(docsrs, doc(cfg(all())))]
8380
pub const CLOCK_BOOTTIME: ClockId = ClockId(libc::CLOCK_BOOTTIME);
8481
#[cfg(any(
82+
target_os = "android",
83+
target_os = "emscripten",
8584
target_os = "fuchsia",
86-
all(
87-
not(any(target_env = "uclibc", target_env = "newlib")),
88-
any(target_os = "linux", target_os = "android", target_os = "emscripten")
89-
)
85+
target_os = "linux"
9086
))]
9187
#[cfg_attr(docsrs, doc(cfg(all())))]
9288
pub const CLOCK_BOOTTIME_ALARM: ClockId = ClockId(libc::CLOCK_BOOTTIME_ALARM);
9389
pub const CLOCK_MONOTONIC: ClockId = ClockId(libc::CLOCK_MONOTONIC);
9490
#[cfg(any(
91+
target_os = "android",
92+
target_os = "emscripten",
9593
target_os = "fuchsia",
96-
all(
97-
not(any(target_env = "uclibc", target_env = "newlib")),
98-
any(target_os = "linux", target_os = "android", target_os = "emscripten")
99-
)
94+
target_os = "linux"
10095
))]
10196
#[cfg_attr(docsrs, doc(cfg(all())))]
10297
pub const CLOCK_MONOTONIC_COARSE: ClockId = ClockId(libc::CLOCK_MONOTONIC_COARSE);
@@ -107,25 +102,23 @@ impl ClockId {
107102
#[cfg_attr(docsrs, doc(cfg(all())))]
108103
pub const CLOCK_MONOTONIC_PRECISE: ClockId = ClockId(libc::CLOCK_MONOTONIC_PRECISE);
109104
#[cfg(any(
105+
target_os = "android",
106+
target_os = "emscripten",
110107
target_os = "fuchsia",
111-
all(
112-
not(any(target_env = "uclibc", target_env = "newlib")),
113-
any(target_os = "linux", target_os = "android", target_os = "emscripten")
114-
)
108+
target_os = "linux"
115109
))]
116110
#[cfg_attr(docsrs, doc(cfg(all())))]
117111
pub const CLOCK_MONOTONIC_RAW: ClockId = ClockId(libc::CLOCK_MONOTONIC_RAW);
118112
#[cfg(any(
113+
target_os = "android",
114+
target_os = "emscripten",
119115
target_os = "fuchsia",
120-
target_env = "uclibc",
121116
target_os = "macos",
122117
target_os = "ios",
123118
target_os = "freebsd",
124119
target_os = "dragonfly",
125-
all(
126-
not(target_env = "newlib"),
127-
any(target_os = "linux", target_os = "android", target_os = "emscripten")
128-
)
120+
target_os = "redox",
121+
target_os = "linux"
129122
))]
130123
#[cfg_attr(docsrs, doc(cfg(all())))]
131124
pub const CLOCK_PROCESS_CPUTIME_ID: ClockId = ClockId(libc::CLOCK_PROCESS_CPUTIME_ID);
@@ -134,20 +127,18 @@ impl ClockId {
134127
pub const CLOCK_PROF: ClockId = ClockId(libc::CLOCK_PROF);
135128
pub const CLOCK_REALTIME: ClockId = ClockId(libc::CLOCK_REALTIME);
136129
#[cfg(any(
130+
target_os = "android",
131+
target_os = "emscripten",
137132
target_os = "fuchsia",
138-
all(
139-
not(any(target_env = "uclibc", target_env = "newlib")),
140-
any(target_os = "linux", target_os = "android", target_os = "emscripten")
141-
)
133+
target_os = "linux"
142134
))]
143135
#[cfg_attr(docsrs, doc(cfg(all())))]
144136
pub const CLOCK_REALTIME_ALARM: ClockId = ClockId(libc::CLOCK_REALTIME_ALARM);
145137
#[cfg(any(
138+
target_os = "android",
139+
target_os = "emscripten",
146140
target_os = "fuchsia",
147-
all(
148-
not(any(target_env = "uclibc", target_env = "newlib")),
149-
any(target_os = "linux", target_os = "android", target_os = "emscripten")
150-
)
141+
target_os = "linux"
151142
))]
152143
#[cfg_attr(docsrs, doc(cfg(all())))]
153144
pub const CLOCK_REALTIME_COARSE: ClockId = ClockId(libc::CLOCK_REALTIME_COARSE);
@@ -161,40 +152,29 @@ impl ClockId {
161152
#[cfg_attr(docsrs, doc(cfg(all())))]
162153
pub const CLOCK_SECOND: ClockId = ClockId(libc::CLOCK_SECOND);
163154
#[cfg(any(
155+
target_os = "emscripten",
164156
target_os = "fuchsia",
165-
all(
166-
not(any(target_env = "uclibc", target_env = "newlib")),
167-
any(
168-
target_os = "emscripten",
169-
all(target_os = "linux", target_env = "musl")
170-
)
171-
)
157+
all(target_os = "linux", target_env = "musl")
172158
))]
173159
#[cfg_attr(docsrs, doc(cfg(all())))]
174160
pub const CLOCK_SGI_CYCLE: ClockId = ClockId(libc::CLOCK_SGI_CYCLE);
175161
#[cfg(any(
162+
target_os = "android",
163+
target_os = "emscripten",
176164
target_os = "fuchsia",
177-
all(
178-
not(any(target_env = "uclibc", target_env = "newlib")),
179-
any(
180-
target_os = "emscripten",
181-
all(target_os = "linux", target_env = "musl")
182-
)
183-
)
165+
target_os = "linux"
184166
))]
185167
#[cfg_attr(docsrs, doc(cfg(all())))]
186168
pub const CLOCK_TAI: ClockId = ClockId(libc::CLOCK_TAI);
187169
#[cfg(any(
188-
target_env = "uclibc",
170+
target_os = "android",
171+
target_os = "emscripten",
189172
target_os = "fuchsia",
190173
target_os = "ios",
191174
target_os = "macos",
192175
target_os = "freebsd",
193176
target_os = "dragonfly",
194-
all(
195-
not(target_env = "newlib"),
196-
any(target_os = "linux", target_os = "android", target_os = "emscripten",),
197-
),
177+
target_os = "linux"
198178
))]
199179
#[cfg_attr(docsrs, doc(cfg(all())))]
200180
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> {
257237
#[cfg(not(any(
258238
target_os = "macos",
259239
target_os = "ios",
260-
all(
261-
not(any(target_env = "uclibc", target_env = "newlibc")),
262-
any(target_os = "redox", target_os = "hermit",),
263-
),
240+
target_env = "uclibc",
241+
target_os = "redox",
242+
target_os = "hermit",
264243
)))]
265244
#[cfg_attr(docsrs, doc(cfg(all())))]
266245
pub fn clock_settime(clock_id: ClockId, timespec: TimeSpec) -> Result<()> {

0 commit comments

Comments
 (0)