Age | Commit message (Collapse) | Author |
|
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
|
|
That's only undefined for enums with fields.
Fixes #1224
See also: https://botbot.me/mozilla/rustc/2018-01-19/?msg=95934948&page=2
|
|
Fixes #1216.
|
|
Fixes #1197.
|
|
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.
|
|
...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.
|
|
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.
|
|
|
|
Fixes #1113.
|
|
This fixes a couple bugs where we weren't properly adding an `_address`
byte. It also helps pave the way for computing implicit fields (such as padding,
`_address`, vtable pointers, etc) in its own pass, before codegen.
Fixes #768
|
|
Derive `Clone` along with `Copy` on Rust 1.21
Fixes #934
r? @fitzgen or @emilio
|
|
|
|
Store function linkage in the ir
This lets us capture 'static inline' functions in the ir and filter them
later down the pipeline. This is the first step on the way to handling
these functions better.
|
|
This lets us capture 'static inline' functions in the ir and filter them
later down the pipeline. This is the first step on the way to handling
these functions better.
|
|
instead
|
|
We were not checking signed-ness and emitting the appropriate types.
Fixes #1040
|
|
Move `self` into `ir::BindgenContext::gen`
Small clean up. See each commit for details.
r? @pepyakin
|
|
`bindgen` follows a pipeline architecture, and we only ever generate bindings
once. By taking ownership of `self`, we can enforce this. We can also remove
checks inside `gen` for whether we have resolved type refs or not, since we now
know that we haven't because it is guaranteed to only be called the one time.
|
|
Its more clear what the methods/fields are returning/storing when we add "width"
to the name.
|
|
|
|
|
|
Emit hex bitfield masks
r? @fitzgen
|
|
|
|
Add support for the thiscall ABI
Fixes https://github.com/rust-lang-nursery/rust-bindgen/issues/541
The thiscall ABI is experimental, so in order to use it nightly is required and also the following statement:
`#![feature(abi_thiscall)]`
That's a problem because the `tests_expectations` crate (in the tests folder) tries to compile it (and stable is required).
|
|
|
|
|
|
Also clean a bit.
|
|
|
|
Remove derive-partialeq-template-inst test.
Add comments.
Don't implement PartialEq for incomplete arrays
Handle opaque bases and template instantiations
Extract constrain_type.
Extract `is whitelisted?` check
Add failing partialeq-anonfield
join for comps
Fix: return insert if not whitelisted
Delegate TypeRefs and alias to constrain_join.
Delegate Template instantiations to constrain_join
Add derive-partialeq-pointer.hpp test
Update comment.
Fix layout alignment larger that array limit
Add missing test for derive-partialeq-anonfield.rs
Clean
Clean
Fix typo in opaque-template-inst-member test
Remove redudant stmt
Add comment on can_supersede.
Format impl_partialeq and leave a comment
Extract requires_storage into it's own function.
Clean
|
|
|
|
And also allow ID comparison across ID types, as this makes implementing the
above much easier.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This commit makes certain `TypeKind`s that can only reference other types use
`TypeId` instead of `ItemId`.
|
|
None of the callers were passing template parameters.
|
|
|
|
This commit also makes `BindgenContext::resolve_type` take a `TypeId`, and adds
unchecked conversions everywhere that we call it. Next, I'm going to go through
the code base, replacing these unchecked conversions with checked ones, and
tightening up types as I go.
|
|
|
|
Clean.
Add timer.
Clean codegen
|
|
Impl_debug fixes
r? @fitzgen
|