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

Deprecate fixed width integer type aliases #1379

Merged
merged 3 commits into from May 29, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/cloudabi/mod.rs
@@ -1,12 +1,3 @@
pub type int8_t = i8;
pub type int16_t = i16;
pub type int32_t = i32;
pub type int64_t = i64;
pub type uint8_t = u8;
pub type uint16_t = u16;
pub type uint32_t = u32;
pub type uint64_t = u64;

pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
Expand Down
44 changes: 44 additions & 0 deletions src/fixed_width_ints.rs
@@ -0,0 +1,44 @@
//! This module contains type aliases for C's fixed-width integer types .
//!
//! These aliases are deprecated: use the Rust types instead.

#[deprecated(
since = "0.2.55",
note = "Use i8 instead."
)]
pub type int8_t = i8;
#[deprecated(
since = "0.2.55",
note = "Use i16 instead."
)]
pub type int16_t = i16;
#[deprecated(
since = "0.2.55",
note = "Use i32 instead."
)]
pub type int32_t = i32;
#[deprecated(
since = "0.2.55",
note = "Use i64 instead."
)]
pub type int64_t = i64;
#[deprecated(
since = "0.2.55",
note = "Use u8 instead."
)]
pub type uint8_t = u8;
#[deprecated(
since = "0.2.55",
note = "Use u16 instead."
)]
pub type uint16_t = u16;
#[deprecated(
since = "0.2.55",
note = "Use u32 instead."
)]
pub type uint32_t = u32;
#[deprecated(
since = "0.2.55",
note = "Use u64 instead."
)]
pub type uint64_t = u64;
95 changes: 43 additions & 52 deletions src/fuchsia/mod.rs
Expand Up @@ -5,15 +5,6 @@

// PUB_TYPE

pub type int8_t = i8;
pub type int16_t = i16;
pub type int32_t = i32;
pub type int64_t = i64;
pub type uint8_t = u8;
pub type uint16_t = u16;
pub type uint32_t = u32;
pub type uint64_t = u64;

pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
Expand Down Expand Up @@ -410,8 +401,8 @@ s! {
}

pub struct epoll_event {
pub events: ::uint32_t,
pub u64: ::uint64_t,
pub events: u32,
pub u64: u64,
}

pub struct lconv {
Expand Down Expand Up @@ -521,40 +512,40 @@ s! {
}

pub struct dqblk {
pub dqb_bhardlimit: ::uint64_t,
pub dqb_bsoftlimit: ::uint64_t,
pub dqb_curspace: ::uint64_t,
pub dqb_ihardlimit: ::uint64_t,
pub dqb_isoftlimit: ::uint64_t,
pub dqb_curinodes: ::uint64_t,
pub dqb_btime: ::uint64_t,
pub dqb_itime: ::uint64_t,
pub dqb_valid: ::uint32_t,
pub dqb_bhardlimit: u64,
pub dqb_bsoftlimit: u64,
pub dqb_curspace: u64,
pub dqb_ihardlimit: u64,
pub dqb_isoftlimit: u64,
pub dqb_curinodes: u64,
pub dqb_btime: u64,
pub dqb_itime: u64,
pub dqb_valid: u32,
}

pub struct signalfd_siginfo {
pub ssi_signo: ::uint32_t,
pub ssi_errno: ::int32_t,
pub ssi_code: ::int32_t,
pub ssi_pid: ::uint32_t,
pub ssi_uid: ::uint32_t,
pub ssi_fd: ::int32_t,
pub ssi_tid: ::uint32_t,
pub ssi_band: ::uint32_t,
pub ssi_overrun: ::uint32_t,
pub ssi_trapno: ::uint32_t,
pub ssi_status: ::int32_t,
pub ssi_int: ::int32_t,
pub ssi_ptr: ::uint64_t,
pub ssi_utime: ::uint64_t,
pub ssi_stime: ::uint64_t,
pub ssi_addr: ::uint64_t,
pub ssi_addr_lsb: ::uint16_t,
_pad2: ::uint16_t,
pub ssi_syscall: ::int32_t,
pub ssi_call_addr: ::uint64_t,
pub ssi_arch: ::uint32_t,
_pad: [::uint8_t; 28],
pub ssi_signo: u32,
pub ssi_errno: i32,
pub ssi_code: i32,
pub ssi_pid: u32,
pub ssi_uid: u32,
pub ssi_fd: i32,
pub ssi_tid: u32,
pub ssi_band: u32,
pub ssi_overrun: u32,
pub ssi_trapno: u32,
pub ssi_status: i32,
pub ssi_int: i32,
pub ssi_ptr: u64,
pub ssi_utime: u64,
pub ssi_stime: u64,
pub ssi_addr: u64,
pub ssi_addr_lsb: u16,
_pad2: u16,
pub ssi_syscall: i32,
pub ssi_call_addr: u64,
pub ssi_arch: u32,
_pad: [u8; 28],
}

pub struct itimerspec {
Expand Down Expand Up @@ -1803,16 +1794,16 @@ pub const MNT_EXPIRE: ::c_int = 0x4;
pub const Q_GETFMT: ::c_int = 0x800004;
pub const Q_GETINFO: ::c_int = 0x800005;
pub const Q_SETINFO: ::c_int = 0x800006;
pub const QIF_BLIMITS: ::uint32_t = 1;
pub const QIF_SPACE: ::uint32_t = 2;
pub const QIF_ILIMITS: ::uint32_t = 4;
pub const QIF_INODES: ::uint32_t = 8;
pub const QIF_BTIME: ::uint32_t = 16;
pub const QIF_ITIME: ::uint32_t = 32;
pub const QIF_LIMITS: ::uint32_t = 5;
pub const QIF_USAGE: ::uint32_t = 10;
pub const QIF_TIMES: ::uint32_t = 48;
pub const QIF_ALL: ::uint32_t = 63;
pub const QIF_BLIMITS: u32 = 1;
pub const QIF_SPACE: u32 = 2;
pub const QIF_ILIMITS: u32 = 4;
pub const QIF_INODES: u32 = 8;
pub const QIF_BTIME: u32 = 16;
pub const QIF_ITIME: u32 = 32;
pub const QIF_LIMITS: u32 = 5;
pub const QIF_USAGE: u32 = 10;
pub const QIF_TIMES: u32 = 48;
pub const QIF_ALL: u32 = 63;

pub const MNT_FORCE: ::c_int = 0x1;

Expand Down
9 changes: 0 additions & 9 deletions src/hermit/mod.rs
Expand Up @@ -13,15 +13,6 @@
// Ported by Colin Fink <colin.finck@rwth-aachen.de>
// and Stefan Lankes <slankes@eonerc.rwth-aachen.de>

pub type int8_t = i8;
pub type int16_t = i16;
pub type int32_t = i32;
pub type int64_t = i64;
pub type uint8_t = u8;
pub type uint16_t = u16;
pub type uint32_t = u32;
pub type uint64_t = u64;

pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
Expand Down
24 changes: 24 additions & 0 deletions src/lib.rs
Expand Up @@ -90,27 +90,51 @@ cfg_if! {

cfg_if! {
if #[cfg(windows)] {
mod fixed_width_ints;
pub use fixed_width_ints::*;

mod windows;
pub use windows::*;
} else if #[cfg(target_os = "cloudabi")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;

mod cloudabi;
pub use cloudabi::*;
} else if #[cfg(target_os = "fuchsia")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;

mod fuchsia;
pub use fuchsia::*;
} else if #[cfg(target_os = "switch")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;

mod switch;
pub use switch::*;
} else if #[cfg(unix)] {
mod fixed_width_ints;
pub use fixed_width_ints::*;

mod unix;
pub use unix::*;
} else if #[cfg(target_os = "hermit")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;

mod hermit;
pub use hermit::*;
} else if #[cfg(all(target_env = "sgx", target_vendor = "fortanix"))] {
mod fixed_width_ints;
pub use fixed_width_ints::*;

mod sgx;
pub use sgx::*;
} else if #[cfg(any(target_env = "wasi", target_os = "wasi"))] {
mod fixed_width_ints;
pub use fixed_width_ints::*;

mod wasi;
pub use wasi::*;
} else {
Expand Down
9 changes: 0 additions & 9 deletions src/sgx.rs
@@ -1,14 +1,5 @@
//! SGX C types definition

pub type int8_t = i8;
pub type int16_t = i16;
pub type int32_t = i32;
pub type int64_t = i64;
pub type uint8_t = u8;
pub type uint16_t = u16;
pub type uint32_t = u32;
pub type uint64_t = u64;

pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
Expand Down
9 changes: 0 additions & 9 deletions src/switch.rs
@@ -1,14 +1,5 @@
//! Switch C type definitions

pub type int8_t = i8;
pub type int16_t = i16;
pub type int32_t = i32;
pub type int64_t = i64;
pub type uint8_t = u8;
pub type uint16_t = u16;
pub type uint32_t = u32;
pub type uint64_t = u64;

pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
Expand Down
4 changes: 2 additions & 2 deletions src/unix/bsd/apple/b32.rs
Expand Up @@ -39,8 +39,8 @@ s! {

pub struct bpf_hdr {
pub bh_tstamp: ::timeval,
pub bh_caplen: ::uint32_t,
pub bh_datalen: ::uint32_t,
pub bh_caplen: u32,
pub bh_datalen: u32,
pub bh_hdrlen: ::c_ushort,
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/unix/bsd/apple/b64.rs
Expand Up @@ -44,8 +44,8 @@ s! {

pub struct bpf_hdr {
pub bh_tstamp: ::timeval32,
pub bh_caplen: ::uint32_t,
pub bh_datalen: ::uint32_t,
pub bh_caplen: u32,
pub bh_datalen: u32,
pub bh_hdrlen: ::c_ushort,
}
}
Expand Down