299 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
61d4112374 Fix clap 4 update. 2024-02-26 17:16:12 +01:00
Mike Hommey
9b4a14958e Add support for out-of-line bitfields declarations 2023-09-12 10:28:58 +02:00
Thibaut Lorrain
85eb0f4436 Bump clippy msrv to 1.64
the msrv was bumped in in the Cargo.toml #847 but not in clippy.toml,
clippy was complaining at startup and defaulting to 1.57
2023-09-09 00:53:59 +02:00
Mike Hommey
43af1ebe6e Handle bitflags bits method calls 2023-09-09 00:53:45 +02:00
sevenc-nanashi
0fb5d07ae4
Add support for #[deprecated].
Closes #875.
Closes #860.
Closes #408.
2023-09-04 20:18:44 +02:00
Jannis Ruh
d8355da466
Support "C-unwind" ABI
Closes #864
2023-09-04 20:12:55 +02:00
Jonathan Schwender
51a981cefc Rename expectations files
Rename expectation files to contain only one dot.
This is needed for the Cython tests as of Cython 3.
The following script was used in a clean repository
to rename the files:

```sh
 ls | sed -E -n 's/(.*)\.(both|tag)?((\..*)?\.(c|cpp|pyx))/mv "\1.\2\3" "\1_\2\3"/p' | sh
```
2023-09-04 19:37:45 +02:00
Jonathan Schwender
ff888019fe Allow Warnings in Cython tests
Cython 3.0 deprecated `IF` and `DEF`. Until this is fixed
allow warnings in our `Cython` tests.
Background: https://github.com/cython/cython/issues/4310

Note the warnings will become hard errors in the future.
2023-09-04 19:37:45 +02:00
Jonathan Schwender
23f7bbcf9f Fix most Python tests with Cython 3.0
Since Cython 3.0 using dots appart from the extension is
a hard error. See issue: https://github.com/cython/cython/issues/2686
2023-09-04 19:37:45 +02:00
Marin Veršić
5f235ec199
generate bindings for non-public extern items
Signed-off-by: Marin Veršić <marin.versic101@gmail.com>
2023-08-25 11:11:16 -04:00
Ian Hobson
6165bbf021 Avoid 'duplicate package' warnings when depending on cbindgen via git
When specifying `cbindgen` as a dependency via git, several 'skipping duplicate
package' warnings pop up regarding some of the test crates.

The warning seems to be spurious given that the test packages aren't needed when
depending on `cbindgen` (see https://github.com/rust-lang/cargo/issues/10752),
but while a fix is being considered for Cargo, this commit disambiguates the
duplicated package names by referring to their relative paths.
2023-05-31 12:31:39 +02:00
Sjors Holtrop
c8546ad42d Parse ... as a VaList 2023-05-29 21:33:25 +02:00
Jonathan Schwender
25132a3690 Add --depfile option
Add an option to output a depfile for outside build-systems to learn
the source file dependencies of the bindings.
This can be used by 3rd party build system integrations to only rerun
bindgen when necessary.

Testing is done via CMake integration tests, since CMake
is a 3rd party buildsystem which supports depfiles.
2023-05-29 18:56:53 +02:00
Jonathan Schwender
cb42a00ab6 Improve cbindgen detection in tests
Since our MSRV is now Rust 1.54, we can rely on cargo setting `CARGO_BIN_EXE_cbindgen`
to the cbindgen path in integration tests.
This is more reliable than guessing the path, since cargo knows where it placed the bin.
2023-05-29 18:56:53 +02:00
Jonathan Schwender
fb1fdc8aed Fix clippy warning (1.40 -> 1.54)
The clippy.toml suppresses warnings added in newer rust versions,
so fixing the documented MSRV also shows new warnings.
2023-03-08 16:59:28 +01:00
Emilio Cobos Álvarez
66bc17facf
Add a test for function pointer text wrapping. 2022-11-10 14:23:33 +01:00
Emilio Cobos Álvarez
47b1d1de1e Handle never type in return position consistently.
Fixes #779
2022-08-30 15:47:58 +02:00
Emilio Cobos Álvarez
116a18c2fd tests: Add a test for struct constants going through typedefs. 2022-06-09 21:10:33 +02:00
Emilio Cobos Álvarez
80da6045ec
bitflags: Be explicit in binary operators and such.
This allows having explicit + default constructor without build issues.
2022-06-07 21:32:28 +02:00
Emilio Cobos Álvarez
5da3715187 constant: Add support for unary negation. 2022-06-07 18:48:48 +02:00
Emilio Cobos Álvarez
021d09db2b bitflags: Make more operations constexpr. 2022-06-07 18:48:48 +02:00
Emilio Cobos Álvarez
597b033ccf constant: Support suffixes for integers that otherwise would be narrowed. 2022-06-07 16:19:40 +02:00
Jason Orendorff
a79a10d9a6 Fix specialization of SomeType<N> when N is a const parameter.
Fixes #761.
2022-05-25 10:41:44 +02:00
Jason Orendorff
dde68cc439 Support char-like byte literals. 2022-05-25 10:40:32 +02:00
Jason Orendorff
caf69c8800 Support bool and char literals as arguments to const generics. 2022-05-25 10:40:32 +02:00
Jason Orendorff
c732069b2e New type GenericParam represents a generic parameter. 2022-05-09 16:13:39 +02:00
Emilio Cobos Álvarez
305ccfe746 constant: Make const.allow_constexpr default to true. 2022-04-21 18:48:00 +02:00
Emilio Cobos Álvarez
15e1131160 constant: Allow more constexpr constants. 2022-04-21 18:48:00 +02:00
kavoor
5b418d968c
Support rename rule for union body members.
Closes #751.
2022-04-19 11:22:04 +02:00
Emilio Cobos Álvarez
770f352375 constant: Add support for other expressions WebRender uses. 2022-04-14 23:41:07 +02:00
Emilio Cobos Álvarez
882af0b563 constant: Add support for associated constant expressions.
These are useful for bitflags.
2022-04-14 23:41:07 +02:00
Jordan Rose
20ddfffb6a Fix regression in CamelCase rename rule (should be lowerCamelCase) 2022-04-05 22:54:52 +02:00
Emilio Cobos Álvarez
09284108eb enumeration: simplify standard types in variants.
Fixes #745
2022-04-04 20:25:01 +02:00
Vadim Petrochenkov
ca7a942ce5 Cython: Omit per-variant tags in unions generated for Rust enums
The common `tag` should already be enough, al other tags are identical to it.
In Cython case they only create noise because the declarations only introduce names and do not determine layouts.
2022-03-31 21:57:16 +02:00
Olivier Goffart
ed8d94619f unraw the identifiers
Fixes https://github.com/eqrion/cbindgen/issues/410
2021-12-14 16:18:41 +01:00
Emilio Cobos Álvarez
a1694cd57c
ir: Honor documentation_length in Cython. 2021-11-02 11:31:30 +01:00
Sean McArthur
0e3f9bd9cb Add documentation_style to with short and full options 2021-11-02 11:13:49 +01:00
Emilio Cobos Álvarez
577b041933
tests: Add a test for #708 2021-08-24 11:44:51 +02:00
Emilio Cobos Álvarez
57add9c860 Fix some clippy lints. 2021-06-21 13:25:53 +02:00
Kendall Koning
63c1043dfb Simplify Pin<T> to T
cbindgen already simplifies `MaybeUninit<T>` and `ManuallyDrop<T>` to `T`. This adds `Pin<T>` as well.
2021-06-19 20:48:57 +02:00
Kendall Koning
4e394493d6
Ignore PhantomPinned
cbindgen already ignores `PhantomData`.  It should ignore
`PhantomPinned` for the same reasons.

Closes #695
Fixes #694
2021-06-19 10:35:08 +02:00
Emilio Cobos Álvarez
a9af0ad5ad ir: Tweak monomorphization to instantiate recursively after inserting to the replacements map.
That way the check to prevent double-instantiation also works to prevent
infinite recursion.
2021-04-07 13:26:35 +02:00
Emilio Cobos Álvarez
52de917d25 parser: Fix handling of #[path] attributes inside inline submodules.
As seen in hashbrown:

    #[cfg(feature = "raw")]
    /// Experimental and unsafe `RawTable` API. This module is only available if the
    /// `raw` feature is enabled.
    pub mod raw {
        // The RawTable API is still experimental and is not properly documented yet.
        #[allow(missing_docs)]
        #[path = "mod.rs"]
        mod inner;
        pub use inner::*;

        #[cfg(feature = "rayon")]
        pub mod rayon {
            pub use crate::external_trait_impls::rayon::raw::*;
        }
    }
2021-04-07 13:25:57 +02:00
Marc-André Lureau
ccea33ecb4 tests: check renaming enum affects variant prefix
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-03-29 14:08:02 +02:00
Emilio Cobos Álvarez
aaef260faf ir: Simplify types in generics.
This was an oversight in 1903686f9eb09f587885d579f3e14c990e799938
because the code I grabbed to visit the generics was dealing with them
somewhere else.
2021-03-02 20:11:39 +01:00
Emilio Cobos Álvarez
7312b997be ir: simplify_standard_types should be recursive.
Stuff like *mut Option<&mut Foo> should really be *mut *mut Foo for
example.
2021-02-24 18:36:40 +01:00
Emilio Cobos Álvarez
c5c301b08a ir: Support pointers to zsts.
Fixes #654
2021-02-01 13:56:45 +01:00
Emilio Cobos Álvarez
750745831a ir: Deal with name conflicts correctly in declaration type resolution.
So, basically, make opaque items last, and make previous names override
them.

Fixes #649
2021-01-26 12:55:05 +01:00
Emilio Cobos Álvarez
c47ee1516b ir: Handle NonZero and simplify Option<NonZero> like we simplify Option<NonNull>.
Fixes #646
2021-01-14 23:39:59 +01:00
Emilio Cobos Álvarez
f922f68531 ir: Avoid generating bogus pointer arguments.
Now that we track nullability in the pointer type it's easy to do it.

Fixes #223
2021-01-14 23:39:59 +01:00