Skip to content

Add a deprecation note to time_t on musl #1956

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

Merged
merged 2 commits into from
Oct 25, 2020
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions src/unix/linux_like/linux/musl/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
pub type pthread_t = *mut ::c_void;
pub type clock_t = c_long;
#[deprecated(
since = "0.2.80",
note = "This type is changed to 64-bit in musl 1.2.0, \
we'll follow that change in the future release. \
See #1848 for more info."
)]
pub type time_t = c_long;
pub type suseconds_t = c_long;
pub type ino_t = u64;
Expand Down
13 changes: 10 additions & 3 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1315,23 +1315,33 @@ extern "C" {
pub fn res_init() -> ::c_int;

#[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
#[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
#[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
#[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "mktime$UNIX2003"
)]
#[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
#[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
pub fn mktime(tm: *mut tm) -> time_t;
#[cfg_attr(target_os = "netbsd", link_name = "__time50")]
#[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
pub fn time(time: *mut time_t) -> time_t;
#[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")]
#[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
pub fn gmtime(time_p: *const time_t) -> *mut tm;
#[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
#[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
pub fn localtime(time_p: *const time_t) -> *mut tm;
#[cfg_attr(target_os = "netbsd", link_name = "__difftime50")]
#[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
pub fn difftime(time1: time_t, time0: time_t) -> ::c_double;
#[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
#[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
pub fn timegm(tm: *mut ::tm) -> time_t;

#[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
#[cfg_attr(
Expand Down Expand Up @@ -1446,9 +1456,6 @@ extern "C" {
#[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
pub fn sigpending(set: *mut sigset_t) -> ::c_int;

#[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
pub fn timegm(tm: *mut ::tm) -> time_t;

pub fn sysconf(name: ::c_int) -> ::c_long;

pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
Expand Down