Skip to content

Commit

Permalink
Auto merge of #1956 - JohnTitor:time64, r=JohnTitor
Browse files Browse the repository at this point in the history
Add a deprecation note to `time_t` on musl

cc #1848
  • Loading branch information
bors committed Oct 25, 2020
2 parents 229b109 + d40c7eb commit 6ca151e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
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

0 comments on commit 6ca151e

Please sign in to comment.