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

Re-export c_char_def as c_char instead of defining c_char per target #4201

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion src/fuchsia/aarch64.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub use crate::arch::c_char_def as c_char;
use crate::off_t;
use crate::prelude::*;

pub type c_char = u8;
pub type __u64 = c_ulonglong;
pub type wchar_t = u32;
pub type nlink_t = c_ulong;
Expand Down
2 changes: 1 addition & 1 deletion src/fuchsia/riscv64.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pub use crate::arch::c_char_def as c_char;
use crate::off_t;
use crate::prelude::*;

// From psABI Calling Convention for RV64
pub type c_char = u8;
pub type __u64 = c_ulonglong;
pub type wchar_t = i32;

Expand Down
2 changes: 1 addition & 1 deletion src/fuchsia/x86_64.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub use crate::arch::c_char_def as c_char;
use crate::off_t;
use crate::prelude::*;

pub type c_char = i8;
pub type wchar_t = i32;
pub type nlink_t = u64;
pub type blksize_t = c_long;
Expand Down
9 changes: 1 addition & 8 deletions src/hermit.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
//! Hermit C type definitions
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

cfg_if! {
if #[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))] {
pub type c_char = u8;
} else {
pub type c_char = i8;
}
}

pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
Expand Down
3 changes: 2 additions & 1 deletion src/sgx.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! SGX C types definition
pub use crate::arch::c_char_def as c_char;

pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
Expand All @@ -19,7 +21,6 @@ pub type intptr_t = isize;
pub type uintptr_t = usize;
pub type ssize_t = isize;

pub type c_char = i8;
pub type c_long = i64;
pub type c_ulong = u64;

Expand Down
1 change: 0 additions & 1 deletion src/solid/aarch64.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub type c_char = i8;
pub type wchar_t = u32;
pub type c_long = i64;
pub type c_ulong = u64;
1 change: 0 additions & 1 deletion src/solid/arm.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub type c_char = i8;
pub type wchar_t = u32;
pub type c_long = i32;
pub type c_ulong = u32;
1 change: 1 addition & 0 deletions src/solid/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//!
//! [SOLID]: https://solid.kmckk.com/
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_schar = i8;
Expand Down
3 changes: 2 additions & 1 deletion src/switch.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Switch C type definitions
pub use crate::arch::c_char_def as c_char;

pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
Expand All @@ -20,7 +22,6 @@ pub type uintptr_t = usize;
pub type ssize_t = isize;

pub type off_t = i64;
pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type wchar_t = u32;
Expand Down
4 changes: 1 addition & 3 deletions src/teeos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_schar = i8;
Expand Down Expand Up @@ -45,9 +46,6 @@ pub type ssize_t = isize;

pub type pid_t = c_int;

// aarch64 specific
pub type c_char = u8;

pub type wchar_t = u32;

pub type c_long = i64;
Expand Down
10 changes: 2 additions & 8 deletions src/trusty.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
use crate::prelude::*;

pub use crate::arch::c_char_def as c_char;

pub type size_t = usize;
pub type ssize_t = isize;

pub type off_t = i64;

cfg_if! {
if #[cfg(any(target_arch = "aarch64", target_arch = "arm"))] {
pub type c_char = u8;
} else if #[cfg(target_arch = "x86_64")] {
pub type c_char = i8;
}
}

pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/aix/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_char = u8;
pub type caddr_t = *mut c_char;
pub type clockid_t = c_longlong;
pub type blkcnt_t = c_long;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//!
//! This covers *-apple-* triples currently
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;
use crate::{cmsghdr, off_t};

pub type c_char = i8;
pub type wchar_t = i32;
pub type clock_t = c_ulong;
pub type time_t = c_long;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;
use crate::{cmsghdr, off_t};

pub type dev_t = u32;
pub type c_char = i8;
pub type wchar_t = i32;
pub type clock_t = u64;
pub type ino_t = u64;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/freebsdlike/freebsd/aarch64.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type clock_t = i32;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/freebsdlike/freebsd/arm.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_char = u8;
pub type c_long = i32;
pub type c_ulong = u32;
pub type clock_t = u32;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/freebsdlike/freebsd/powerpc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_char = u8;
pub type c_long = i32;
pub type c_ulong = u32;
pub type clock_t = u32;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/freebsdlike/freebsd/powerpc64.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type clock_t = u32;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/freebsdlike/freebsd/riscv64.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type clock_t = i32;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/freebsdlike/freebsd/x86.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_char = i8;
pub type c_long = i32;
pub type c_ulong = u32;
pub type clock_t = c_ulong;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_char = i8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type clock_t = i32;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/netbsd/aarch64.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;
use crate::PT_FIRSTMACH;

pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = u8;
pub type greg_t = u64;
pub type __cpu_simple_lock_nv_t = c_uchar;

Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/netbsd/arm.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;
use crate::PT_FIRSTMACH;

pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = u8;
pub type __cpu_simple_lock_nv_t = c_int;

pub(crate) const _ALIGNBYTES: usize = mem::size_of::<c_longlong>() - 1;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/netbsd/mips.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;
use crate::PT_FIRSTMACH;

pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = i8;
pub type __cpu_simple_lock_nv_t = c_int;

pub(crate) const _ALIGNBYTES: usize = mem::size_of::<c_longlong>() - 1;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/netbsd/powerpc.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;
use crate::PT_FIRSTMACH;

pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = u8;
pub type __cpu_simple_lock_nv_t = c_int;

pub(crate) const _ALIGNBYTES: usize = mem::size_of::<c_double>() - 1;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/netbsd/riscv64.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use PT_FIRSTMACH;

pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = u8;
pub type __greg_t = u64;
pub type __cpu_simple_lock_nv_t = c_int;
pub type __gregset = [__greg_t; _NGREG];
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/netbsd/sparc64.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = i8;
pub type __cpu_simple_lock_nv_t = c_uchar;

// should be pub(crate), but that requires Rust 1.18.0
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/netbsd/x86.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = i8;
pub type __cpu_simple_lock_nv_t = c_uchar;

pub(crate) const _ALIGNBYTES: usize = mem::size_of::<c_int>() - 1;
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/netbsd/x86_64.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;
use crate::PT_FIRSTMACH;

pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = i8;
pub type c___greg_t = u64;
pub type __cpu_simple_lock_nv_t = c_uchar;

Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/openbsd/aarch64.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = u8;
pub type ucontext_t = sigcontext;

s! {
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/openbsd/arm.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = u8;

pub(crate) const _ALIGNBYTES: usize = mem::size_of::<c_double>() - 1;

Expand Down
3 changes: 2 additions & 1 deletion src/unix/bsd/netbsdlike/openbsd/mips64.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub use crate::arch::c_char_def as c_char;

pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = i8;

#[doc(hidden)]
pub const _ALIGNBYTES: usize = 7;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/openbsd/powerpc.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = u8;

pub(crate) const _ALIGNBYTES: usize = mem::size_of::<c_double>() - 1;

Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/openbsd/powerpc64.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = u8;

pub(crate) const _ALIGNBYTES: usize = mem::size_of::<c_long>() - 1;

Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/openbsd/riscv64.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = u8;
pub type ucontext_t = sigcontext;

s! {
Expand Down
3 changes: 2 additions & 1 deletion src/unix/bsd/netbsdlike/openbsd/sparc64.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub use crate::arch::c_char_def as c_char;

pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = i8;

#[doc(hidden)]
pub const _ALIGNBYTES: usize = 0xf;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/openbsd/x86.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = i8;

pub(crate) const _ALIGNBYTES: usize = mem::size_of::<c_int>() - 1;

Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/openbsd/x86_64.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;
use crate::PT_FIRSTMACH;

pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = i8;
pub type ucontext_t = sigcontext;

s! {
Expand Down
Loading
Loading