Use libc::c_char instead of i8 for char pointer casts#3
Open
jonathanrainer wants to merge 1 commit into0k:mainfrom
Open
Use libc::c_char instead of i8 for char pointer casts#3jonathanrainer wants to merge 1 commit into0k:mainfrom
jonathanrainer wants to merge 1 commit into0k:mainfrom
Conversation
On ARM64 Linux, C `char` is unsigned (u8), so the fyaml-sys bindings emit `*const u8` for `const char *` parameters. The hardcoded `as *const i8` casts fail to compile on aarch64-unknown-linux-musl. Replace all `as *const i8` with `as *const libc::c_char` (= i8 on x86_64, u8 on aarch64) so the casts match the platform-appropriate type produced by bindgen, enabling builds on both architectures.
3 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On ARM64 Linux, C
charis unsigned (u8), so the fyaml-sys bindings emit*const u8forconst char *parameters. However on x86 the Ccharis signed so an i8 is used instead. This is fine, but it means fyaml fails to compile on aarch64-unknown-linux-musl.This is fixed by replacing all
as *const i8withas *const libc::c_char(= i8 on x86_64, u8 on aarch64) so the casts match the platform-appropriate type produced by bindgen, enabling builds on both architectures.