summaryrefslogtreecommitdiff
path: root/bindgen
AgeCommit message (Collapse)Author
2022-11-10Handle the `const struct *` and `struct *` patterns (#2304)Christian Poveda Ruiz
Given that C keeps a different namespace for `struct`/`enum`/`union` and `typedef` aliases. The following patterns ```c typedef const struct foo { void *inner; } *foo; typedef struct bar { void *inner; } *bar; ``` are valid C code and produces both a `struct` and a pointer called `foo` and `bar` in different namespaces. Given that Rust does not make this distinction, we add the `_ptr` prefix to the pointer type aliases to avoid any name collisions.
2022-11-09Fix inline function identificationkohanis
2022-11-09ir: Don't crash with built-in unexposed types from libclang.Emilio Cobos Álvarez
This fixes #2325. The issue is that `__bf16` is not exposed at all by libclang, which causes us to crash. It's a bit of a shame libclang doesn't expose it but there's no rust equivalent I think, so this should be ok for now. Unfortunately no test because the header crashes older clang versions.
2022-11-04Wrap `unsafe` function's bodies in `unsafe` blocks (#2266)Christian Poveda Ruiz
This guarantees that bindings generated by `bindgen` compile even if the `unsafe_op_in_unsafe_fn` lint is denied.
2022-11-04Clean the implementation of `Default` for `BindgenOptions` (#2332)Christian Poveda Ruiz
* Clean the implementation of `Default` for `BindgenOptions`
2022-11-04Add support for the `"C-unwind"` ABI (#2334)Christian Poveda Ruiz
* Add support for the `"C-unwind"` ABI This allows using `"C-unwind"` as an ABI override if the rust target is nightly.
2022-11-02Add the `--override-abi` option (#2329)Christian Poveda Ruiz
* Add the `--override-abi` option. This option can be used from the CLI with the <abi>:<regex> syntax and it overrides the ABI of a function if it matches <regex>. Fixes #2257
2022-11-02Allow callback composition (#2330)Christian Poveda Ruiz
* Allow callback composition Store all the callbacks added to the builder in a `Vec` so bindgen invokes each one of them in a last-to-first manner.
2022-11-02Fix clippy warnings (#2331)Christian Poveda Ruiz
2022-11-01Add a mechanism to rerun bindgen with the same user options (#2292)Christian Poveda Ruiz
* Run `Bindings::generate` again if required. This adds a mechanism so `bindgen` is able to run `Bindings::generate` multiple times with the same user input if the `generate_static_inline` option is enabled and `GenerateResult::ShouldRestart` is returned by `Bindings::generate`. This is done to eventually solve #1090 which would require to check for any static inline functions and generate a new header file to be used as an extra input and run `Bindings::generate` again.
2022-10-24Sanitize RegexSet input so alternation is properly handled (#1756)Adam Gausmann
* tests: Avoid using globs as regexes * Sanitize regex set input to properly handle alternation * Add test case for alternates/anchors interaction * emit warning if wildcard pattern is used * update changelog and bump versions Co-authored-by: Darren Kulp <darren@kulp.ch> Co-authored-by: Christian Poveda <christian.poveda@ferrous-systems.com>
2022-10-22Remove Travis-CI badgesDarren Kulp
Travis-CI was fully removed as of faf8b3edbaeb591315fc6f370c1228b8caf9860f. The only badge now [mentioned in the Cargo book][1] is `maintenance`. The `travis-ci` badge reference was [removed from Cargo two years ago][2]. The Cargo book advises putting badges in README.md instead. [1]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section [2]: https://github.com/rust-lang/cargo/commit/60779a006f98fba1680182c174134363d08e0a9b
2022-10-22clang: Detect anonymous items explicitly, rather than relying on empty names.Emilio Cobos Álvarez
In Clang 16, anonymous items may return names like `(anonymous union at ..)` rather than empty names. The right way to detect them is using clang_Cursor_isAnonymous. Fixes #2312 Closes #2316 Co-Authored-by: Patrick Walton <pcwalton@fb.com>
2022-10-22Use panic hooks instead of using `catch_unwind`Christian Poveda
One of the advantages of doing this is that `ParseCallbacks` no longer needs to implement `UnwindSafe` which means that users can rely on `RefCell` and `Cell` to extract information from the callbacks. Users relying on `catch_unwind` can still achieve similar behavior using `std::thread::spawn`. Fixes #2147.
2022-10-16Specify readme properly.Emilio Cobos Álvarez
2022-10-16v0.61.0Emilio Cobos Álvarez
2022-10-16ci: clippy fixes.Emilio Cobos Álvarez
The allowed casts are because c_longlong etc aren't guaranteed to map to i64 / etc. I believe c_double maps to f64 in all platforms tho.
2022-10-16Remove no-longer-correct include entry in Cargo.toml.Emilio Cobos Álvarez
2022-10-16Move the csmith-fuzzing directory to the top level.Emilio Cobos Álvarez
2022-10-16Handle incomplete external array constantsChristian Poveda
This adds a new special case for constants like: ```c extern const char some_static_string[]; ``` so `bindgen` emits a `static` instead of a `static mut` for them.
2022-10-12Merge pull request #2302 from ferrous-systems/clonable-builderChristian Poveda
Implement `Clone` for `Builder`
2022-10-10Merge pull request #2299 from ferrous-systems/more-robust-postprocessingChristian Poveda
Make postprocessing more robust
2022-10-07Implement `Clone` for `Builder`Christian Poveda
This is done by moving all the remaining `Builder` state into `BindgenOptions` so any internal logic that affects `Builder` state only runs once the builder is consumed by `Builder::generate`: - move `input_headers` to `BindgenOptions`. - move `input_header_contents` to `BindgenOptions`. - derive `Clone` for `Builder`.
2022-10-06Make postprocessing more robustChristian Poveda
This is done by merging extern blocks and sorting items in every module instead of just in the root module. The tests were changed to use `cxx` namespaces so they effectively check that items are manipulated correctly in every single module.
2022-10-06Merge branch 'master' into generated_name_overrideJustin Smith
2022-10-05context: Fix tokenization of C++20 inline namespace. (#2294)Emilio Cobos Álvarez
Fixes #2293
2022-10-04split the repo into a workspaceChristian Poveda
remove `clap` dependency :tada: update the book installation instructions
2017-01-23Unify under the `bindgen` name.Emilio Cobos Álvarez
2017-01-16Update env_logger.Ms2ger
2017-01-11ir: Handle inline namespaces.Emilio Cobos Álvarez
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2016-12-29Replace all non-fatal `error!`s with `warn!`sTetsuharu OHZEKI
2016-12-23libbindgen: run `cargo fmt`.Emilio Cobos Álvarez
2016-12-16Fix an unused_mut warningXidorn Quan
2016-12-14Use a dynamically loaded clang to do as much as we can with old clang ↵Emilio Cobos Álvarez
versions, and experiment with new ones. It's a pity that we don't support clang 3.7 and similar for generating C bindings, when it should be straight-forward. This should allow us to support older clang versions, and also experiment with pre-release clang APIs if needed. This depends on: https://github.com/KyleMayes/clang-sys/pull/44
2016-12-11lib: Do the path fixup inside the library, so users of the library don't ↵Emilio Cobos Álvarez
have to do this themselves.
2016-12-09Use a shared workspace for bindgen, libbindgen, and test_expectationsNick Fitzgerald