Skip to content
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

C API: u8 in Rust corresponds to unsigned char* in C #3597

Conversation

dannywillems
Copy link

Description

wasm_memory_data returns type is *mut u8 which corresponds in C to unsigned char *. byte_t is used in the C API to represent *mut u8 but it is an alias for char.
When compiling, we get the following warning:

warning: pointer targets in initialization of ‘uint8_t *’ {aka ‘unsigned char *’} from ‘byte_t *’ {aka ‘char *’} differ in signedness [-Wpointer-sign]
  572 |    uint8_t* x420 = wasm_memory_data(x419);

This MR changes the return type from byte_t to unsigned char.

@ptitSeb
Copy link
Contributor

ptitSeb commented Feb 21, 2023

Ah yes, good catch.

@ptitSeb ptitSeb enabled auto-merge (squash) February 21, 2023 13:13
@dannywillems
Copy link
Author

I would suggest to add the flags -Wall -Wextra in the tests.

@syrusakbary
Copy link
Member

We can't move from the standard wasm.h headers or used types.

If you want to change the wasm.h header file, I'd suggest making it a PR to the main wasm-c-api repo:
https://github.com/WebAssembly/wasm-c-api/blob/main/include/wasm.h#L478

Copy link
Member

@syrusakbary syrusakbary left a comment

Choose a reason for hiding this comment

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

We can't merge this as this file is just a mirror of:
https://github.com/WebAssembly/wasm-c-api/blob/main/include/wasm.h#L478

@dannywillems
Copy link
Author

We can't merge this as this file is just a mirror of: https://github.com/WebAssembly/wasm-c-api/blob/main/include/wasm.h#L478

See WebAssembly/wasm-c-api#179

Copy link

stale bot commented Feb 24, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the 🏚 stale Inactive issues or PR label Feb 24, 2024
@syrusakbary
Copy link
Member

Closing this as stale, but feel free to reopen the PR once wasm-c-api merges this upstream

@syrusakbary syrusakbary closed this Mar 5, 2024
auto-merge was automatically disabled March 5, 2024 09:43

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏚 stale Inactive issues or PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants