Skip to content

[Draft] Add __int128 to unix targets #1414

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

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
10 changes: 9 additions & 1 deletion libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ fn test_apple(target: &str) {
}
});

cfg.skip_field(move |struct_, field| {
match (struct_, field) {
// __int128 does not have fields in C
("__int128", "value") => true,
_ => false,
}
});

cfg.skip_field_type(move |struct_, field| {
match (struct_, field) {
// FIXME: actually a union
Expand All @@ -198,7 +206,7 @@ fn test_apple(target: &str) {
cfg.type_name(move |ty, is_struct, is_union| {
match ty {
// Just pass all these through, no need for a "struct" prefix
"FILE" | "DIR" | "Dl_info" => ty.to_string(),
"FILE" | "DIR" | "Dl_info" | "__int128" => ty.to_string(),

// OSX calls this something else
"sighandler_t" => "sig_t".to_string(),
Expand Down
5 changes: 5 additions & 0 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ impl ::Clone for DIR {
}
pub type locale_t = *mut :: c_void;

#[cfg(target_pointer_width = "64")]
#[repr(C, align(16))]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
pub struct __int128{ pub value: i128 }

s! {
pub struct group {
pub gr_name: *mut ::c_char,
Expand Down