Skip to content

Commit 64bd72c

Browse files
committed
Avoid usage of thread_local on DragonFlyBSD
Both __errno_location() and __error() return the same value, so the __error() function can be implemented on the Rust side as __errno_location(). This eliminates the sole use of thread_local in this crate.
1 parent a0f5b4b commit 64bd72c

File tree

5 files changed

+6
-33
lines changed

5 files changed

+6
-33
lines changed

build.rs

-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
1616
"libc_const_extern_fn",
1717
"libc_const_extern_fn_unstable",
1818
"libc_deny_warnings",
19-
"libc_thread_local",
2019
];
2120

2221
// Extra values to allow for check-cfg.
@@ -65,11 +64,6 @@ fn main() {
6564
set_cfg("libc_deny_warnings");
6665
}
6766

68-
// #[thread_local] is currently unstable
69-
if rustc_dep_of_std {
70-
set_cfg("libc_thread_local");
71-
}
72-
7367
// Rust >= 1.62.0 allows to use `const_extern_fn` for "Rust" and "C".
7468
if rustc_minor_ver >= 62 {
7569
set_cfg("libc_const_extern_fn");

libc-test/build.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,7 @@ fn do_ctest() {
6767
}
6868

6969
fn ctest_cfg() -> ctest::TestGenerator {
70-
let mut cfg = ctest::TestGenerator::new();
71-
let libc_cfgs = ["libc_thread_local"];
72-
for f in &libc_cfgs {
73-
cfg.cfg(f, None);
74-
}
75-
cfg
70+
ctest::TestGenerator::new()
7671
}
7772

7873
fn do_semver() {

src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#![cfg_attr(libc_deny_warnings, deny(warnings))]
1717
// Attributes needed when building as part of the standard library
1818
#![cfg_attr(feature = "rustc-dep-of-std", feature(link_cfg, no_core))]
19-
#![cfg_attr(libc_thread_local, feature(thread_local))]
2019
// Enable extra lints:
2120
#![cfg_attr(feature = "extra_traits", deny(missing_debug_implementations))]
2221
#![deny(missing_copy_implementations, safe_packed_borrows)]

src/unix/bsd/freebsdlike/dragonfly/errno.rs

-13
This file was deleted.

src/unix/bsd/freebsdlike/dragonfly/mod.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -1589,6 +1589,11 @@ f! {
15891589
pub fn minor(dev: ::dev_t) -> ::c_int {
15901590
(dev & 0xffff00ff) as ::c_int
15911591
}
1592+
1593+
#[deprecated(since = "0.2.77", note = "Use `__errno_location()` instead")]
1594+
pub fn __error() -> *mut ::c_int {
1595+
super::__errno_location()
1596+
}
15921597
}
15931598

15941599
safe_f! {
@@ -1723,10 +1728,3 @@ extern "C" {
17231728
entry: vm_map_entry_t,
17241729
) -> vm_map_entry_t;
17251730
}
1726-
1727-
cfg_if! {
1728-
if #[cfg(libc_thread_local)] {
1729-
mod errno;
1730-
pub use self::errno::*;
1731-
}
1732-
}

0 commit comments

Comments
 (0)