Skip to content

Keep radix for integer literals in generated bindings #3237

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

miikkas
Copy link

@miikkas miikkas commented Jun 18, 2025

I'm not sure if the solution is too "hacky", as I don't have experience with the codebase. Testing is still lacking – I'll be sure to still work on that.

Fixes #3236.

@miikkas miikkas force-pushed the keep-radix branch 3 times, most recently from 8f8d206 to 7054e0f Compare June 19, 2025 17:32
@miikkas miikkas marked this pull request as ready for review June 19, 2025 17:35
@miikkas
Copy link
Author

miikkas commented Jun 19, 2025

I have now included additional testing to the PR.

Regarding the 13 failing existing tests: It seems that the differences are due to bindgen now generating, as intended, Rust literals using hexadecimal representation, while the values themselves have correctly stayed the same. Should I fix the expected code accordingly?

miikkas added 2 commits June 21, 2025 19:39
Use the different radix literals for integers that were used in the original C
and C++ header files, now that it is supported. The new values were confirmed
by hand to be the same as the original ones - they are just represented using
the Rust equivalent of the original form.
@miikkas
Copy link
Author

miikkas commented Jun 21, 2025

The test I added was changed to use C++14 instead of C23, as it seems that the latter is not available for clang 9.0, which IIUC is used in the CI.

I have changed the expected side of the previously failing existing tests. Those changes are currently included in a separate commit in case that makes review less cumbersome. I will squash it later as instructed in the contribution guidelines.

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.

Keep the integer literal radices of C in generated Rust
1 participant