Age | Commit message (Collapse) | Author |
|
This is very unsafe, and not even needed for the current code.
Fixes #190
|
|
The `Copy` trait requires that the implementor is also `Clone`. Currently,
generated types have a `#[derive(Copy)]` but are missing the `Clone`
implementation.
With this patch, bindgen now adds a `Clone` implementation to each generated
struct/enum. Clone is implemented as a copy because the generated types already
have a `#[derive(Copy)]`
Sample output:
```
#[repr(C)]
#[derive(Copy)]
pub struct Struct_termios {
pub c_iflag: tcflag_t,
pub c_oflag: tcflag_t,
pub c_cflag: tcflag_t,
pub c_lflag: tcflag_t,
pub c_line: cc_t,
pub c_cc: [cc_t; 32usize],
pub c_ispeed: speed_t,
pub c_ospeed: speed_t,
}
impl ::std::clone::Clone for Struct_termios {
fn clone(&self) -> Struct_termios { *self }
}
impl ::std::default::Default for Struct_termios {
fn default() -> Struct_termios { unsafe { ::std::mem::zeroed() } }
}
```
|
|
|
|
|
|
|
|
|
|
|
|
Fixes #184.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InternedString Deref
Feature gate
Closure type inference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clang.rs
- Remove Box<_> from the signature of Cursor.visit. This makes the
implementation a little noisier, but makes calling easier.
tests
- Updated for recent changes to rustc and std.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
can be written by hand if required.
|
|
the C90 standard. Closes #97.
|
|
gen.rs
- Structs and unions now emit an implementation of the Default trait
using std::mem::zeroed to create a zeroed instance.
tests/support.rs
- AST comparisons are now done on the pretty-printed version of the
ASTs. Differences in AttrIds and some identifiers (generated with
gensym to ensure uniqueness) made it unreliable to compare the ASTs
directly. This way should work, even if it doesn't score many points
for style.
tests/*
- Updated to use Default::default() where appropriate.
- Eliminated a few warnings.
|
|
|
|
Conflicts:
src/parser.rs
tests/forward_declared_struct.rs
tests/test_struct.rs
|
|
|
|
Fixes #79. Fixes #100.
Cargo.toml
- Adds `[[test]]` section pointing to tests.rs, where all former tests are
now imported as modules (cf Servo's tests).
gen.rs
- Breaks up `TFunc` handling into `TFuncPtr` and `TFuncProto`.
- Eliminates empty `extern "C" { }` block that was sometimes generated.
lib.rs
- Eliminates `dead_code` warnings and one about `LinkType` being able to
implement `Copy`.
parser.rs
- Breaks up function handling into `TFuncPtr` and `TFuncProto`.
- Uses the `FuncSig` type to capture information about function
signatures.
- Adds support for pointers to arrays at the global scope.
types.rs
- Adds types related to function prototype and pointer handling:
`FuncSig`, `TFuncPtr` and `TFuncProto`.
tests
- Adds quote-based testing. Using the `assert_bind_eq!` macro, it is
now possible--without too much ceremony--to test bindgen output of an
input file against inline source created with the `quote_item!` (and
other `quote_*` macros).
- Removes stringify-based testing.
- Combines test running into a single entry point, `test.rs`.
- Shortens test names where possible without losing context.
|
|
|
|
|
|
|
|
|
|
definitions.
|
|
|
|
When comparing type that has a pointer to itself, `==' may go into infinite recursion.
Comparing by reference avoids this. Since `c' and `ty_compinfo` are Rc<RefCell<..>>,
compare references to interior of RefCell.
|
|
|
|
|