-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from gnzlbg/packed
MacOSX uses #pragma pack 4 to pack all of its structs on x86_64 but mach did not. This resulted in the Rust structs of mach having a different layout than the C structs which is undefined behavior. This PR fixes this using repr(packed) for nightly Rust builds. It adds a new opt-in feature to the crate called unstable that enables the repr_packed feature and it conditionally applies repr(packed(N)) to all structs with incorrect layout.
- Loading branch information
Showing
8 changed files
with
19 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
|
||
name = "mach" | ||
version = "0.1.2" | ||
version = "0.2.0" | ||
authors = ["Nick Fitzgerald <[email protected]>", "David Cuddeback <[email protected]>"] | ||
|
||
license = "BSD-2-Clause" | ||
|
@@ -18,5 +18,7 @@ default-features = false | |
[features] | ||
default = [ "use_std", "deprecated" ] | ||
use_std = [ "libc/use_std" ] | ||
# Enables unstable / nightly-only features | ||
unstable = [] | ||
# Enables deprecated and removed APIs. | ||
deprecated = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ authors = ["gnzlbg <[email protected]>"] | |
build = "build.rs" | ||
|
||
[dependencies] | ||
mach = { path = ".." } | ||
mach = { path = "..", features = ["unstable"] } | ||
libc = "0.2" | ||
|
||
[build-dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters