Skip to content

Replace arch-conditional c_char with a reexport #4205

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
Dec 17, 2024
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
5 changes: 2 additions & 3 deletions ci/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
//! * alignment
//! * leading colons on paths

use std::env;
use std::fs;
use std::io::prelude::*;
use std::path::Path;
use std::{env, fs};

macro_rules! t {
($e:expr) => {
Expand Down Expand Up @@ -130,7 +129,7 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) {
let line = if is_pub { &line[4..] } else { line };

let line_state = if line.starts_with("use ") {
if line.contains("c_void") {
if line.contains("c_void") || line.contains("c_char") {
continue;
}
if is_pub {
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
10 changes: 1 addition & 9 deletions src/trusty.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

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
12 changes: 1 addition & 11 deletions src/unix/nuttx/mod.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;
use crate::{in6_addr, in_addr_t, timespec, DIR};

pub type nlink_t = u16;
pub type ino_t = u16;
pub type blkcnt_t = u64;
pub type blksize_t = i16;
cfg_if! {
if #[cfg(any(
target_arch = "arm",
target_arch = "riscv32",
target_arch = "riscv64",
))] {
pub type c_char = u8;
} else {
pub type c_char = i8;
}
}
pub type c_long = isize;
pub type c_ulong = usize;
pub type cc_t = u8;
Expand Down
8 changes: 1 addition & 7 deletions src/unix/redox/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
pub use crate::arch::c_char_def as c_char;
use crate::prelude::*;

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

cfg_if! {
Expand Down
8 changes: 1 addition & 7 deletions src/unix/solarish/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
use core::mem::size_of;

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

cfg_if! {
if #[cfg(target_arch = "aarch64")] {
pub type c_char = u8;
} else {
pub type c_char = i8;
}
}
pub type c_long = i64;
pub type c_ulong = u64;
pub type caddr_t = *mut c_char;
Expand Down
Loading