Skip to content

Commit 7581246

Browse files
committed
Re-export c_char_def as c_char instead of defining c_char per target
1 parent 92ffa8c commit 7581246

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+113
-117
lines changed

src/fuchsia/aarch64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::off_t;
23
use crate::prelude::*;
34

4-
pub type c_char = u8;
55
pub type __u64 = c_ulonglong;
66
pub type wchar_t = u32;
77
pub type nlink_t = c_ulong;

src/fuchsia/riscv64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::off_t;
23
use crate::prelude::*;
34

45
// From psABI Calling Convention for RV64
5-
pub type c_char = u8;
66
pub type __u64 = c_ulonglong;
77
pub type wchar_t = i32;
88

src/fuchsia/x86_64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::off_t;
23
use crate::prelude::*;
34

4-
pub type c_char = i8;
55
pub type wchar_t = i32;
66
pub type nlink_t = u64;
77
pub type blksize_t = c_long;

src/hermit.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
//! Hermit C type definitions
22
3+
pub use crate::arch::c_char_def as c_char;
34
use crate::prelude::*;
45

5-
cfg_if! {
6-
if #[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))] {
7-
pub type c_char = u8;
8-
} else {
9-
pub type c_char = i8;
10-
}
11-
}
12-
136
pub type c_schar = i8;
147
pub type c_uchar = u8;
158
pub type c_short = i16;

src/sgx.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! SGX C types definition
22
3+
pub use crate::arch::c_char_def as c_char;
4+
35
pub type c_schar = i8;
46
pub type c_uchar = u8;
57
pub type c_short = i16;
@@ -19,7 +21,6 @@ pub type intptr_t = isize;
1921
pub type uintptr_t = usize;
2022
pub type ssize_t = isize;
2123

22-
pub type c_char = i8;
2324
pub type c_long = i64;
2425
pub type c_ulong = u64;
2526

src/solid/aarch64.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
pub type c_char = i8;
21
pub type wchar_t = u32;
32
pub type c_long = i64;
43
pub type c_ulong = u64;

src/solid/arm.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
pub type c_char = i8;
21
pub type wchar_t = u32;
32
pub type c_long = i32;
43
pub type c_ulong = u32;

src/solid/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//!
33
//! [SOLID]: https://solid.kmckk.com/
44
5+
pub use crate::arch::c_char_def as c_char;
56
use crate::prelude::*;
67

78
pub type c_schar = i8;

src/switch.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Switch C type definitions
22
3+
pub use crate::arch::c_char_def as c_char;
4+
35
pub type c_schar = i8;
46
pub type c_uchar = u8;
57
pub type c_short = i16;
@@ -20,7 +22,6 @@ pub type uintptr_t = usize;
2022
pub type ssize_t = isize;
2123

2224
pub type off_t = i64;
23-
pub type c_char = u8;
2425
pub type c_long = i64;
2526
pub type c_ulong = u64;
2627
pub type wchar_t = u32;

src/teeos/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// only supported on Rust > 1.59, so we can directly reexport c_void from core.
99
pub use core::ffi::c_void;
1010

11+
pub use crate::arch::c_char_def as c_char;
1112
use crate::prelude::*;
1213

1314
pub type c_schar = i8;
@@ -48,9 +49,6 @@ pub type ssize_t = isize;
4849

4950
pub type pid_t = c_int;
5051

51-
// aarch64 specific
52-
pub type c_char = u8;
53-
5452
pub type wchar_t = u32;
5553

5654
pub type c_long = i64;

src/trusty.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
pub use core::ffi::c_void;
22

3+
pub use crate::arch::c_char_def as c_char;
4+
35
pub type size_t = usize;
46
pub type ssize_t = isize;
57

68
pub type off_t = i64;
79

8-
cfg_if! {
9-
if #[cfg(any(target_arch = "aarch64", target_arch = "arm"))] {
10-
pub type c_char = u8;
11-
} else if #[cfg(target_arch = "x86_64")] {
12-
pub type c_char = i8;
13-
}
14-
}
15-
1610
pub type c_schar = i8;
1711
pub type c_uchar = u8;
1812
pub type c_short = i16;

src/unix/aix/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

3-
pub type c_char = u8;
44
pub type caddr_t = *mut c_char;
55
pub type clockid_t = c_longlong;
66
pub type blkcnt_t = c_long;

src/unix/bsd/apple/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
//!
33
//! This covers *-apple-* triples currently
44
5+
pub use crate::arch::c_char_def as c_char;
56
use crate::prelude::*;
67
use crate::{cmsghdr, off_t};
78

8-
pub type c_char = i8;
99
pub type wchar_t = i32;
1010
pub type clock_t = c_ulong;
1111
pub type time_t = c_long;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23
use crate::{cmsghdr, off_t};
34

45
pub type dev_t = u32;
5-
pub type c_char = i8;
66
pub type wchar_t = i32;
77
pub type clock_t = u64;
88
pub type ino_t = u64;

src/unix/bsd/freebsdlike/freebsd/aarch64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

3-
pub type c_char = u8;
44
pub type c_long = i64;
55
pub type c_ulong = u64;
66
pub type clock_t = i32;

src/unix/bsd/freebsdlike/freebsd/arm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

3-
pub type c_char = u8;
44
pub type c_long = i32;
55
pub type c_ulong = u32;
66
pub type clock_t = u32;

src/unix/bsd/freebsdlike/freebsd/powerpc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

3-
pub type c_char = u8;
44
pub type c_long = i32;
55
pub type c_ulong = u32;
66
pub type clock_t = u32;

src/unix/bsd/freebsdlike/freebsd/powerpc64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

3-
pub type c_char = u8;
44
pub type c_long = i64;
55
pub type c_ulong = u64;
66
pub type clock_t = u32;

src/unix/bsd/freebsdlike/freebsd/riscv64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

3-
pub type c_char = u8;
44
pub type c_long = i64;
55
pub type c_ulong = u64;
66
pub type clock_t = i32;

src/unix/bsd/freebsdlike/freebsd/x86.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

3-
pub type c_char = i8;
44
pub type c_long = i32;
55
pub type c_ulong = u32;
66
pub type clock_t = c_ulong;

src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

3-
pub type c_char = i8;
44
pub type c_long = i64;
55
pub type c_ulong = u64;
66
pub type clock_t = i32;

src/unix/bsd/netbsdlike/netbsd/aarch64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23
use crate::PT_FIRSTMACH;
34

45
pub type c_long = i64;
56
pub type c_ulong = u64;
6-
pub type c_char = u8;
77
pub type greg_t = u64;
88
pub type __cpu_simple_lock_nv_t = c_uchar;
99

src/unix/bsd/netbsdlike/netbsd/arm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23
use crate::PT_FIRSTMACH;
34

45
pub type c_long = i32;
56
pub type c_ulong = u32;
6-
pub type c_char = u8;
77
pub type __cpu_simple_lock_nv_t = c_int;
88

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

src/unix/bsd/netbsdlike/netbsd/mips.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23
use crate::PT_FIRSTMACH;
34

45
pub type c_long = i32;
56
pub type c_ulong = u32;
6-
pub type c_char = i8;
77
pub type __cpu_simple_lock_nv_t = c_int;
88

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

src/unix/bsd/netbsdlike/netbsd/powerpc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23
use crate::PT_FIRSTMACH;
34

45
pub type c_long = i32;
56
pub type c_ulong = u32;
6-
pub type c_char = u8;
77
pub type __cpu_simple_lock_nv_t = c_int;
88

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

src/unix/bsd/netbsdlike/netbsd/riscv64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use PT_FIRSTMACH;
22

3+
pub use crate::arch::c_char_def as c_char;
34
use crate::prelude::*;
45

56
pub type c_long = i64;
67
pub type c_ulong = u64;
7-
pub type c_char = u8;
88
pub type __greg_t = u64;
99
pub type __cpu_simple_lock_nv_t = c_int;
1010
pub type __gregset = [__greg_t; _NGREG];

src/unix/bsd/netbsdlike/netbsd/sparc64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

34
pub type c_long = i64;
45
pub type c_ulong = u64;
5-
pub type c_char = i8;
66
pub type __cpu_simple_lock_nv_t = c_uchar;
77

88
// should be pub(crate), but that requires Rust 1.18.0

src/unix/bsd/netbsdlike/netbsd/x86.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

34
pub type c_long = i32;
45
pub type c_ulong = u32;
5-
pub type c_char = i8;
66
pub type __cpu_simple_lock_nv_t = c_uchar;
77

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

src/unix/bsd/netbsdlike/netbsd/x86_64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23
use crate::PT_FIRSTMACH;
34

45
pub type c_long = i64;
56
pub type c_ulong = u64;
6-
pub type c_char = i8;
77
pub type c___greg_t = u64;
88
pub type __cpu_simple_lock_nv_t = c_uchar;
99

src/unix/bsd/netbsdlike/openbsd/aarch64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

34
pub type c_long = i64;
45
pub type c_ulong = u64;
5-
pub type c_char = u8;
66
pub type ucontext_t = sigcontext;
77

88
s! {

src/unix/bsd/netbsdlike/openbsd/arm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

34
pub type c_long = i32;
45
pub type c_ulong = u32;
5-
pub type c_char = u8;
66

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

src/unix/bsd/netbsdlike/openbsd/mips64.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
pub use crate::arch::c_char_def as c_char;
2+
13
pub type c_long = i64;
24
pub type c_ulong = u64;
3-
pub type c_char = i8;
45

56
#[doc(hidden)]
67
pub const _ALIGNBYTES: usize = 7;

src/unix/bsd/netbsdlike/openbsd/powerpc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

34
pub type c_long = i32;
45
pub type c_ulong = u32;
5-
pub type c_char = u8;
66

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

src/unix/bsd/netbsdlike/openbsd/powerpc64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

34
pub type c_long = i64;
45
pub type c_ulong = u64;
5-
pub type c_char = u8;
66

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

src/unix/bsd/netbsdlike/openbsd/riscv64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

34
pub type c_long = i64;
45
pub type c_ulong = u64;
5-
pub type c_char = u8;
66
pub type ucontext_t = sigcontext;
77

88
s! {

src/unix/bsd/netbsdlike/openbsd/sparc64.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
pub use crate::arch::c_char_def as c_char;
2+
13
pub type c_long = i64;
24
pub type c_ulong = u64;
3-
pub type c_char = i8;
45

56
#[doc(hidden)]
67
pub const _ALIGNBYTES: usize = 0xf;

src/unix/bsd/netbsdlike/openbsd/x86.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23

34
pub type c_long = i32;
45
pub type c_ulong = u32;
5-
pub type c_char = i8;
66

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

src/unix/bsd/netbsdlike/openbsd/x86_64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
pub use crate::arch::c_char_def as c_char;
12
use crate::prelude::*;
23
use crate::PT_FIRSTMACH;
34

45
pub type c_long = i64;
56
pub type c_ulong = u64;
6-
pub type c_char = i8;
77
pub type ucontext_t = sigcontext;
88

99
s! {

0 commit comments

Comments
 (0)