Skip to content

Add support for Haiku x86 and x86_64 #407

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 8 commits into from
Closed

Add support for Haiku x86 and x86_64 #407

wants to merge 8 commits into from

Conversation

kallisti5
Copy link
Contributor

No description provided.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Looks like travis is also failing when running the style script.

pub fn getifaddrs(ifap: *mut *mut ifaddrs) -> ::c_int;
#[cfg(not(target_os = "haiku"))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these functions get pushed down into the lower modules instead of adding #[cfg] here?

pub type c_long = i64;
#[cfg(target_pointer_width = "32")]
pub type c_ulong = u32;
#[cfg(target_pointer_width = "64")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these #[cfg] get pushed down farther instead of being here? (e.g. a b32 and b64 module)

@@ -0,0 +1,719 @@
use dox::mem;

cfg_if! {
Copy link
Member

@alexcrichton alexcrichton Sep 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be pushed down to separate modules? Currently we try to keep each module to have at most one invocation of cfg_if! for delegating to sub-modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really follow the logic there.. If I move all the ifcfg's into something like this:
mod.rs:

use dox::mem;

cfg_if! {
    if #[cfg(target_pointer_width = "64")] {
        mod b64;
    } else {
        mod b32;
    }
}

b32.rs:

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

const ULONG_SIZE: usize = 32;

Then I begin to get additional style issues:

src/unix/haiku/mod.rs:11 - typedef found after module when it belongs before

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, ok. Move it to the end.

@kallisti5
Copy link
Contributor Author

Two platforms encountered an error. It sucks having to touch so much unrelated code to add a platform in :-|

arm-linux-androideabi

  Compiling libc v0.2.16 (file:///checkout)
src/unix/notbsd/mod.rs:687:39: 687:46 error: type name `ifaddrs` is undefined or not in scope [E0412]

src/unix/notbsd/mod.rs:687     pub fn getifaddrs(ifap: *mut *mut ifaddrs) -> ::c_int;
                                                                 ^~~~~~~
src/macros.rs:26:9: 26:76 note: in this expansion of __cfg_if_apply! (defined in src/macros.rs)
src/macros.rs:15:9: 19:10 note: in this expansion of __cfg_if_items! (defined in src/macros.rs)
src/unix/mod.rs:838:1: 862:2 note: in this expansion of cfg_if! (defined in src/macros.rs)
src/macros.rs:26:9: 26:76 note: in this expansion of __cfg_if_apply! (defined in src/macros.rs)
src/macros.rs:27:9: 27:60 note: in this expansion of __cfg_if_items! (defined in src/macros.rs)
src/macros.rs:15:9: 19:10 note: in this expansion of __cfg_if_items! (defined in src/macros.rs)
src/lib.rs:264:1: 274:2 note: in this expansion of cfg_if! (defined in src/macros.rs)
src/unix/notbsd/mod.rs:687:39: 687:46 help: run `rustc --explain E0412` to see a detailed explanation
src/unix/notbsd/mod.rs:687:39: 687:46 help: no candidates by the name of `ifaddrs` found in your project; maybe you misspelled the name or forgot to import an external crate?
src/unix/notbsd/mod.rs:688:34: 688:41 error: type name `ifaddrs` is undefined or not in scope [E0412]
src/unix/notbsd/mod.rs:688     pub fn freeifaddrs(ifa: *mut ifaddrs);
                                                            ^~~~~~~
src/macros.rs:26:9: 26:76 note: in this expansion of __cfg_if_apply! (defined in src/macros.rs)
src/macros.rs:15:9: 19:10 note: in this expansion of __cfg_if_items! (defined in src/macros.rs)
src/unix/mod.rs:838:1: 862:2 note: in this expansion of cfg_if! (defined in src/macros.rs)
src/macros.rs:26:9: 26:76 note: in this expansion of __cfg_if_apply! (defined in src/macros.rs)
src/macros.rs:27:9: 27:60 note: in this expansion of __cfg_if_items! (defined in src/macros.rs)
src/macros.rs:15:9: 19:10 note: in this expansion of __cfg_if_items! (defined in src/macros.rs)
src/lib.rs:264:1: 274:2 note: in this expansion of cfg_if! (defined in src/macros.rs)
src/unix/notbsd/mod.rs:688:34: 688:41 help: run `rustc --explain E0412` to see a detailed explanation
src/unix/notbsd/mod.rs:688:34: 688:41 help: no candidates by the name of `ifaddrs` found in your project; maybe you misspelled the name or forgot to import an external crate?
error: aborting due to 2 previous errors
Build failed, waiting for other jobs to finish...
error: Could not compile `libc`.

x86_64-unknown-linux-gnu

src/unix/notbsd/mod.rs:687:39: 687:46 error: type name `ifaddrs` is undefined or not in scope [E0412]
src/unix/notbsd/mod.rs:687     pub fn getifaddrs(ifap: *mut *mut ifaddrs) -> ::c_int;

                                                                 ^~~~~~~

src/macros.rs:26:9: 26:76 note: in this expansion of __cfg_if_apply! (defined in src/macros.rs)
src/macros.rs:15:9: 19:10 note: in this expansion of __cfg_if_items! (defined in src/macros.rs)
src/unix/mod.rs:838:1: 862:2 note: in this expansion of cfg_if! (defined in src/macros.rs)
src/macros.rs:26:9: 26:76 note: in this expansion of __cfg_if_apply! (defined in src/macros.rs)
src/macros.rs:27:9: 27:60 note: in this expansion of __cfg_if_items! (defined in src/macros.rs)
src/macros.rs:15:9: 19:10 note: in this expansion of __cfg_if_items! (defined in src/macros.rs)
src/lib.rs:264:1: 274:2 note: in this expansion of cfg_if! (defined in src/macros.rs)
src/unix/notbsd/mod.rs:687:39: 687:46 help: no candidates by the name of `ifaddrs` found in your project; maybe you misspelled the name or forgot to import an external crate?
src/unix/notbsd/mod.rs:688:34: 688:41 error: type name `ifaddrs` is undefined or not in scope [E0412]
src/unix/notbsd/mod.rs:688     pub fn freeifaddrs(ifa: *mut ifaddrs);
                                                            ^~~~~~~
src/macros.rs:26:9: 26:76 note: in this expansion of __cfg_if_apply! (defined in src/macros.rs)
src/macros.rs:15:9: 19:10 note: in this expansion of __cfg_if_items! (defined in src/macros.rs)
src/unix/mod.rs:838:1: 862:2 note: in this expansion of cfg_if! (defined in src/macros.rs)
src/macros.rs:26:9: 26:76 note: in this expansion of __cfg_if_apply! (defined in src/macros.rs)
src/macros.rs:27:9: 27:60 note: in this expansion of __cfg_if_items! (defined in src/macros.rs)
src/macros.rs:15:9: 19:10 note: in this expansion of __cfg_if_items! (defined in src/macros.rs)
src/lib.rs:264:1: 274:2 note: in this expansion of cfg_if! (defined in src/macros.rs)
src/unix/notbsd/mod.rs:688:34: 688:41 help: no candidates by the name of `ifaddrs` found in your project; maybe you misspelled the name or forgot to import an external crate?
error: Compilation failed, aborting rustdoc

@alexcrichton
Copy link
Member

Ah the arguments there likely just need to become ::ifaddrs

@alexcrichton
Copy link
Member

Looks like there's still some CI failures?

@kallisti5
Copy link
Contributor Author

Yeah, same issues. Adding the ::'s didn't have any change.

@alexcrichton
Copy link
Member

Oh this was actually in a block that should go away in the sense that these functions don't exist on Android, so you can just push it farther down into the linux-only module.

@kallisti5
Copy link
Contributor Author

Might want to squash these if accepted :-)

@alexcrichton
Copy link
Member

Looks good to me, want to squash?

@avongluck-r1soft
Copy link

Github has a new automatic squash.. any issues trying it out? :-D

@alexcrichton
Copy link
Member

We actually use @bors here for landing PRs rather than hitting the merge button, and @bors doesn't have the ability to auto-squash commits.

@kallisti5
Copy link
Contributor Author

Gotcha. I'll squash and resubmit.

I took a crack at bootstrapping and ran into an interesting compiler-rt error:
http://pastebin.com/BVw7dBFN

llvm supports Haiku, so not really sure what's going on there... the error doesn't make sense either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants