-
Notifications
You must be signed in to change notification settings - Fork 759
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
base: main
Are you sure you want to change the base?
Conversation
8f8d206
to
7054e0f
Compare
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? |
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. |
9064c00
to
2733cf6
Compare
I have made the solution a lot more robust and included further unit testing. r? @emilio |
fc8e1d6
to
91928a9
Compare
To mitigate possible churn and not force the feature on all users immediately, I've added an option defaulting to off as per #3236 (comment). |
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.
- Gate the integer literal radix retaining functionality behind option `keep_integer_radices`, defaulting to `false` for now. - Add the new `--keep-integer-radices` flag to test headers that are affected by it.
The radices of integer literals in the input code, including both C/C++, are retained in the generated bindings.
Builder
/CLI option which, for now, defaults to turning the feature off.CXToken_Literal
token and as a new test header file paired with its matching expected Rust binding output.There are currently three commits, which I'll squash after review as per the contribution guidelines.
Fixes #3236.