1<!-- START doctoc generated TOC please keep comment here to allow auto update --> 2<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> 3 4- [Unreleased](#unreleased) 5 - [Added](#added) 6 - [Changed](#changed) 7 - [Removed](#removed) 8 - [Fixed](#fixed) 9 - [Security](#security) 10- [0.70.1 (2024-08-20)](#0701-2024-08-20) 11 - [Added](#added-1) 12 - [Changed](#changed-1) 13 - [Removed](#removed-1) 14 - [Fixed](#fixed-1) 15 - [Security](#security-1) 16- [0.70.0 (2024-08-16)](#0700-2024-08-16) 17 - [Added](#added-2) 18 - [Changed](#changed-2) 19 - [Removed](#removed-2) 20 - [Fixed](#fixed-2) 21 - [Security](#security-2) 22- [0.69.4 (2024-02-04)](#0694-2024-02-04) 23 - [Added](#added-3) 24 - [Changed](#changed-3) 25 - [Removed](#removed-3) 26 - [Fixed](#fixed-3) 27 - [Security](#security-3) 28- [0.69.3 (2024-02-04)](#0693-2024-02-04) 29 - [Added](#added-4) 30 - [Changed](#changed-4) 31 - [Removed](#removed-4) 32 - [Fixed](#fixed-4) 33 - [Security](#security-4) 34- [0.69.2 (2024-01-13)](#0692-2024-01-13) 35 - [Added](#added-5) 36 - [Changed](#changed-5) 37 - [Removed](#removed-5) 38 - [Fixed](#fixed-5) 39 - [Security](#security-5) 40- [0.69.1 (2023-11-02)](#0691-2023-11-02) 41 - [Fixed](#fixed-6) 42- [0.69.0 (2023-11-01)](#0690-2023-11-01) 43 - [Added](#added-6) 44 - [Changed](#changed-6) 45 - [Removed](#removed-6) 46 - [Fixed](#fixed-7) 47 - [Security](#security-6) 48- [0.68.1](#0681) 49 - [Fixed](#fixed-8) 50- [0.68.0](#0680) 51 - [Added](#added-7) 52 - [Changed](#changed-7) 53 - [Removed](#removed-7) 54 - [Fixed](#fixed-9) 55- [0.67.0](#0670) 56- [0.66.1](#0661) 57 - [Removed](#removed-8) 58- [0.66.0](#0660) 59 - [Added](#added-8) 60 - [Changed](#changed-8) 61 - [Removed](#removed-9) 62- [0.65.1](#0651) 63 - [Fixed](#fixed-10) 64- [0.65.0](#0650) 65 - [Added](#added-9) 66 - [Changed](#changed-9) 67 - [Removed](#removed-10) 68- [0.64.0](#0640) 69 - [Added](#added-10) 70 - [Changed](#changed-10) 71- [0.63.0](#0630) 72 - [Added](#added-11) 73 - [Changed](#changed-11) 74 - [Removed](#removed-11) 75- [0.62.0](#0620) 76 - [Added](#added-12) 77 - [Changed](#changed-12) 78 - [Fixed](#fixed-11) 79- [0.61.0](#0610) 80 - [Added](#added-13) 81 - [Changed](#changed-13) 82 - [Fixed](#fixed-12) 83- [0.60.1](#0601) 84 - [Fixed](#fixed-13) 85- [0.60.0](#0600) 86 - [Added](#added-14) 87 - [Fixed](#fixed-14) 88 - [Changed](#changed-14) 89 - [Removed](#removed-12) 90- [0.59.2](#0592) 91- [0.59.1](#0591) 92 - [Fixed](#fixed-15) 93- [0.59.0](#0590) 94 - [Added](#added-15) 95 - [Fixed](#fixed-16) 96 - [Changed](#changed-15) 97- [0.58.1](#0581) 98 - [Added](#added-16) 99- [0.58.0](#0580) 100 - [Added](#added-17) 101 - [Fixed](#fixed-17) 102 - [Changed](#changed-16) 103 - [Deprecated](#deprecated) 104 - [Removed](#removed-13) 105 - [Fixed](#fixed-18) 106 - [Security](#security-7) 107- [0.57.0](#0570) 108 - [Added](#added-18) 109 - [Fixed](#fixed-19) 110- [0.56.0](#0560) 111 - [Added](#added-19) 112 - [Changed](#changed-17) 113 - [Fixed](#fixed-20) 114- [0.55.1](#0551) 115 - [Fixed](#fixed-21) 116- [0.55.0](#0550) 117 - [Removed](#removed-14) 118 - [Added](#added-20) 119 - [Changed](#changed-18) 120 - [Fixed](#fixed-22) 121- [0.54.1](#0541) 122 - [Added](#added-21) 123 - [Changed](#changed-19) 124 - [Fixed](#fixed-23) 125- [0.54.0](#0540) 126 - [Added](#added-22) 127 - [Changed](#changed-20) 128 - [Fixed](#fixed-24) 129- [0.53.3](#0533) 130 - [Added](#added-23) 131 - [Fixed](#fixed-25) 132- [0.53.2](#0532) 133 - [Changed](#changed-21) 134- [0.53.1](#0531) 135 - [Added](#added-24) 136- [0.53.0](#0530) 137 - [Added](#added-25) 138 - [Changed](#changed-22) 139 - [Fixed](#fixed-26) 140- [0.52.0](#0520) 141 - [Added](#added-26) 142 - [Changed](#changed-23) 143 - [Fixed](#fixed-27) 144- [0.51.1](#0511) 145 - [Fixed](#fixed-28) 146 - [Changed](#changed-24) 147- [0.51.0](#0510) 148 - [Fixed](#fixed-29) 149 - [Changed](#changed-25) 150 - [Added](#added-27) 151- [0.50.0](#0500) 152 - [Added](#added-28) 153- [0.49.3](#0493) 154 - [Added](#added-29) 155- [0.49.2](#0492) 156 - [Changed](#changed-26) 157- [0.49.1](#0491) 158 - [Fixed](#fixed-30) 159 - [Changed](#changed-27) 160- [0.49.0](#0490) 161 - [Added](#added-30) 162 - [Fixed](#fixed-31) 163 - [Changed](#changed-28) 164- [0.48.1](#0481) 165 - [Fixed](#fixed-32) 166- [0.48.0](#0480) 167 - [Changed](#changed-29) 168 - [Fixed](#fixed-33) 169- [0.47.4](#0474) 170 - [Added](#added-31) 171- [0.47.3](#0473) 172 - [Changed](#changed-30) 173- [0.47.2](#0472) 174 - [Fixed](#fixed-34) 175- [0.47.1](#0471) 176 - [Changed](#changed-31) 177 - [Fixed](#fixed-35) 178- [0.47.0](#0470) 179 - [Changed](#changed-32) 180 - [Fixed](#fixed-36) 181- [0.33.1 .. 0.46.0](#0331--0460) 182 - [Added](#added-32) 183 - [Removed](#removed-15) 184 - [Changed](#changed-33) 185 - [Fixed](#fixed-37) 186- [0.33.1](#0331) 187 - [Fixed](#fixed-38) 188- [0.33.0](#0330) 189- [0.32.2](#0322) 190 - [Fixed](#fixed-39) 191- [0.32.1](#0321) 192 - [Fixed](#fixed-40) 193- [0.32.0](#0320) 194 - [Added](#added-33) 195 - [Changed](#changed-34) 196 - [Fixed](#fixed-41) 197- [0.31.0](#0310) 198 - [Added](#added-34) 199 - [Changed](#changed-35) 200 - [Deprecated](#deprecated-1) 201 - [Removed](#removed-16) 202 - [Fixed](#fixed-42) 203- [0.30.0](#0300) 204 - [Added](#added-35) 205 - [Changed](#changed-36) 206 - [Deprecated](#deprecated-2) 207 - [Fixed](#fixed-43) 208- [0.29.0](#0290) 209 - [Added](#added-36) 210 - [Changed](#changed-37) 211 - [Fixed](#fixed-44) 212 213<!-- END doctoc generated TOC please keep comment here to allow auto update --> 214 215-------------------------------------------------------------------------------- 216# Unreleased 217## Added 218## Changed 219## Removed 220## Fixed 221## Security 222 223# 0.70.1 (2024-08-20) 224## Added 225## Changed 226## Removed 227## Fixed 228- Fix regression where the `const` layout tests were triggering the `unnecessary_operation` and `identity_op` clippy warnings. 229## Security 230 231# 0.70.0 (2024-08-16) 232## Added 233- Add target mappings for riscv64imac and riscv32imafc. 234- Add a complex macro fallback API (#2779). 235- Add option to use DST structs for flexible arrays (--flexarray-dst, #2772). 236- Add option to dynamically load variables (#2812). 237- Add option in CLI to use rustified non-exhaustive enums (--rustified-non-exhaustive-enum, #2847). 238## Changed 239- Remove which and lazy-static dependencies (#2809, #2817). 240- Generate compile-time layout tests (#2787). 241- Print `bindgen-cli` errors to stderr instead of stdout (#2840) 242## Removed 243## Fixed 244- Fix `--formatter=prettyplease` not working in `bindgen-cli` by adding `prettyplease` feature and 245 enabling it by default for `bindgen-cli` (#2789) . 246- Fix `--allowlist-item` so anonymous enums are no longer ignored (#2827). 247- Use clang_getFileLocation instead of clang_getSpellingLocation to fix clang-trunk (#2824). 248- Fix generated constants: `f64::INFINITY`, `f64::NEG_ INFINITY`, `f64::NAN` (#2854). 249## Security 250- Update `tempfile` and `rustix` due to [GHSA-c827-hfw6-qwvm](https://github.com/advisories/GHSA-c827-hfw6-qwvm). 251 252# 0.69.4 (2024-02-04) 253## Added 254## Changed 255- Allow older itertools. (#2745) 256## Removed 257## Fixed 258## Security 259 260# 0.69.3 (2024-02-04) 261## Added 262 263- Added blocklist_var (#2731) 264- Stabilized thiscall_abi (#2661) 265 266## Changed 267 268- Use CR consistently on windows (#2698) 269- Replaced peeking_take_while by itertools (#2724) 270 271## Removed 272## Fixed 273 274- Try to avoid repr(packed) for explicitly aligned types when not needed (#2734) 275- Improved destructor handling on Windows (#2663) 276- Support Float16 (#2667) 277- Fix alignment contribution from bitfields (#2680) 278- Fixed msrv build. 279 280## Security 281 282- Updated shlex dependency (RUSTSEC-2024-0006) 283 284# 0.69.2 (2024-01-13) 285## Added 286## Changed 287## Removed 288## Fixed 289- Fixed generation of extern "C" blocks with llvm 18+. See #2689. 290## Security 291 292# 0.69.1 (2023-11-02) 293 294## Fixed 295- Allow to run `bindgen -v` without an input header argument. 296 297# 0.69.0 (2023-11-01) 298 299## Added 300- Added the `ParseCallbacks::header_file` callback which runs on every filename passed to `Builder::header`. 301- Added the `CargoCallbacks::new` constructor which emits a cargo-rerun line 302 for every input header file by default. 303- Added the `CargoCallbacks::rerun_on_header_files` method to configure whether 304 a cargo-rerun line should be emitted for every input header file. 305## Changed 306- The `--wrap-static-fns` feature was updated so function types that has no 307 argument use `void` as its sole argument. 308- `CargoCallbacks` is no longer a [unit-like 309 struct](https://doc.rust-lang.org/reference/items/structs.html) and the 310 `CargoCallbacks` constant was added to mitigate the breaking nature of this 311 change. This constant has been marked as deprecated and users will have to 312 use the new `CargoCallbacks::new` method in the future. 313## Removed 314## Fixed 315- Allow compiling `bindgen-cli` with a static libclang. 316- Emit an opaque integer type for pointer types that don't have the same size 317 as the target's pointer size. 318- Avoid escaping Objective-C method names unless they are `Self`, `self`, 319 `crate` or `super`. 320## Security 321 322# 0.68.1 323 324## Fixed 325- Fixed errors on the windows artifact build process. 326 327# 0.68.0 328 329## Added 330- The `system` ABI is now supported as an option for the `--override-abi` flag. 331- The `allowlist_item` method and the `--allowlist-item` flag have been 332 included to filter items regardless or their kind. 333- Include installers as release artifacts on Github. 334## Changed 335- The `Clone` implementation for `_BindgenUnionField` has been changed to pass 336 the `incorrect_clone_impl_on_copy_type` Clippy lint. 337- The `c_unwind` ABI can be used without a feature gate for any Rust target version 338 equal to or greater than 1.71. 339 This comes as a result of the ABI being stabilised (in Rust 1.71). 340- Formatting changes when using prettyplease as a formatter due to a new 341 prettyplease version. 342- Avoid generating invalid `CStr` constants when using the `--generate-cstr` 343 option. 344## Removed 345- The `extra_assert` and `extra_assert_eq` macros are no longer exported. 346## Fixed 347- Bindgen no longer panics when parsing an objective-C header that includes a 348 Rust keyword that cannot be a raw identifier, such as: `self`, `crate`, 349 `super` or `Self`. 350 351# 0.67.0 352 353This version was skipped due to some problems on the release workflow. 354 355# 0.66.1 356 357## Removed 358* Revert source order sorting (#2543) due to correctness regressions #2558. 359 360# 0.66.0 361 362## Added 363 364* Added the `--generate-cstr` CLI flag to generate string constants as `&CStr` 365 instead of `&[u8]`. (Requires Rust 1.59 or higher.) 366* Added the `--generate-shell-completions` CLI flag to generate completions for 367 different shells. 368* The `--wrap-static-fns` option can now wrap `va_list` functions as variadic functions 369 with the experimental `ParseCallbacks::wrap_as_variadic_fn` method. 370* Add target mappings for riscv32imc and riscv32imac. 371* Add the `ParseCallbacks::field_visibility` method to modify field visibility. 372 373## Changed 374 375* Non-UTF-8 string constants are now generated as references (`&[u8; SIZE]`) 376 instead of arrays (`[u8; SIZE]`) to match UTF-8 strings. 377* Wrappers for static functions that return `void` no longer contain a `return` 378 statement and only call the static function instead. 379* The `--wrap-static-fns` option no longer emits wrappers for static variadic 380 functions. 381* Depfiles generated with `--depfile` or `Builder::depfile` will now properly 382 generate module names and paths that include spaces by escaping them. To make 383 the escaping clear and consistent, backslashes are also escaped. 384* Updated `bitflags` dependency to 2.2.1. This changes the API of `CodegenConfig`. 385* Prettyplease formatting is gated by an optional, enabled by default Cargo 386 feature when depending on `bindgen` as a library. 387* Items are now parsed in the order they appear in source files. This may result in 388 auto-generated `_bindgen_*` names having a different index. 389* Use default visibility for padding fields: Previously, padding fields were 390 always public. Now, they follow the default visibility for the type they are 391 in. 392* Compute visibility of bitfield unit based on actual field visibility: A 393 bitfield unit field and its related functions now have their visibility 394 determined based on the most private between the default visibility and the 395 actual visibility of the bitfields within the unit. 396 397## Removed 398* Remove redundant Cargo features, which were all implicit: 399 - bindgen-cli: `env_logger` and `log` removed in favor of `logging` 400 - bindgen (lib): 401 + `log` removed in favor of `logging` 402 + `which` removed in favor of `which-logging` 403 + `annotate-snippets` removed in favor of `experimental` 404 405* Prettyplease is available as a `Formatter` variant now. 406 407# 0.65.1 408 409## Fixed 410 411* The `Builder::rustfmt_bindings` method was added back and tagged as 412 deprecated instead of being removed. 413* Broken documentation links were fixed. 414 415# 0.65.0 416 417## Added 418 * Added the `Builder::default_visibility` method and the 419 `--default-visibility` flag to set the default visibility of fields. (#2338) 420 * Added the `--formatter` CLI flag with the values `none`, `rustfmt` and 421 `prettyplease` to select which tool will be used to format the bindings. The 422 default value is `rustfmt`. (#2453) 423 * Added the `Builder::formatter` method and the `Formatter` type to select 424 which tool will be used to format the bindings. (#2453) 425 * Added the `Builder::emit_diagnostics` method and the `--emit-diagnostics` 426 flag to enable emission of diagnostic messages under the `experimental` 427 feature. (#2436) 428 * Added support for the `"efiapi"` calling convention (#2490). 429 * Added the `ParseCallbacks::read_env_var` method which runs everytime 430 `bindgen` reads and environment variable. (#2400) 431 * Added the `ParseCallbacks::generated_link_name_override` method which allow 432 overriding the link name of items. (#2425) 433 * Add support for C `enum`s when generating code while using the 434 `--wrap-static-fns` feature. (#2415) 435 436## Changed 437 * Static functions with no arguments use `void` as their single argument 438 instead of having no arguments when the `--wrap-static-fns` flag is used. 439 (#2443) 440 * The source file generated when the `--wrap-static-fns` flag is enabled now 441 contains `#include` directives with all the input headers and all the source 442 code added with the `header_contents` method. (#2447) 443 * The source file generated when the `--wrap-static-fns` flag no longer uses 444 `asm` labeling and the link name of static wrapper functions is allowed to 445 be mangled. (#2448) 446 * The documentation of the generated `type` aliases now matches the comments 447 of their `typedef` counterparts instead of using the comments of the aliased 448 types. (#2463) 449 * The `Builder::rustfmt_bindings` methods and the `--no-rustfmt-bindings` flag 450 are now deprecated in favor of the formatter API. (#2453) 451 452## Removed 453 * The following deprecated flags were removed: `--use-msvc-mangling`, 454 `--rustfmt-bindings` and `--size_t-is-usize`. (#2408) 455 * The `Bindings::emit_warnings` and `Bindings::warnings` methods were removed 456 in favor of `--emit-diagnostics`. (#2436) 457 * Bindgen no longer generates C string constants that cannot be represented as 458 byte slices. (#2487) 459 460# 0.64.0 461 462## Added 463 * Added a new set of flags `--with-derive-custom`, 464 `--with-derive-custom-struct`, `--with-derive-custom-enum` and 465 `--with-derive-custom-enum` to add custom derives from the CLI. 466 * Added the `--experimental` flag on `bindgen-cli` and the `experimental` 467 feature on `bindgen` to gate experimental features whose implementation is 468 incomplete or are prone to change in a non-backwards compatible manner. 469 * Added a new set of flags and their equivalent builder methods 470 `--wrap-static-fns`, `--wrap-static-fns-suffix` and `--wrap-static-fns-path` 471 to generate C function wrappers for `static` or `static inline` functions. 472 This feature is experimental. 473 474## Changed 475 * Fixed name collisions when having a C `enum` and a `typedef` with the same 476 name. 477 * The `ParseCallbacks::generated_name_override` method now receives `ItemInfo<'_>` as 478 argument instead of a `&str`. 479 * Updated the `clang-sys` crate version to 1.4.0 to support clang 15. 480 * The return type is now omitted in signatures of functions returning `void`. 481 * Updated the `clap` dependency for `bindgen-cli` to 4. 482 * Rewrote the `bindgen-cli` argument parser which could introduce unexpected 483 behavior changes. 484 * The `ParseCallbacks::add_derives` method now receives `DeriveInfo<'_>` as 485 argument instead of a `&str`. This type also includes the kind of target type. 486 487# 0.63.0 488 489## Added 490 * new feature: `process_comments` method to the `ParseCallbacks` trait to 491 handle source code comments. 492 493## Changed 494 * Only wrap unsafe operations in unsafe blocks if the `--wrap_unsafe_ops` 495 option is enabled. 496 * Replace the `name: &str` argument for `ParseCallbacks::add_derives` by 497 `info: DeriveInfo`. 498 * All the rust targets equal or lower than `1.30` are being deprecated and 499 will be removed in the future. If you have a good reason to use any of these 500 targets, please report it in the issue tracker. 501 502## Removed 503 504 * The following deprecated methods and their equivalent CLI arguments were 505 removed: `whitelist_recursively`, `hide_type`, `blacklist_type`, 506 `blacklist_function`, `blacklist_item`, `whitelisted_type`, 507 `whitelist_type`, `whitelist_function`, `whitelisted_function`, 508 `whitelist_var`, `whitelisted_var`, `unstable_rust`. 509 510# 0.62.0 511 512## Added 513 514 * new feature: `--override-abi` flag to override the ABI used by functions 515 matching a regular expression. 516 * new feature: allow using the `C-unwind` ABI in `--override-abi` on nightly 517 rust. 518 519## Changed 520 521 * Regex inputs are sanitized so alternation (`a|b`) is handled correctly but 522 wildcard patterns (`*`) are now considered invalid. The `.*` pattern can be 523 used as a replacement. 524 * the `ParseCallbacks`trait does not require to implement `UnwindSafe`. 525 * the `Builder::parse_callbacks` method no longer overwrites previously added 526 callbacks and composes them in a last-to-first manner. 527 * any generated rust code containing unsafe operations inside unsafe functions 528 is wrapped in unsafe blocks now. 529 530## Fixed 531 532 * Various issues with upcoming clang/libclang versions have been fixed. 533 534# 0.61.0 535 536Released 2022/10/16 537 538## Added 539 540 * new feature: `--sort-semantically` flag to sort the output in a predefined 541 manner [(#1743)]. 542 * new feature: `Bindgen::emit_warnings` method to emit warnings to stderr in 543 build scripts. 544 * new feature: `--newtype-global-enum` flag to generate enum variants as 545 global constants. 546 * new feature: `--default-non-copy-union-style` flag to set the default style 547 of code used to generate unions with non-`Copy` members. 548 * new feature: `--bindgen-wrapper-union` flag to mark any union that matches a 549 regex and has a non-Copy member to use a bindgen-generated wrapper for its 550 fields. 551 * new feature: `--manually-drop-union` flag to mark any union that matches a 552 regex and has a non-`Copy` member to use `ManuallyDrop`. 553 * new feature: `--merge-extern-blocks` flag to merge several `extern` blocks 554 that have the same ABI. 555 * new feature: `--no-size_t-is-usize` flag to not bind `size_t` as `usize`. 556 * new feature: `Builder` implements `Clone`. 557 558## Changed 559 560 * clap and regex have been updated, new msrv is 1.57. 561 * The `--enable-function-attribute-detection` flag is also used to detect 562 diverging functions so the generated bindings use `!` as the return type. 563 * The `--size_t-is-usize` flag is enabled by default. 564 * Unused type aliases for `<stdint.h>` types are no longer emitted. 565 * The `blocklist` options now can be used to block objective-C methods. 566 * The `core::ffi` module is used the sized raw integer types 567 instead of `std::os::raw` if the Rust target version is `1.64` or higher and 568 the `--use-core` flag is enabled. 569 * The `bindgen` CLI utility must be installed using `cargo install 570 bindgen-cli` now. 571 * Using `bindgen` as a library no longer pulls clap and any other CLI 572 related dependencies. 573 574## Fixed 575 576 * Const correctness of incomplete arrays has been fixed. (#2301) 577 * C++ inline namespaces don't panic. (#2294) 578 579[(#1743)]: https://github.com/rust-lang/rust-bindgen/issues/1743 580 581# 0.60.1 582 583Released 2022/06/06 584 585## Fixed 586 587 * Fixed stack overflow in generated tests for structs with many fields (#2219). 588 589# 0.60.0 590 591Released 2022/06/05 592 593## Added 594 595 * Objective-C structs now derive `Debug` and `Copy` to support C and Objective-C structs. [(#2176)][] 596 * Allow fully-qualified derives. (#2156) 597 * Bindings generation now returns a more suitable error (#2125) 598 * `--version --verbose` now prints clang version (#2140). 599 * Experimental vtable generation (#2145). 600 * Added an `--allowlist-file` option (#2122). 601 * Support for vectorcall ABI (#2177). 602 603## Fixed 604 605 * Fixed lifetimes with Objective-C trait templates. [(#2176)][] 606 * Fixed objc imports for non-`#[macro_use]` use. [(#2176)][] 607 * Handle differences between clang and rustc targets for RISCV (#2137). 608 * `BINDGEN_EXTRA_CLANG_ARGS` is respected on the CLI now (#1723). 609 * Use common type alias for anonymous enums in consts mode (#2191) 610 * Look for `#[must_use]` in typedefs (#2206). 611 * Fixed derive on packed structs (#2083). 612 * Fixed warnings on layout tests (#2203). 613 614## Changed 615 616 * cexpr, clap, and nom have been updated, new msrv is 1.54. 617 618## Removed 619 620 * Support for ancient libclang versions has been removed. 621 622 [(#2176)]: https://github.com/rust-lang/rust-bindgen/pull/2176 623 624# 0.59.2 625 626Released 2021/11/26 627 628 * cexpr+env_logger bump. 629 * Various fixes for C++ crashes / hangs. 630 * Enums now respect annotations and derives properly in more cases. 631 * Some more APIs (blocklist-file, etc). 632 * 'static lifetime is elided when appropriate. 633 634# 0.59.1 635 636Released 2021/07/26 637 638## Fixed 639 640 * Fixed incorrect bitfield constructors generated for very large bitfields (#2082). 641 642# 0.59.0 643 644Released 2021/07/20 645 646## Added 647 648 * Support emitting Makefile-syntax depfiles (#2026) 649 * Add a C naming option (#2045) 650 * Allow explicit padding (#2060) 651 * Add custom derives callback (#2059) 652 * Let Rust derive everything but Default for large arrays in 1.47 and later (#2070). 653 654## Fixed 655 656 * Constants now have docstrings (#2027) 657 * Don't generate bindings for deleted member functions. (#2044) 658 * Zero out padding in custom Default trait implementations (#2051) 659 * Identify forward declarations in params. (#2052) 660 * Add env var EXTRA_CLANG_ARGS_<target>. (#2031) 661 662## Changed 663 664 * cexpr and nom have been updated, new msrv is 1.44 (#2073). 665 666# 0.58.1 667 668Released 2021/04/06 669 670## Added 671 672 * Re-introduced unintentionally removed 673 `bindgen::Builder::whitelist_recursively` (deprecated in favor of 674 `bindgen::Builder::allowlist_recursively`). [#2022][] 675 676# 0.58.0 677 678Released 2021/04/03 679 680## Added 681 682 * Add option to translate enum integer types to native Rust integer types. 683 [#2004][] 684 * Add callback to check derives for blocklisted types. [#2007][] 685 * Add a flag to ensure all symbols are resolved when a library is loaded. 686 [#2013][] 687 * Add from_library for generated dynamic library structs [#2011][]. 688 689## Fixed 690 691 * Track union layout more accurately. Fixes [an AArch64 bug] and [makes the 692 bindings more portable] where unions could return garbage data ([#1984]) 693 * Use original name when checking allowlist for anonymous enum variants. [#2006][] 694 695## Changed 696 697## Deprecated 698 699* `bindgen::Builder::whitelist_type` is deprecated in favor of 700 `bindgen::Builder::allowlist_type`. [#1812][] 701 702* `bindgen::Builder::whitelist_function` is deprecated in favor of 703 `bindgen::Builder::allowlist_function`. [#1812][] 704 705* `bindgen::Builder::whitelist_var` is deprecated in favor of 706 `bindgen::Builder::allowlist_var`. [#1812][] 707 708* `--whitelist-type` is deprecated in favor of 709 `--allowlist-type`. [#1812][] 710 711* `--whitelist-function` is deprecated in favor of 712 `--allowlist-function`. [#1812][] 713 714* `--whitelist-var` is deprecated in favor of 715 `--allowlist-var`. [#1812][] 716 717* `bindgen::Builder::blacklist_type` is deprecated in favor of 718 `bindgen::Builder::blocklist_type`. [#1812][] 719 720* `bindgen::Builder::blacklist_function` is deprecated in favor of 721 `bindgen::Builder::blocklist_function`. [#1812][] 722 723* `bindgen::Builder::blacklist_item` is deprecated in favor of 724 `bindgen::Builder::blocklist_item`. [#1812][] 725 726* `--blacklist-type` is deprecated in favor of 727 `--blocklist-type`. [#1812][] 728 729* `--blacklist-function` is deprecated in favor of 730 `--blocklist-function`. [#1812][] 731 732* `--blacklist-item` is deprecated in favor of 733 `--blocklist-item`. [#1812][] 734 735[#1984]: https://github.com/rust-lang/rust-bindgen/pull/1984 736[an AArch64 bug]: https://github.com/rust-lang/rust-bindgen/issues/1973 737[makes the bindings more portable]: https://github.com/rust-lang/rust-bindgen/issues/1983 738 739## Removed 740 741## Fixed 742 743## Security 744 745--- 746 747# 0.57.0 748 749Released 2021/02/01 750 751## Added 752 753* Expose module-raw-lines to the CLI (#1936) 754* Added an option to fit macro constants to smaller types (#1945) 755* Add an option to respect C++ access specifiers on fields (#1968) 756 757## Fixed 758 759* Improved C++ auto-detection (#1933) 760* Fixed layout of bitfields in some edge cases (#1950) 761* Escape the dyn keyword properly (#1951) 762* Use absolute paths for unsaved files passed to clang (#1857). 763 764# 0.56.0 765 766Released 2020/11/26 767 768## Added 769 770* Objective-c bindings generate `From<ChildClass> for ParentClass` as well as `TryFrom<ParentClass> for ChildClass` ([#1883][]). 771* Experimental dynamic library support via `dynamic_library_name` (#1846). 772* Option to disable deriving `Default` on a per-struct basis (#1930). 773 774## Changed 775 776* Objective-c bindings borrow self rather than take ownership ([#1883][]). 777* Templates and enums now correctly use the same naming scheme as other types 778 (#1891). 779 780## Fixed 781 782* Constructors in wasm32 now return a value. (#1877). 783* Fixed objective-c protocol impl blocks for parent classes's protocols ([#1883][]). 784 785[#1883]: https://github.com/rust-lang/rust-bindgen/issues/1883 786 787-------------------------------------------------------------------------------- 788 789# 0.55.1 790 791Released 2020/08/24. 792 793## Fixed 794 795 * Fixed a regression where anonymous enums referenced by members or such won't 796 generate valid Rust code. (#1882). 797 798-------------------------------------------------------------------------------- 799 800# 0.55.0 801 802Released 2020/08/23. 803 804## Removed 805 806 * Support for libclang 3.8 has been removed (#1830). 807 808## Added 809 810 * Added options to avoid deriving the Debug trait (#1858). 811 812 * Added options to allow to override the default anonymous field prefix (#1859). 813 814 * Added options to allow to override the default macro integer type from the 815 command line (#1863). 816 817## Changed 818 819 * Typed anonymous enums now generate better code (#1850). 820 821 * Objective-C bindings are more idiomatic now (#1847). 822 823 * Updated to clang-sys 1.0. Minimum supported rust version is 1.40 as 824 a consequence of that change. 825 826## Fixed 827 828 * Fixed constness of multi-dimensional arrays in some cases (#1861). 829 830 * Fixed wrong target given to clang when compiling with a target which doesn't 831 match the target clang expects (#1870, #1878). 832 833 * Fixed wrong flags being computed for cross-compilation cases where the target 834 wasn't explicitly provided via clang flags (#1872). 835 836Thanks again to all the awesome contributors that sent patches included in this 837release! 838 839-------------------------------------------------------------------------------- 840 841# 0.54.1 842 843Released 2020/07/06. 844 845**Yanked**: The change in #1798 is technically breaking, see PR for details. 846 847## Added 848 849 * Added ParseCallbacks::func_macro to be able to process function-like macros. 850 (#1792). 851 852 * Allowed IntKind::Custom to represent paths instead of idents (#1800). 853 854## Changed 855 856 * Generated comment now includes the bindgen version, and can be disabled 857 (#1814). 858 859 * Various documentation improvements. 860 861## Fixed 862 863 * Typedefs for types with the same names as rust primitive types compiles 864 (#1798). 865 866 * Bindgen dependencies will now get rebuilt when various environment variables 867 that affect bindgen change (#1809, #1813). 868 869 * Various fixes to command_line_flags (#1816, #1819, #1821). 870 871 * Functions that start with `operator` now get properly generated (#1817). 872 873 874Thanks to all the awesome contributors that sent patches included in this 875release! 876 877-------------------------------------------------------------------------------- 878 879# 0.54.0 880 881Released 2020/05/21. 882 883## Added 884 885 * New command line flag to allow disabling untagged unions (#1789). 886 887## Changed 888 889 * Various documentation improvements (#1764, #1751, #1757). 890 * Better Objective-C support (#1722, #1750). 891 892## Fixed 893 894 * Rust method wrappers are not emitted for blacklisted functions (#1775). 895 * Fixed function signatures in some edge cases involving Objective-C or 896 `__stdcall` (#1781). 897 898-------------------------------------------------------------------------------- 899 900# 0.53.3 901 902Released 2020/05/21. 903 904*Note: This release contains the same fixes and additions as 0.54.0, but without 905the Objective-C breaking changes* 906 907## Added 908 909 * New command line flag to allow disabling untagged unions (#1789). 910 911## Fixed 912 913 * Rust method wrappers are not emitted for blacklisted functions (#1775). 914 * Fixed function signatures in some edge cases involving Objective-C or 915 `__stdcall` (#1781). 916 917-------------------------------------------------------------------------------- 918 919# 0.53.2 920 921Released 2020/03/10. 922 923## Changed 924 925 * clang-sys and cexpr have been updated (#1741 and #1744). 926 * Runtime of some commands has been improved (#1737) 927 * Some error messages have been improved (#1734). 928 929-------------------------------------------------------------------------------- 930 931# 0.53.1 932 933Released 2020/02/03. 934 935## Added 936 937 * Opt-in to convert size_t to usize again (#1720). 938 939-------------------------------------------------------------------------------- 940 941# 0.53.0 942 943Released 2020/02/02. 944 945## Added 946 947 * Support for wasm_import_module. (#1691). 948 * non_exhaustive feature is now stable (#1698). 949 * Various objective-C improvements (#1702). 950 951## Changed 952 953 * Removed size_t to usize conversion rule (#1688). 954 955## Fixed 956 957 * Various unneeded padding fields shouldn't be generated anymore (#1710). 958 * Bitfields on packed structs should generate correct layout (#1717). 959 * Too large bitfield blocks now generate compiling code (#1719). 960 961-------------------------------------------------------------------------------- 962 963# 0.52.0 964 965Released 2019/11/19. 966 967## Added 968 969 * Added `newtype` enum style, much like `bitfield` but without the bitwise ops 970 (#1677). 971 * Added support for `MaybeUninit` rather than `mem::uninitialized()` (#1666). 972 * Allowed static linking (#1620) behind a feature. Note that **if you're using 973 `default-features = false`, you probably want to use the `"runtime"` feature 974 to get the same behavior as before**. 975 976## Changed 977 978 * Use c_void from core when --use-core is specified and available (#1634). 979 * Various dependencies and features are non-default now (like `regex` unicode 980 features). 981 982## Fixed 983 984 * Fixed crash when unknown keywords are used before a namespace (#1678). 985 * Do not generate implementation for clone for flexible array members (#1664). 986 * Fixed `#[must_use]` support for libclang 9+ (#1646). 987 * Fixed `BitfieldUnit` constructor to handle 64 bit wide bitfields on 32 bit (#1640). 988 * Added a `ParseCallbacks` handler for included files. (#1637). 989 990# 0.51.1 991 992Released 2019/09/23. 993 994## Fixed 995 996 * Mismatched `Ord` and `PartialOrd` implementations were fixed, which regresses 997 bindgen in funny ways when using rustc nightly. Dot releases for a few of the 998 previous versions of bindgen will be created with this fix. Also, 999 a `v0.51.1-oldsyn` version was uploaded without the syn update. [#1627][] 1000 1001## Changed 1002 1003 * Syn and related dependencies have been updated. [#1611][] 1004 1005 * Switches added to allow less dependencies. In 1006 particular: It won't pull `failure` and related dependencies by default, and 1007 there's a default-on `which-rustfmt` feature which allows to get rid of 1008 `which` altogether. [#1615][] / [#1625][] 1009 1010 * `fxhash` dependency was switched to `rustc-hash`. [#1626][] 1011 1012[#1627]: https://github.com/rust-lang/rust-bindgen/issues/1627 1013[#1611]: https://github.com/rust-lang/rust-bindgen/issues/1611 1014[#1615]: https://github.com/rust-lang/rust-bindgen/issues/1615 1015[#1625]: https://github.com/rust-lang/rust-bindgen/issues/1625 1016[#1626]: https://github.com/rust-lang/rust-bindgen/issues/1626 1017[#1627]: https://github.com/rust-lang/rust-bindgen/issues/1627 1018 1019# 0.51.0 1020 1021Released 2019/07/26. 1022 1023## Fixed 1024 1025 * Improve workaround for LLVM stack overflow when evaluating value-dependent 1026 expressions. [#1591][] 1027 1028 * Bindgen will properly detect the layout of incomplete arrays. [#1592][] 1029 1030 * Bindgen will properly detect the layout of empty unions and forward 1031 declarations of unions. [#1593][] and [#1595][]. Thanks @pmarks! 1032 1033## Changed 1034 1035 * Refactored the way layout of `wchar_t` is computed. This is a breaking change 1036 since `IntKind::WChar` (exposed in `ParseCallbacks`) no longer needs a `size` 1037 member. [#1596][] 1038 1039## Added 1040 1041 * Bindgen now reads `RUSTFMT` in the environment to try to find a suitable 1042 `rustfmt` binary. [#1602][] 1043 1044[#1591]: https://github.com/rust-lang/rust-bindgen/issues/1591 1045[#1592]: https://github.com/rust-lang/rust-bindgen/issues/1592 1046[#1593]: https://github.com/rust-lang/rust-bindgen/issues/1593 1047[#1595]: https://github.com/rust-lang/rust-bindgen/issues/1595 1048[#1596]: https://github.com/rust-lang/rust-bindgen/issues/1596 1049[#1602]: https://github.com/rust-lang/rust-bindgen/issues/1602 1050 1051# 0.50.0 1052 1053Released 2019/07/01. 1054 1055## Added 1056 1057* Fixed pointers to Objective C blocks [#1582][]. 1058 1059* Various bindgen auto-generated types are now constructible in `const fn` 1060 contexts [#1571][] 1061 1062* It is possible to generate `#[non_exhaustive]` enums for rust nightly targets. 1063 [#1575][] 1064 1065* It is possible to avoid building clap now if you're using bindgen as 1066 a library. [#1581][]. 1067 1068[#1571]: https://github.com/rust-lang/rust-bindgen/issues/1571 1069[#1575]: https://github.com/rust-lang/rust-bindgen/issues/1575 1070[#1581]: https://github.com/rust-lang/rust-bindgen/issues/1581 1071[#1582]: https://github.com/rust-lang/rust-bindgen/issues/1582 1072 1073# 0.49.3 1074 1075Released 2019/06/25. **YANKED** 1076 1077## Added 1078 1079* Various bindgen auto-generated types are now constructible in `const fn` 1080 contexts [#1571][] 1081 1082* It is possible to generate `#[non_exhaustive]` enums for rust nightly targets. 1083 [#1575][] 1084 1085* It is possible to avoid building clap now if you're using bindgen as 1086 a library. [#1581][]. 1087 1088[#1571]: https://github.com/rust-lang/rust-bindgen/issues/1571 1089[#1575]: https://github.com/rust-lang/rust-bindgen/issues/1575 1090[#1581]: https://github.com/rust-lang/rust-bindgen/issues/1581 1091 1092# 0.49.2 1093 1094Released 2019/05/22 1095 1096## Changed 1097 1098* Bindgen now has an option to generate array arguments as pointer to the array, 1099 not to the element (so `void foo(int arr[2])` would be generated as 1100 `arr: *mut [c_int; 2]` rather than `arr: *mut c_int`. Thanks @elichai! 1101 [#1564][]. 1102 1103[#1564]: https://github.com/rust-lang/rust-bindgen/issues/1564 1104 1105# 0.49.1 1106 1107Released 2019/05/16 1108 1109## Fixed 1110 1111* Bindgen will not emit `#[link_name]` attributes in win32 and macos for 1112 C functions and constants where it can detect it's not needed (thanks 1113 @michaelwoerister!). [#1558][] 1114 1115## Changed 1116 1117* Bindgen will no longer use `hashbrown` internally, and will use fxhash 1118 and `std::HashMap`. This is equivalent for newer `rustc`s since `hashbrown` 1119 was merged in libstd, and the performance difference should be close to zero 1120 for older rustcs. 1121 1122[#1558]: https://github.com/rust-lang/rust-bindgen/issues/1558 1123 1124# 0.49.0 1125 1126Released 2019/03/27 1127 1128## Added 1129 1130* BINDGEN_EXTRA_CLANG_ARGS environment variable was added (thanks @jhwgh1968!). [#1537][] 1131 1132## Fixed 1133 1134* Bindgen will properly name parameters inside nested function pointer 1135 declarations (thanks @flowbish!). [#1535][] 1136 1137## Changed 1138 1139* Derive code was greatly improved by @jethrogb. [#1540][] 1140* Derive analysis now handles trivial types more gracefully. [#1492][] 1141* clang-sys was updated by @eclipseo. [#1539][] 1142* bindgen should now get include paths correctly even when `--target` is 1143 specified. The `detect_include_paths` option can be used to opt-out of this 1144 behavior. 1145 1146[#1535]: https://github.com/rust-lang/rust-bindgen/issues/1535 1147[#1537]: https://github.com/rust-lang/rust-bindgen/issues/1537 1148[#1540]: https://github.com/rust-lang/rust-bindgen/issues/1540 1149[#1492]: https://github.com/rust-lang/rust-bindgen/issues/1492 1150 1151# 0.48.1 1152 1153Released 2019/03/06 1154 1155## Fixed 1156 1157* Bindgen will properly lay out types that use reference members. [#1531][] 1158 1159[#1531]: https://github.com/rust-lang/rust-bindgen/issues/1531 1160 1161-------------------------------------------------------------------------------- 1162 1163# 0.48.0 1164 1165Released 2019/03/04 1166 1167## Changed 1168 1169* Default rust target was changed to 1.33, which means that bindgen can get much 1170 more often the layout of structs right. [#1529][] 1171 1172## Fixed 1173 1174* Bindgen will output repr(align) just when needed for unions. [#1498][] 1175 1176[#1529]: https://github.com/rust-lang/rust-bindgen/issues/1529 1177[#1498]: https://github.com/rust-lang/rust-bindgen/issues/1498 1178 1179-------------------------------------------------------------------------------- 1180 1181# 0.47.4 1182 1183Released 2020/11/13 1184 1185## Added 1186 1187* Backported BINDGEN_EXTRA_CLANG_ARGS support per request (#1910). 1188 1189-------------------------------------------------------------------------------- 1190 1191# 0.47.3 1192 1193Released 2019/02/25 1194 1195## Changed 1196 1197* Allowed to build with which 1.0. 1198 1199-------------------------------------------------------------------------------- 1200 1201# 0.47.2 1202 1203Released 2019/02/22 1204 1205## Fixed 1206 1207* @flowbish fixed code generation for nested function prototypes. [#1508][] 1208* Some complex C++ constructs no longer panic on code generation [#1513][] 1209* Implicit template parameters are now appended to base classes [#1515][] 1210* @flier fixed single-argument block pointers [#1519][] 1211* Bindgen won't panic when parsing an undeduced auto type [#1525][] 1212 1213[#1508]: https://github.com/rust-lang/rust-bindgen/issues/1508 1214[#1513]: https://github.com/rust-lang/rust-bindgen/issues/1513 1215[#1515]: https://github.com/rust-lang/rust-bindgen/issues/1515 1216[#1519]: https://github.com/rust-lang/rust-bindgen/issues/1519 1217[#1525]: https://github.com/rust-lang/rust-bindgen/issues/1525 1218 1219-------------------------------------------------------------------------------- 1220 1221# 0.47.1 1222 1223Released 2019/02/02 1224 1225## Changed 1226 1227* @luser improved the error message when rustfmt cannot be found [#1501][] 1228 1229## Fixed 1230 1231* Reverted `clang-sys` update for regressions [#1505][] 1232 1233[#1505]: https://github.com/rust-lang/rust-bindgen/issues/1505 1234[#1501]: https://github.com/rust-lang/rust-bindgen/issues/1501 1235 1236-------------------------------------------------------------------------------- 1237 1238# 0.47.0 1239 1240Released 2019/01/19 1241 1242## Changed 1243 1244- `#pragma pack(n)` is now translated to `#[repr(C, packed(n))]` when targeting Rust 1.33+. [#537][] 1245 1246[#537]: https://github.com/rust-lang/rust-bindgen/issues/537 1247 1248* Bitfield enums now use `#[repr(transparent)]` instead of `#[repr(C)]` when targeting Rust 1.28+. [#1474][] 1249 1250[#1474]: https://github.com/rust-lang/rust-bindgen/issues/1474 1251 1252## Fixed 1253 1254* `#[repr(packed)]` is now properly added if the struct only contains a vtable. 1255 [#1495][] 1256 1257[#1495]: https://github.com/rust-lang/rust-bindgen/pull/1495 1258 1259* `clang-sys` should now more accurately find libclang versions when multiple 1260 of them are available. [#1489][] 1261 1262[#1489]: https://github.com/rust-lang/rust-bindgen/pull/1489 1263 1264-------------------------------------------------------------------------------- 1265 1266# 0.33.1 .. 0.46.0 1267 1268https://github.com/rust-lang/rust-bindgen/compare/v0.32.2...v0.46.0 1269 1270(Just a sneak peek, since a lot of stuff has changed :D) 1271 1272## Added 1273 1274* APIs to add lines to specific rust modules / C++ namespaces exist now. 1275 [#1307][] 1276 1277[#1307]: https://github.com/rust-lang/rust-bindgen/issues/1307 1278 1279## Removed 1280 1281* The link options (`link`, `link_framework`, `link_static`) have been removed. 1282 They did nothing already, see [#104][] 1283 1284[#104]: https://github.com/rust-lang/rust-bindgen/issues/104 1285 1286## Changed 1287 1288* Associated constants are used now for bitfield enums when available. [#1166][] 1289 1290[#1166]: https://github.com/rust-lang/rust-bindgen/issues/1166 1291 1292* New versions of a bunch of dependencies (syn / quote / etc.). 1293 1294## Fixed 1295 1296* Better target information from clang to properly generate types when 1297 cross-compiling [#1289][]. 1298 1299[#1289]: https://github.com/rust-lang/rust-bindgen/issues/1289 1300 1301* Pointer constness was fixed in a bunch of cases when using `int const*` and 1302 such. [#1311][] [#1312][]. 1303 1304[#1311]: https://github.com/rust-lang/rust-bindgen/issues/1311 1305[#1312]: https://github.com/rust-lang/rust-bindgen/issues/1312 1306 1307* Bitfields now work properly on big-endian machines. [#1340][] 1308 1309[#1340]: https://github.com/rust-lang/rust-bindgen/issues/1340 1310 1311* `wchar_t` layout works properly now. [#1345][] 1312 1313[#1345]: https://github.com/rust-lang/rust-bindgen/issues/1345 1314 1315* Functions can be blacklisted now. [#1364][] 1316 1317[#1364]: https://github.com/rust-lang/rust-bindgen/issues/1364 1318 1319* ... Lot's more! 1320 1321-------------------------------------------------------------------------------- 1322 1323# 0.33.1 1324 1325Released 2018/02/14 1326 1327## Fixed 1328 1329* Reverted the dependency update to `quote = "0.4"` and addition of the 1330 `proc_macro2` dependency. The `proc_macro2` crate depends on `rustc` internal 1331 libraries, which means that CLIs which use it must be run under `rustup`, 1332 which is not acceptable for `bindgen`. [#1248][] 1333 1334[#1248]: https://github.com/rust-lang/rust-bindgen/issues/1248 1335 1336-------------------------------------------------------------------------------- 1337 1338# 0.33.0 1339 1340-------------------------------------------------------------------------------- 1341 1342# 0.32.2 1343 1344Released 2018/01/22 1345 1346## Fixed 1347 1348* Avoid symbol generation for pure virtual functions. [#1197][] 1349* Handling of `_Complex _Float128`. [#1087][] 1350* Regression on code generation for variadic functions. [#1216][] 1351* Enum code generation generates conflicting repr hint warning. [#1224][] 1352* Constified code generation for enums with an explicit type of `bool`. [#1145][] 1353* Bindgen will now call `rustfmt` directly instead of via `rustup`. [#1184][] 1354 1355[#1197]: https://github.com/rust-lang/rust-bindgen/issues/1197 1356[#1087]: https://github.com/rust-lang/rust-bindgen/issues/1087 1357[#1216]: https://github.com/rust-lang/rust-bindgen/issues/1216 1358[#1224]: https://github.com/rust-lang/rust-bindgen/issues/1224 1359[#1145]: https://github.com/rust-lang/rust-bindgen/issues/1145 1360[#1184]: https://github.com/rust-lang/rust-bindgen/issues/1184 1361 1362# 0.32.1 1363 1364Released 2017/12/18 1365 1366## Fixed 1367 1368* When translating C/C++ `enum`s into Rust `enum`s using `rustified_enum` / 1369 `--rustified-enum`, properly add `#[repr(C)]` to the emitted `enum`. [#1183][] 1370 1371[#1183]: https://github.com/rust-lang/rust-bindgen/issues/1183 1372 1373-------------------------------------------------------------------------------- 1374 1375# 0.32.0 1376 1377Released 2017/12/08 1378 1379## Added 1380 1381* Added support for bit-field allocation units that are larger than 64 bits 1382 wide. Note that individual bit-fields within such units are still restricted 1383 to being no wider than 64 bits. [#1158][] 1384 1385* We can now generate random C header files and test that `bindgen` can process 1386 them with the `quickcheck` crate. Initial support landed in [#1159][] with a 1387 few more additions in follow up pull requests. 1388 1389## Changed 1390 1391* The `bindgen::Builder::{constified_enum_module,{bitfield,rustified}_enum}` 1392 builder methods and their corresponding CLI flags now compare their argument 1393 to the C/C++ `enum`'s "canonical path", which includes leading namespaces, 1394 rather than its "canonical name", which does not. This is a breaking change 1395 that requires callers which target a namespaced C++ enum to call e.g. 1396 `bitfield_enum("<namespace>::<enum_name>")` rather than e.g. 1397 `bitfield_enum("<enum_name>")`. [#1162][] 1398 1399* When a struct is packed to a smaller alignment that is still greater than one, 1400 `bindgen` cannot emit Rust bindings that match the input source. Before, it 1401 would emit `#[repr(packed)]` anyways, which packs to an alignment of one, but 1402 this can lead to misalignment and UB. Now, `bindgen` will detect these 1403 situations and convert the struct into an opaque blob of bytes with the proper 1404 alignment. We are eagerly awaiting support for `#[repr(packed(N))]` in 1405 Rust. [#1136][] 1406 1407## Fixed 1408 1409* There was a perfect storm of conditions that could cause `bindgen` not to emit 1410 any bindings if spawning `rustfmt` to format the bindings failed. This is now 1411 fixed. [#1112][] 1412 1413* In some circumstances, `bindgen` would emit type parameters twice for 1414 references to template instantiations. This is now fixed. [#1113][] 1415 1416* When a C/C++ struct had a field named with a Rust keyword, and `impl_debug` 1417 was enabled, the generated `impl Debug for ...` blocks could reference the 1418 field by the Rust keyword name, rather than the non-keyword field name we 1419 actually end up generating. This is now fixed. [#1123][] 1420 1421* There was a regression in 0.31.0 where C++ template aliases to opaque types 1422 would sometimes not treat the aliased type as opaque. This is now 1423 fixed. [#1118][] 1424 1425* There was a regression in 0.31.0 that could cause `bindgen` to panic when 1426 parsing nested template classes. This is now fixed. [#1127][] 1427 1428* Unnamed bit-fields do not affect alignment of their struct or class in C/C++, 1429 however `bindgen` interpreted them as doing so, which could generate 1430 `#[repr(C)]` structs expecting to have an incorrect alignment. This is now 1431 fixed. [#1076][] 1432 1433* When a zero-sized type was used in a bit-field, `bindgen` could 1434 divide-by-zero. This is now fixed. [#1137][] 1435 1436* When a template parameter is used in a bit-field, `bindgen` would panic. This 1437 is now fixed. [#1140][] 1438 1439* There was a regression in 0.31.0 where if `bindgen` was given a header file 1440 that did not exist, it would panic. This is now fixed, and it will instead 1441 properly report the error. [#1146][] 1442 1443* In some cases, generated bit-field getters and setters could access memory 1444 beyond `self`. This is now fixed. [#954][] 1445 1446[#1162]: https://github.com/rust-lang/rust-bindgen/issues/1162 1447[#1113]: https://github.com/rust-lang/rust-bindgen/issues/1113 1448[#1112]: https://github.com/rust-lang/rust-bindgen/issues/1112 1449[#1123]: https://github.com/rust-lang/rust-bindgen/issues/1123 1450[#1127]: https://github.com/rust-lang/rust-bindgen/issues/1127 1451[#1136]: https://github.com/rust-lang/rust-bindgen/issues/1136 1452[#1137]: https://github.com/rust-lang/rust-bindgen/issues/1137 1453[#1140]: https://github.com/rust-lang/rust-bindgen/issues/1140 1454[#1146]: https://github.com/rust-lang/rust-bindgen/issues/1146 1455[#1118]: https://github.com/rust-lang/rust-bindgen/issues/1118 1456[#1076]: https://github.com/rust-lang/rust-bindgen/issues/1076 1457[#1158]: https://github.com/rust-lang/rust-bindgen/issues/1158 1458 1459-------------------------------------------------------------------------------- 1460 1461# 0.31.0 1462 1463Released 2017/10/27 1464 1465## Added 1466 1467* **A new `bindgen` reviewer: [@pepyakin](https://github.com/pepyakin)** 1468 You can ask @pepyakin to review all your future pull requests with `r? 1469 @pepyakin` from now on 1470 1471* Timers for seeing which phases `bindgen` is spending its time in. On the 1472 command line, use the `--time-phases` flag. From a builder, use the 1473 `bindgen::Builder::time_phases(true)` method. [#938][] 1474 1475* You can now disable `#[derive(Copy)]` for all types with `--no-derive-copy` 1476 and `bindgen::Builder::derive_copy(false)`. [#948][] 1477 1478* We now have an overview of `bindgen`'s code base and architecture for 1479 newcomers in `CONTRIBUTING.md`. [#988][] 1480 1481* Derive `PartialOrd` with the `--with-derive-partialord` CLI flag or 1482 `bindgen::Builder::derive_partialord(true)` builder method. [#882][] 1483 1484* Derive `Ord` with the `--with-derive-ord` CLI flag or 1485 `bindgen::Builder::derive_ord(true)` builder method. [#884][] 1486 1487* When `PartialEq` cannot be derived because of an array larger than Rust's 1488 array-derive limit, `bindgen` can emit an `impl PartialEq for ...` 1489 block. Enable this behavior with the `--impl-partialeq` CLI flag or the 1490 `bindgen::Builder::impl_partialeq(true)` method. [#1012][] 1491 1492* When deriving `PartialEq` for all types, you can now specify particular types 1493 that shouldn't `derive(PartialEq)` with the `--no-partialeq <regex>` CLI flag 1494 or `bindgen::Builder::no_partialeq("<regex>")` builder method. [#996][] 1495 1496* Specify types that should not derive `Copy` with the `--no-copy <regex>` CLI 1497 flag or `bindgen::Builder::no_copy("<regex>")` builder method. This 1498 functionality was previously only available via comment annotations in the 1499 header sources. [#1099][] 1500 1501* When deriving `Hash` for all types, you can now specify particular types that 1502 shouldn't `derive(Hash)` with the `--no-hash <regex>` CLI flag or 1503 `bindgen::Builder::no_hash("<regex>")` builder method. [#1105][] 1504 1505* The `bindgen` users guide now has an [FAQ section][faq]! If you have any FAQ 1506 suggestions to put up there, please open a pull request. [#1020][] 1507 1508* Added `csmith` fuzzing infrastructure. `csmith` generates random C and C++ 1509 programs, we feed those into `bindgen` as headers to generate bindings to, 1510 then test that the generated bindings compile and that their layout tests 1511 pass. This infrastructure landed in 1512 [many small bits](https://github.com/rust-lang/rust-bindgen/issues?utf8=%E2%9C%93&q=label%3AA-csmith%20is%3Aclosed). 1513 1514 We <3 folks who [help us find and fix issues via fuzzing][fuzzing]! *hint 1515 hint* 1516 1517* Added experimental support for the `thiscall` ABI when targeting Rust 1518 nightly. [#1065][] 1519 1520## Changed 1521 1522* If the user does not explicitly pass a `--target` argument for `libclang`, 1523 `bindgen` will insert such an argument itself. See [#942][], [#947][], and 1524 [#953][] for details. 1525 1526* C/C++ `enum`s are now translated into constants by default, rather than Rust 1527 `enum`s. The old behavior was a big footgun because `rustc` assumes that the 1528 only values of an `enum` are its variants, whereas a lot of C/C++ code uses 1529 random values as `enum`s. Put these two things and it leads to *undefined 1530 behavior*. Translating C/C++ `enum`s into Rust `enum`s is still available with 1531 the `--rustified-enum <regex>` CLI flag and 1532 `bindgen::Builder::rustified_enum("<regex>")` builder method. [#758][] 1533 1534* Generated bindings are now pretty printed with `rustfmt` by default. 1535 Previously, this option existed, but was off by default because `syntex` did 1536 an OK job at pretty printing the bindings. Now that we are using `quote! { 1537 ... }` instead of `syntex`, we lost that pretty printing, and now rely on 1538 `rustfmt`. You can disable `rustfmt`ing with `--no-rustfmt-bindings` or 1539 `bindgen::Builder::rustfmt_bindings(false)`. See [#925][] and [#1022][] for 1540 details. 1541 1542## Deprecated 1543 1544* `bindgen::Builder::hide_type` is deprecated in favor of 1545 `bindgen::Builder::blacklist_type`. [#987][] 1546 1547* `bindgen::Builder::whitelisted_type` is deprecated in favor of 1548 `bindgen::Builder::whitelist_type`. [#987][] 1549 1550* `bindgen::Builder::whitelisted_function` is deprecated in favor of 1551 `bindgen::Builder::whitelist_function`. [#985][] 1552 1553* `bindgen::Builder::whitelisted_var` is deprecated in favor of 1554 `bindgen::Builder::whitelist_var`. [#989][] 1555 1556## Removed 1557 1558* Removed the dependency on (unmaintained) `syntex`, and **build times are cut 1559 in half**! 1560 1561 Before: 1562 1563 ``` 1564 $ cargo clean; cargo build 1565 <snip> 1566 Finished dev [unoptimized + debuginfo] target(s) in 98.75 secs 1567 ``` 1568 1569 After: 1570 1571 ``` 1572 $ cargo clean; cargo build 1573 <snip> 1574 Finished dev [unoptimized + debuginfo] target(s) in 46.26 secs 1575 ``` 1576 1577 [#925][] 1578 1579* The `BindgenOptions` type is no longer public. It had been deprecated in 1580 previous releases. Use `bindgen::Builder` instead. [#1000][] 1581 1582## Fixed 1583 1584* Under certain conditions, a globally scoped `enum` could end up with bindings 1585 in the wrong namespace module. [#888][] 1586 1587* Blacklisted types were incorrectly assumed to always be `Copy`able (and 1588 assumed to implement other traits as well). `bindgen` is now conservatively 1589 pessimistic about the traits that blacklisted types implement. [#944][] 1590 1591* When bitfields have a ridiculously large number of bits (for example, 1592 `unsigned : 632;`) then `bindgen` was incorrectly deriving traits that 1593 couldn't be derived, resulting in errors when compiling the bindings, and was 1594 also generating `struct`s with an incorrect layout. Both issues have been 1595 fixed. [#982][] 1596 1597* `_` is a valid identifier in some C++ contexts, but can't be referenced in 1598 Rust, as it is the "throwaway identifier" (a term I just made up, if you use 1599 it now, then you owe me money). `bindgen` will now translate `_` into `__` so 1600 that it can be used on the Rust side. [#1008][] 1601 1602* Nested class definitions were sometimes being emitted in the wrong namespace 1603 module in the generated bindings. [#1048][] 1604 1605* `bindgen` was mis-handling `union`s that contained bitfield members. This has 1606 been fixed. [#744][] 1607 1608* Unsigned constants that were greater than `u32::MAX` were being mis-translated 1609 by `bindgen`. This is now fixed. [#1040][] 1610 1611* When given a directory as an input file, or a file to which we don't have read 1612 permissions, then `bindgen` will print a more useful error message 1613 now. [#1029][] 1614 1615* `bindgen` previously attempted to derive `Hash` for structures with 1616 flexibly-sized array members, but knowing how many elements exist in such 1617 arrays requires program-specific knowledge that `bindgen` cannot 1618 have. [#1094][] 1619 1620[faq]: https://rust-lang.github.io/rust-bindgen/faq.html 1621[fuzzing]: https://github.com/rust-lang/rust-bindgen/blob/main/csmith-fuzzing/README.md 1622 1623[#938]: https://github.com/rust-lang/rust-bindgen/issues/938 1624[#888]: https://github.com/rust-lang/rust-bindgen/issues/888 1625[#944]: https://github.com/rust-lang/rust-bindgen/issues/944 1626[#942]: https://github.com/rust-lang/rust-bindgen/issues/942 1627[#947]: https://github.com/rust-lang/rust-bindgen/issues/947 1628[#953]: https://github.com/rust-lang/rust-bindgen/issues/953 1629[#948]: https://github.com/rust-lang/rust-bindgen/issues/948 1630[#925]: https://github.com/rust-lang/rust-bindgen/issues/925 1631[#758]: https://github.com/rust-lang/rust-bindgen/issues/758 1632[#988]: https://github.com/rust-lang/rust-bindgen/issues/988 1633[#987]: https://github.com/rust-lang/rust-bindgen/issues/987 1634[#985]: https://github.com/rust-lang/rust-bindgen/issues/985 1635[#989]: https://github.com/rust-lang/rust-bindgen/issues/989 1636[#1000]: https://github.com/rust-lang/rust-bindgen/issues/1000 1637[#882]: https://github.com/rust-lang/rust-bindgen/issues/882 1638[#884]: https://github.com/rust-lang/rust-bindgen/issues/884 1639[#996]: https://github.com/rust-lang/rust-bindgen/issues/996 1640[#982]: https://github.com/rust-lang/rust-bindgen/issues/982 1641[#1008]: https://github.com/rust-lang/rust-bindgen/issues/1008 1642[#1022]: https://github.com/rust-lang/rust-bindgen/issues/1022 1643[#1048]: https://github.com/rust-lang/rust-bindgen/issues/1048 1644[#1012]: https://github.com/rust-lang/rust-bindgen/issues/1012 1645[#744]: https://github.com/rust-lang/rust-bindgen/issues/744 1646[#1065]: https://github.com/rust-lang/rust-bindgen/issues/1065 1647[#1040]: https://github.com/rust-lang/rust-bindgen/issues/1040 1648[#1029]: https://github.com/rust-lang/rust-bindgen/issues/1029 1649[#1094]: https://github.com/rust-lang/rust-bindgen/issues/1094 1650[#1099]: https://github.com/rust-lang/rust-bindgen/issues/1099 1651[#1105]: https://github.com/rust-lang/rust-bindgen/issues/1105 1652 1653-------------------------------------------------------------------------------- 1654 1655# 0.30.0 1656 1657Released 2017/08/28 1658 1659## Added 1660 1661* Explicit control over choosing which Rust version (specific stable versions or 1662 nightly Rust) to target. This defaults to the latest stable Rust 1663 version. [#832][] 1664 1665```rust 1666bindgen::Builder::default() 1667 .rust_target(bindgen::RustTarget::Stable_1_19) 1668 // or `.rust_target(bindgen::RustTarget::Nightly)` to use unstable features 1669``` 1670 1671or 1672 1673``` 1674$ bindgen --rust-target 1.19 1675# or `--rust-target nightly` to use unstable features 1676``` 1677 1678* Started adding `derive(Copy)` for large arrays of `Copy` things, even when the 1679 array is too large to `derive(Clone)` because Rust doesn't implement `Clone` 1680 for arrays of length greater than 32. [#874][] 1681 1682* `bindgen` can now determine which types are hashable and add `derive(Hash)` to 1683 those types that support it. This is disabled by default, but can be enabled 1684 via `bindgen::Builder::derive_hash` or `--with-derive-hash`. [#876][] 1685 1686* `bindgen` can now generate `impl Debug for Blah` trait implementations for 1687 types that contain non-`Debug` types, and therefore cannot 1688 `derive(Debug)`. This behavior can be enabled with 1689 `bindgen::Builder::impl_debug` and `--impl-debug`. [#875][] 1690 1691* `bindgen` can now invoke `rustfmt` on the generated bindings. The bindings 1692 have historically been fairly pretty printed, but sometimes this is not the 1693 case, especially with the new `impl Debug for Blah` feature. Have `bindgen` 1694 run `rustfmt` with `bindgen::Builder::rustfmt_bindings` and 1695 `--rustfmt-bindings`, and use non-default `rustfmt` configuration files with 1696 `bindgen::Builder::rustfmt_configuration_file` and 1697 `--rustfmt-configuration-file`. [#900][] 1698 1699* `bindgen` can now determine which types can be compared with `==` and add 1700 `derive(PartialEq)` to those types that support it. This is disabled by 1701 default, but can be enabled via `bindgen::Builder::derive_partialeq` or 1702 `--with-derive-partialeq`. [#878][] 1703 1704* Additionally, `bindgen` can also add `derive(Eq)` to those types which we 1705 determined we could `derive(PartialEq)` and do not transitively contain any 1706 floats. Enable this behavior with `bindgen::Builder::derive_eq` or 1707 `--with-derive-eq`. [#880][] 1708 1709## Changed 1710 1711* Started emitting Rust `union`s when targeting stable Rust >= 1.19, not just 1712 unstable nightly Rust. [#832][] 1713 1714* Emitted layout `#[test]`s no longer contain internal IDs for template 1715 instantiations including pointers and arrays. This should make generated 1716 bindings more stable across updates to unrelated parts of the input 1717 headers. [#871][] 1718 1719* Determining whether a type can derive `Copy` or not was ported from an ad-hoc 1720 algorithm to our fix-point framework. [#766][] 1721 1722* Determining whether a type has a destructor or not was also ported from an 1723 ad-hoc algorithm to our fix-point framework. [#927][] 1724 1725## Deprecated 1726 1727* `bindgen::Builder::unstable_rust`/`--unstable-rust` is deprecated, in favor of 1728 targeting explicit Rust versions with 1729 `bindgen::Builder::rust_target`/`--rust-target` instead. [#832][] 1730 1731## Fixed 1732 1733* Fixed a regression in the `derive(Default)` analysis that resulted in some 1734 opaque types deriving `Default` when they shouldn't have. [#889][] 1735 1736* Fixed a regression where template instantiation layout `#[test]`s were being 1737 generated with invalid Rust identifiers. [#906][] 1738 1739[#832]: https://github.com/rust-lang/rust-bindgen/issues/832 1740[#871]: https://github.com/rust-lang/rust-bindgen/issues/871 1741[#874]: https://github.com/rust-lang/rust-bindgen/pull/874 1742[#889]: https://github.com/rust-lang/rust-bindgen/pull/874 1743[#766]: https://github.com/rust-lang/rust-bindgen/issues/766 1744[#876]: https://github.com/rust-lang/rust-bindgen/issues/876 1745[#875]: https://github.com/rust-lang/rust-bindgen/issues/875 1746[#906]: https://github.com/rust-lang/rust-bindgen/pull/906 1747[#900]: https://github.com/rust-lang/rust-bindgen/issues/900 1748[#878]: https://github.com/rust-lang/rust-bindgen/issues/878 1749[#880]: https://github.com/rust-lang/rust-bindgen/issues/880 1750[#927]: https://github.com/rust-lang/rust-bindgen/issues/927 1751 1752-------------------------------------------------------------------------------- 1753 1754# 0.29.0 1755 1756Released 2017/07/31 1757 1758## Added 1759 1760* ["Constified enum modules"](https://github.com/rust-lang/rust-bindgen/pull/741) 1761 translating C/C++ `enum`s into constants within a module for namespacing, 1762 rather than mangling the name of the generated constants. 1763 1764 For example, it turns this: 1765 1766 ```c++ 1767 // bindgen-flags: --constified-enum-module PetKind 1768 1769 enum PetKind { 1770 Doggo, 1771 Kitty, 1772 Hamster 1773 }; 1774 1775 struct Pet { 1776 PetKind kind; 1777 char* noise; 1778 }; 1779 ``` 1780 1781 Into this: 1782 1783 ```rust 1784 /* automatically generated by rust-bindgen */ 1785 1786 pub mod PetKind { 1787 pub type Type = ::std::os::raw::c_uint; 1788 pub const Doggo: Type = 0; 1789 pub const Kitty: Type = 1; 1790 pub const Hamster: Type = 2; 1791 } 1792 #[repr(C)] 1793 #[derive(Debug, Copy)] 1794 pub struct Pet { 1795 pub kind: PetKind::Type, 1796 pub noise: *mut ::std::os::raw::c_char, 1797 } 1798 ``` 1799 1800 The default translation strategy for `enum`s will generate constants with 1801 names like `PetKind_Hamster` instead. 1802 1803 Use `bindgen::Builder::constified_enum_module` or `--constified-enum-module`. 1804 1805* You can now 1806 [mark particular template instantiations as "opaque"](https://github.com/rust-lang/rust-bindgen/pull/773), 1807 so that `bindgen` emits a blob of bytes with the correct size and alignment 1808 rather than creating generic Rust types. This is useful as a workaround for 1809 when a template has a specialization for the given type arguments, which 1810 `bindgen` does not yet support. Previously, it was all of a templates' 1811 instantiations would be opaque or none of them would be. Use 1812 `bindgen::Builder::opaque_type("SomeTemplate<Foo, Bar>")` or `--opaque-type 1813 "SomeTemplate<Foo, Bar>"`. 1814 1815* Added the ability to 1816 [preprocess and dump](https://github.com/rust-lang/rust-bindgen/pull/812) 1817 the input headers given to `bindgen` to a file. This should make creating 1818 reproducible, system independent, standalone test cases much easier! Bring on 1819 the new issues! Use `bindgen::Builder::dump_preprocessed_input` or 1820 `--dump-preprocessed-input`. 1821 1822* We now use a fix-point analysis to determine whether any given type can derive 1823 `Debug`, or whether it has an explicit virtual table pointer. Previously we 1824 were using an ad-hoc algorithm that had at various times suffered from things 1825 like going into infinite loops when coming across cycles. Hopefully those 1826 kinds of bugs are a thing of the past! 1827 [#767](https://github.com/rust-lang/rust-bindgen/issues/767) 1828 [#765](https://github.com/rust-lang/rust-bindgen/issues/765) 1829 1830## Changed 1831 1832* The `bindgen` repository has moved under the `rust-lang-nursery` umbrella! The 1833 new repository URL is https://github.com/rust-lang-nursery/rust-bindgen 1834 1835## Fixed 1836 1837* No longer generating layout tests for template instantiations using type 1838 arguments that we didn't generate bindings for (which then caused compilation 1839 errors). [#679](https://github.com/rust-lang/rust-bindgen/issues/769) 1840 1841* Fixed function name mangling when cross compiling bindings for 1842 iOS. [#776](https://github.com/rust-lang/rust-bindgen/pull/776) 1843 1844* Don't include parent `inline namespace`s' names in types' names. Names of 1845 types from some STLs were showing up like `std___cxx11_basic_string` when they 1846 should have been 1847 `std_basic_string`. [#789](https://github.com/rust-lang/rust-bindgen/issues/789) 1848 1849* Fixed a bug where we wouldn't generate type definitions for some types 1850 referenced by an opaque type's methods, causing compilation 1851 errors. [#807](https://github.com/rust-lang/rust-bindgen/issues/807) 1852 1853* Fixed function name mangling issues for win32 1854 targets. [#819](https://github.com/rust-lang/rust-bindgen/issues/819) 1855 1856* Fixed a bug where `bindgen` was generating a generic type alias that didn't 1857 use its type parameter, which is illegal Rust code and caused compilation 1858 errors. [#820](https://github.com/rust-lang/rust-bindgen/issues/820) 1859 1860* The generated size, alignment, and field offset unit tests now have stable 1861 names rather than sometimes including an internal identifier which is 1862 inherently unstable. This was causing unnecessary diffs when folks were 1863 checking in new versions of bindings into their VCS. 1864 [#394](https://github.com/rust-lang/rust-bindgen/issues/394) 1865 1866* Fixed a bug where we would try and `derive(Debug, Default)` on structs that 1867 had padding like `[u8; 33]`, which is larger than the largest array length for 1868 which Rust will derive traits. This would cause compilation errors when 1869 compiling the emitted bindings. 1870 [#648](https://github.com/rust-lang/rust-bindgen/issues/648) 1871