Age | Commit message (Collapse) | Author |
|
If an enum matched a pattern for rustified enum and constified module
enum, then rust code would fail to compile with "ambiguous associated
type" error. We fix the error by giving constified module enum "higher
precedence".
Fixes issue #1198
|
|
ir: Allow replacing enums and enum variants.
Fixes #1267.
|
|
Use the ? operator instead of try, and add some more uses of it on Option<> that
were straight-forward.
|
|
callback.
|
|
|
|
|
|
Fixes #1258
|
|
Fix missing dylibs
|
|
This reverts commit 6899c275ee0ab0687ec66c490ddd1a76f8223513.
The `proc_macro2` crate depends on rustc internal crates, which means that
`bindgen` would need to be run under `rustup`.
We can follow https://github.com/rust-lang/rust/issues/47931 to get updates on
when this issue might be resolved and we can update `quote` again.
Fixes #1248
|
|
Also, perform `clang` parameter check earlier. If that results in `is_cpp == true`, the later `|=` operations could be elided.
|
|
Update log to 0.4 and bump version
|
|
|
|
|
|
Fixes #1185
|
|
callbacks: Introduce MacroParsingBehavior to allow ignoring macros.
This is symmetric, yet less powerful, than enum_variant_behavior.
Fixes #687.
|
|
This is symmetric, yet less powerful, than enum_variant_behavior.
Fixes #687.
|
|
codegen: Make forward declarations go through the more generic path.
Instead of special-casing.
This allows to use the normal flags to control what can be or not derived for
them.
Arguably deriving Copy / Clone is kind of busted for those, but changing this by
default broke tests (RefPtr<ForwardDeclaredType> stopped working for example).
So I think this is a good compromise.
Fixes #1238
|
|
ir: Choose the right mangling for destructors on all codepaths.
Fixes #1133.
|
|
Instead of special-casing.
This allows to use the normal flags to control what can be or not derived for
them.
Arguably deriving Copy / Clone is kind of busted for those, but changing this by
default broke tests (RefPtr<ForwardDeclaredType> stopped working for example).
So I think this is a good compromise.
Fixes #1238
|
|
Fixes #1133.
|
|
By looking through typedefs, we also catch more complex cases like the ones that
appear on Android's stdlib.
Fixes #946
|
|
Previously, only String was supported on these while other
functions in Builder worked with both str and String
|
|
I'll need it to format some stuff on mozilla-central.
|
|
|
|
Just use the repr name we generate, since we generate constants for that.
It's not worth trying to guess the actual type to use IMO.
Bindings lose a bit of portability I guess, but that's really a lost bet
already, so instead of special-casing bool and map constants, let's use a
consistent representation everywhere.
Fixes #1145
|
|
codegen: Don't generate repr(C) for enums.
That's only undefined for enums with fields.
Fixes #1224
See also: https://botbot.me/mozilla/rustc/2018-01-19/?msg=95934948&page=2
|
|
That's only undefined for enums with fields.
Fixes #1224
See also: https://botbot.me/mozilla/rustc/2018-01-19/?msg=95934948&page=2
|
|
Unfortunately we can't test it for the same alignment issues that "long double"
has.
Fixes #1087
|
|
|
|
|
|
Fixes #1216.
|
|
|
|
Use Metadata::is_dir
|
|
|
|
Fixes #1197.
|
|
repr(C) on enums
r? @pepyakin or @emilio
|
|
If we don't, then eddyb's recent layout optimizations will do unexpected things
to them.
We also need to handle empty `enum`s without variants. When `repr(C)` is on a
Rust `enum`, it cannot be empty, so we need to add a dummy.
|
|
|
|
Expand tests for testing the rust-target flag generated by builder.
|
|
This makes it easier to call it without passing around a TranslationUnit,
which will prove itself useful to parse `__attribute__` nodes.
|
|
...by using canonical_path rather than canonical_name.
Fixes #1125.
|
|
Support bitfield allocation units larger than 64 bits
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.
It is assumed that the alignment of the `Storage` type is no larger than the
alignment of the `Align` type, which will be true if the `Storage` type is, for
example, an array of `u8`. This assumption is checked in a debug assertion.
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.
r? @emilio
|
|
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.
|
|
|
|
This fixes https://github.com/rust-lang-nursery/rust-bindgen/issues/954.
|
|
From rustfmt docs, the --write-mode flag is unecessary when passing the
flag to stdin. If we leave it there, rustfmt-nightly complains that it
cannot find the file named --write-mode, so let's remove the flag.
|
|
|
|
Instead of panicking when we see a bitfield that does not have a layout, return
an error up the stack. If we get an error when allocating bitfields into units,
then make the whole struct opaque.
Fixes #1140
|
|
This is a bandaid for #537. It does *not* fix the underlying issue, which
requires `#[repr(packed = "N")]` support in Rust. However, it does make sure
that we don't generate type definitions with the wrong layout, or fail our
generated layout tests.
|
|
It isn't checking alignment at all; it's checking offsets.
|