summaryrefslogtreecommitdiff
path: root/bindgen-integration
AgeCommit message (Collapse)Author
2023-02-07Generate extern wrappers for inlined functions (#2335)Christian Poveda Ruiz
* Generate extern wrappers for inlined functions If bindgen finds an inlined function and the `--generate-extern-functions` options is enabled, then: - It will generate two new source and header files with external functions that wrap the inlined functions. - Rerun `Bindings::generate` using the new header file to include these wrappers in the generated bindings. The following additional options were added: - `--extern-function-suffix=<suffix>`: Adds <suffix> to the name of each external wrapper function (`__extern` is used by default). - `--extern-functions-file-name=<name>`: Uses <name> as the file name for the header and source files (`extern` is used by default). - `--extern-function-directory=<dir>`: Creates the source and header files inside <dir> (`/tmp/bindgen` is used by default). The C code serialization is experimental and only supports a very limited set of C functions. Fixes #1090. --------- Co-authored-by: Amanjeev Sethi <aj@amanjeev.com>
2022-11-21Introduce `DeriveInfo` (#2355)Christian Poveda Ruiz
This PR introduces a new non-exhaustive `struct` called `DeriveInfo` to be used as the sole argument of `ParseCallbacks::add_derives` with the purpose of being able to extend the information passed to this method in a backwards-compatible manner, meaning that adding new fields to `DeriveInfo` won't be a breaking change when releasing a new version.
2022-10-04split the repo into a workspaceChristian Poveda
remove `clap` dependency :tada: update the book installation instructions
2022-06-05Skip input headers in Linguist statisticsDarren Kulp
[skip ci]
2022-03-15tests: Remove testing_only_libclang_4 and expectationsDarren Kulp
2022-02-18tests: Remove clang-3.9 expectationsDarren Kulp
2022-02-18Allow fully-qualified derivesJake Merdich
Adding a custom derive like "serde::Deserialize" results in a panic complaining that it is not a valid Ident. Derive params are not identifiers, so treat it as a token stream instead.
2021-12-29Remove deprecation and ReplaceMikuroXina
2021-12-29Replace generate with gen in testMikuroXina
2021-11-26allow custom derives on enumsEric Seppanen
Custom derives are just as useful on enums as they are on structs; not supporting this was an oversight. Adds a test that will fail to compile if the custom derive doesn't work on enums. This test fails without the codegen fix.
2021-07-16add test for add_derivesEric Seppanen
This test derives PartialEq for the Test struct, and then attempts to use that by calling assert_ne! on two Test instances. If the derive callback doesn't work, no PartialEq will be present and the test will fail to compile.
2021-04-24Integration test include directory paths for depfiles.Adam Perry
2021-02-18Rename whitelist -> allowlist and blacklist -> blocklistMarcel Hlopko
For the commandline arguments I added undocumented aliases to old flags, to stay backwards compatible.
2021-02-07codegen: Track union layout more accurately.Emilio Cobos Álvarez
Instead of always generating the _bindgen_union_align method (which shouldn't be needed at all for Rust structs, since the struct layout tracker already deals with adding repr(align) as necessary) make sure to visit all fields appropriately to generate the correct alignment.
2021-02-04Run tests on AArch64Corey Farwell
2021-01-30Add failing regression test for #1973.Corey Farwell
2020-12-26ci: Switch most CI to GitHub actions.Emilio Cobos Álvarez
2020-12-26tests: Remove unnecessary system header include that makes macos unhappyEmilio Cobos Álvarez
2020-12-26integration: Forward some features to bindgen.Emilio Cobos Álvarez
2020-12-20comp: Fix bitfields to allow underaligned fields after them to take padding ↵Emilio Cobos Álvarez
space. Fixes #1947. There are two separate issues here: First, the change in comp.rs ensures that we don't round up the amount of storage to the alignment of the bitfield. That generates the "expected" output in #1947 (`__BindgenBitfieldUnit<[u8; 3], u16>`). But that's still not enough to fix that test-case because __BindgenBitfieldUnit would be aligned and have padding, and Rust won't put the extra field in the padding. In order to ensure the bitfield starts at the right alignment, but that Rust can put stuff in the extra field, we need to make a breaking change and split the generated fields in two: One preceding that guarantees alignment, and the actual storage, bit-aligned. This keeps the existing behavior while fixing that test-case.
2020-09-15Add integration test for name matchingYoumu
2020-07-20Remove testing_only_libclang_3_8 and expectationsDarren Kulp
2020-06-21Introduce tests for functional macrosDarren Kulp
2020-06-15Refined test to verify type of resulting integerAlan Egerton
2020-06-15Added testsAlan Egerton
2019-10-14bindgen-integration: Reformat crate too.Emilio Cobos Álvarez
Cleanup a bit the reformatted bits while at it.
2019-10-14Add llvm 9.0 to CI.Emilio Cobos Álvarez
2019-03-04integration: Fix integration tests with rust 1.33.v0.48.0Emilio Cobos Álvarez
Alignment arrays are not needed anymore, since we have repr(align).
2018-11-30While at it, gcc -> cc in the integration tests.v0.44.0Emilio Cobos Álvarez
2018-11-30Rustfmt the bindgen-integration crate.Emilio Cobos Álvarez
2018-11-30Add a test for the interaction between blacklisting and parse callbacks.Emilio Cobos Álvarez
2018-11-26Integration tests for str_macro callbackschrysn
2018-11-10Add tests for renamed structure itemsSébastien Duquette
2018-11-10Add integration testsSébastien Duquette
2018-07-05ir: Don't assume wchar is 2 bytes.Emilio Cobos Álvarez
Fixes #1345
2018-05-03Add tests for the new option.Emilio Cobos Álvarez
2018-04-03Now that we have stuff that depends on libclang-5 we need to do this.Emilio Cobos Álvarez
2018-01-31Auto merge of #1243 - emilio:parse-callbacks, r=fitzgenbors-servo
callbacks: Introduce MacroParsingBehavior to allow ignoring macros. This is symmetric, yet less powerful, than enum_variant_behavior. Fixes #687.
2018-01-31callbacks: Introduce MacroParsingBehavior to allow ignoring macros.Emilio Cobos Álvarez
This is symmetric, yet less powerful, than enum_variant_behavior. Fixes #687.
2018-01-29ir: Choose the right mangling for destructors on all codepaths.Emilio Cobos Álvarez
Fixes #1133.
2017-12-29Don't generate symbols for pure virtual functions.Emilio Cobos Álvarez
Fixes #1197.
2017-11-21Support bitfield allocation units larger than 64 bitsNick Fitzgerald
Individual bitfields are still limited to at most 64 bits, but this restriction can be weakened when Rust supports u128. This implements issue #816. Usage notes: * Since common code is added to each generated binding, a program which uses more than one binding may need to work around the duplication by including each binding in its own module. * The values created by bitfield allocation unit constructors can be assigned directly to the corresponding struct fields with no need for transmutation. Implementation notes: __BindgenBitfieldUnit represents a bitfield allocation unit using a Storage type accessible as a slice of u8. The alignment of the unit is inherited from an Align type by virtue of the field: align: [Align; 0], The position of this field in the struct is irrelevant. The alignment of the Storage type is intended to be no larger than the alignment of the Align type, which will be true if the Storage type is, for example, an array of u8. Although the double underscore (__) prefix is reserved for implementations of C++, there are precedents for this convention elsewhere in bindgen and so the convention is adopted here too. Acknowledgement: Thanks to @fitzgen for an initial implementation of __BindgenBitfieldUnit and code to integrate it into bindgen.
2017-11-16Improve documentation of the integration testsGlyn Normington
Also: * disable rustfmt in the integration test, to avoid it causing problems, since it is not needed. * note the need to rebuild bindgen when running a single test.
2017-10-11Handle explicit align=1.Sergey Pepyakin
2017-09-11Make bindgen generate enums as constants by defaultCldfire
Also simplifies the logic that determines which enum variation gets chosen.
2017-06-19Auto merge of #763 - rigelk:757-unstable-defaults, r=emilio,fitzgenbors-servo
switch defaults from generating unstable Rust to generating stable Rust As said in the issue: - changing the Builder::no_unstable_rust method to the Builder::unstable_rust method - changing the --no-unstable-rust flag to a --unstable-rust flag in src/options.rs - changing bindgen-flags header in the test headers to remove the --no-unstable-rust flag - removing --no-unstable-rust flag in ./test/test-one.sh Fixes #757 r? @fitzgen
2017-06-19switch defaults from generating unstable Rust to generating stable RustPierre-Antoine Rault
- changing the Builder::no_unstable_rust method to the Builder::unstable_rust method - changing the --no-unstable-rust flag to a --unstable-rust flag in src/options.rs - changing bindgen-flags header in the test headers to remove the --no-unstable-rust flag Fixes #757
2017-06-18codegen: Fix bitfield getter/setters so they work with NPOT sizes.Emilio Cobos Álvarez
2017-06-05ir: Fix a bunch of bitfield correctness issues.Emilio Cobos Álvarez
In particular, the "flush the allocation unit" logic is only valid for ms_structs (that is, MSVC). It's slightly annoying to have this different behavior, but it'd work just fine if we'd turn that on for MSVC. This patch doesn't do that, yet at least, and adds tests for all the weird bitfield alignments around. Fixes #726 (and another set of hidden issues by the old code).
2017-05-25Allow asserting expectations across different libclang versionsNick Fitzgerald
Rather than having a tests that we only run if libclang >= 3.9, this makes the test suite dynamically detect when we have different expectations for different libclang versions. It does this by adding `tests/expectations/tests/libclang-$VERSION` directories, and `testing_only_libclang_$VERSION` features that are consulted when the usual expectation file does not exist. Fixes #697