1092 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez 798cfab52b v0.23.0 2022-04-21 18:48:00 +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
Mike Hommey a0ab62469a Update syn dependency to at least 1.0.88
While the Cargo.lock has 1.0.89, the current minimal version in Cargo.toml
is 1.0.3, which cannot parse modern Rust code. This leads to some
downstreams (*cough* Debian) inadvertently building cbindgen against
older versions of syn and the resulting cbindgen, even if it is the last
version, not being able to parse recent Rust code.

Bumping the version in Cargo.toml alleviates this to some extent. A
quick scan of the syn logs suggests 1.0.88 is the last version where
parsing support relevant to stable Rust syntax was added.
2022-04-21 13:13:40 +02:00
Stovent 8cfd4570cc Fix #753 2022-04-21 13:03:21 +02:00
Emilio Cobos Álvarez 8604b2c0b7 v0.22.0 2022-04-19 11:29:52 +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 aeb81934d1 Avoid generating and writing bindings when called recursively
from a build script.
2022-03-31 21:59:54 +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
Emilio Cobos Álvarez 522759e92b Update various dependencies.
Closes #743
2022-03-27 17:37:09 +02:00
Emilio Cobos Álvarez b3de1dc4b4 v0.21.0
* Update MSRV to 1.54.0
      * Update clap to 3.1.
      * Update heck to 0.4.0
      * unraw identifiers
      * Honor documentation_length in Cython.
      * Add documentation_style to with short and full options
      * Map RawFd to Int
      * Respect remove_underscores config when prefixing name to enum
2022-03-25 18:52:23 +01:00
messense d4e508d6d1 Update MSRV to 1.54.0
Closes #740
2022-03-25 18:49:21 +01:00
messense 2f1202e8c5 Update clap to 3.1 2022-03-25 18:49:17 +01:00
messense 293fcc53ff Update heck to 0.4.0 2022-03-25 18:47:33 +01:00
Emilio Cobos Álvarez 88d4b99774 Remove etesync from readme.
Closes #739
2022-03-25 18:42:36 +01:00
Chris Cleveland b94318a8b7 Update docs.md 2022-01-09 05:12:50 +01:00
Emilio Cobos Álvarez fc4ab1ca55 Remove wgpu-native from users.
Closes #725
2021-12-25 18:56:43 +01:00
Emilio Cobos Álvarez c407b7da90 Address clippy lint. 2021-12-14 16:19:21 +01: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 11228f6b6f Silence some dead_code warnings. 2021-11-02 11:34:12 +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
Marc-André Lureau 24c130bd9c Map RawFd to Int
On all Unix systems, RawFd is defined as c_int.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-11-02 11:09:22 +01:00
Emilio Cobos Álvarez 577b041933 tests: Add a test for #708 2021-08-24 11:44:51 +02:00
Adam Wilson cbd4260bdc Respect remove_underscores config when prefixing name to enum
Fixes #705
Closes #708
2021-08-24 11:44:30 +02:00
Emilio Cobos Álvarez 41506d5aeb v0.20.0
* Add Builder::with_using_namespaces (#688).
 * Ignore PhantomPinned (#695).
 * Simplify Pin<T> to T (#697).
 * Update --pretty=expanded to -Zunpretty=expanded (#706).
2021-07-29 14:29:15 +02:00
Jan-Erik Rediger 34299aef56 Don't use check profile when expanding code on a release build 2021-07-28 11:52:29 +02:00
Jan-Erik Rediger 6c96c8ab95 Update --pretty=expanded to -Zunpretty=expanded
`--pretty` is gone as of https://github.com/rust-lang/rust/pull/83491
2021-07-28 11:52:29 +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
Joel Dice ccd1f0e9ec add Builder::with_using_namespaces 2021-06-19 10:52:01 +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 2d20c4b151 Move the target-guessing code from #676 to its own function.
Seems nicer.
2021-04-12 17:22:12 +02:00
Jon Gjengset 93c06c5c9d Only fetch dependencies for current platform by default (#676)
cbindgen invokes `cargo metadata` to find the sources of dependencies so
that it can generate bindings for types that originate in those
dependencies. However, `cargo metadata` defaults to fetching
dependencies for _all_ platforms unless it is specifically invoked with
the `--filter-platforms` argument.

This PR makes cbindgen pass that argument to `cargo metadata` using the
host platform, which will significantly reduce the time of the first
call in cases where the dependency tree includes many target-specific
dependencies.

Fixes #675.
2021-04-12 17:13:09 +02:00
Emilio Cobos Álvarez d9e490ce8b v0.19.0
* Simplify types in generics (#663)
 * Use --profile=check for macro expansion (#671)
 * Use exported name to prefix enum variants (#672)
 * Fix path attribute handling in inline submodules (#679)
 * Fix a stack overflow with some recursive typedefs (#680)
2021-04-08 18:18:10 +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
Jon Gjengset 54dfcf89e4 Fix new clippy lint clippy::wrong-self-convention
This should be backwards-compatible in practice since `IdentifierType`
is `Copy`. In theory it's not though, as someone _might_ be passing that
function by name to something that requires that exact signature.
2021-04-06 21:51:15 +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
Marc-André Lureau 5a79d762a5 bindgen: use exported name for enum prefix
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-03-29 14:08:02 +02:00
Emilio Cobos Álvarez 93eed3aaf3 union: Fix clippy lint. 2021-03-22 12:30:25 +01:00
Cormac Relf 2b1907bba4 use --profile=check for macro expansion, fixes #457 2021-03-22 12:26:52 +01:00
Emilio Cobos Álvarez aaef260faf ir: Simplify types in generics.
This was an oversight in 1903686f9e
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 a0dc1a1fcb v0.18.0
* Simplify types in nested types such as pointed-to types and function
   signatures (#661).
2021-02-26 20:09:24 +01:00
Emilio Cobos Álvarez 1903686f9e ty: simplify nested types before trying to simplify ourselves.
I don't think this changes behavior right now but it is conceptually the
right thing to do.
2021-02-26 20:06:43 +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