Skip to content

Commit a389e14

Browse files
committed
Optionally, keep radix for integer literals in generated bindings
The radices of integer literals in input C and C++ code are retained in the generated bindings, provided that the newly added builder option is set to true, or the corresponding CLI flag is used. If an input header contains constants that have binary, octal, or hexadecimal representation, the literals in the Rust bindings are output with the same number base. E.g., 0x10 in C/C++ header would be output as 0x10 in Rust code. The functionality is accessed with the builder option `keep_integer_radices`, which defaults to `false` for now. `--keep-integer-radices` is the corresponding CLI flag. The existing tests with header files and corresponding expectations that were affected by this change have been adjusted to accommodate the change: The CLI flag for keeping the integer radices was added to the bindgen command for those tests, and the values in the expectations were updated to have the original radix; the new values were confirmed by hand to equal the original ones.
1 parent 5f7aa4b commit a389e14

35 files changed

+745
-99
lines changed

bindgen-tests/tests/expectations/tests/class_static_const.rs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/constant-evaluate.rs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/default-macro-constant-type-signed.rs

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/default-macro-constant-type-unsigned.rs

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/default-macro-constant-type.rs

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/different_radix_literals.rs

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/fit-macro-constant-types-signed.rs

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/fit-macro-constant-types.rs

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/jsval_layout_opaque.rs

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/layout_eth_conf.rs

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)