summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-01-27Support str as input to Builder::no_* functionsRyan Osial
Previously, only String was supported on these while other functions in Builder worked with both str and String
2018-01-26lib: Add a way to override rustfmt path.Emilio Cobos Álvarez
I'll need it to format some stuff on mozilla-central.
2018-01-23Bump quote to 0.4Bastien Orivel
2018-01-22codegen: Try to reasonably handle enum : bool.Emilio Cobos Álvarez
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
2018-01-19Auto merge of #1228 - emilio:repr-c-enums, r=fitzgenbors-servo
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
2018-01-19codegen: Don't generate repr(C) for enums.Emilio Cobos Álvarez
That's only undefined for enums with fields. Fixes #1224 See also: https://botbot.me/mozilla/rustc/2018-01-19/?msg=95934948&page=2
2018-01-19ir: Handle _Complex _Float128 correctly.cris-b
Unfortunately we can't test it for the same alignment issues that "long double" has. Fixes #1087
2018-01-16ir: Give more info for the non-floating type complex type message.Emilio Cobos Álvarez
2018-01-09Make CARGO_PKG_VERSION option_env!, rather than env!Alex McArther
2018-01-06codegen: Be consistent about variadic signatures.Emilio Cobos Álvarez
Fixes #1216.
2018-01-05Correct type for --whitelist-type docKornel
2018-01-02Auto merge of #1189 - nox:is-dir, r=fitzgenbors-servo
Use Metadata::is_dir
2018-01-01Revert to only calling plain rustfmtKobata
2017-12-29Don't generate symbols for pure virtual functions.Emilio Cobos Álvarez
Fixes #1197.
2017-12-14Auto merge of #1183 - fitzgen:repr-c-on-enums, r=emiliobors-servo
repr(C) on enums r? @pepyakin or @emilio
2017-12-12Always add `repr(C)` to rustified enumsNick Fitzgerald
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.
2017-12-11Use Metadata::is_dirAnthony Ramine
2017-12-09Fix command_line_flags mis-generation of rust-target's flags.Manas Karekar
Expand tests for testing the rust-target flag generated by builder.
2017-12-03Move tokens method from TranslationUnit to CursorAnthony Ramine
This makes it easier to call it without passing around a TranslationUnit, which will prove itself useful to parse `__attribute__` nodes.
2017-11-27Properly handle namespaces for enum configuration optionsTamir Duberstein
...by using canonical_path rather than canonical_name. Fixes #1125.
2017-11-23Auto merge of #1158 - glyn:large-bitfield-units, r=emiliobors-servo
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
2017-11-21Support bitfield allocation units larger than 64 bitsNick Fitzgerald
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.
2017-11-18Generate ptr::null rather than zero literalTamir Duberstein
2017-11-13Avoid bitfield getters and setters accessing memory beyond "self"Glyn Normington
This fixes https://github.com/rust-lang-nursery/rust-bindgen/issues/954.
2017-11-10Remove unnecessary flag from rustfmt invocationroblabla
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.
2017-11-10Don't unwrap header metadataseemyvest
2017-11-03Make bitfield unit allocation fallibleNick Fitzgerald
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
2017-11-02Detect `#pragma pack(...)` and make `pack(n)` where `n > 1` opaqueNick Fitzgerald
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.
2017-11-01"Alignment of field" -> "Offset of field"Nick Fitzgerald
It isn't checking alignment at all; it's checking offsets.
2017-11-01Avoid divide-by-zero when checking if a field will merge with bitfieldsNick Fitzgerald
2017-10-31Unnamed bit-fields should not affect alignmentNick Fitzgerald
According to the x86[-64] ABI spec: "Unnamed bit-fields’ types do not affect the alignment of a structure or union". This makes sense: such bit-fields are only used for padding, and we can't perform an un-aligned read of something we can't read because we can't even name it. Fixes #1076
2017-10-31Remove unused assignmentNick Fitzgerald
2017-10-31ir: We can't guarantee the type to be in the item map while propagating ↵Emilio Cobos Álvarez
AlreadyResolved. The item may come from a recursive check down the stack, and as we say there: > Unchecked because we haven't finished this type yet. Fixes #1127
2017-10-30Auto merge of #1119 - pepyakin:derive-partialeq-partialord-refactoring, r=emiliobors-servo
Simple refactoring of derive_partialeq_or_partialord Just simple refactoring with some tricks from https://github.com/rust-lang-nursery/rust-bindgen/pull/1102 r? @fitzgen
2017-10-30Refactor derive_partialeq_or_partialord.Sergey Pepyakin
2017-10-30ir: Don't eagerly-resolve template alias declarations.Emilio Cobos Álvarez
Fixes #1118
2017-10-30Need mangle name of fields in struct for impl debugZhiting Zhu
2017-10-29Rename derive_partialeq_or_partialordSergey Pepyakin
2017-10-28Auto merge of #1114 - emilio:template-params-ref, r=pepyakinbors-servo
ir: References have no implicit template parameters. Fixes #1113.
2017-10-28ir: References have no implicit template parameters.Emilio Cobos Álvarez
Fixes #1113.
2017-10-28lib: Always generate bindings.Emilio Cobos Álvarez
Some cases in spawning rustfmt were not properly returning the source. Make it more reliable. This hit me when trying to update bindgen in Firefox.
2017-10-27lib: rustfmt output to stdoutManas Karekar
Simplify the rustfmt and write mechanism. Use rustfmt generated string to allow writing to stdout or to rustfmt a file.
2017-10-26give better variable nameTaylor Foxhall
2017-10-27Add --no-hash <regex> flagseemyvest
2017-10-26Auto merge of #1099 - hallfox:no-copy, r=fitzgenbors-servo
Resolve #962 - implement --no-copy with tests Allows types to not have the copy trait automatically derived.
2017-10-25delete empty lines, update book with no_copy usageTaylor Foxhall
2017-10-25Compute sizedness with a fixed-point analysisNick Fitzgerald
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
2017-10-24Resolve #962 - implement --no-copy with testsTaylor Foxhall
generated bindings from test headers
2017-10-24Auto merge of #1085 - pepyakin:builtin-clone-impls, r=fitzgenbors-servo
Derive `Clone` along with `Copy` on Rust 1.21 Fixes #934 r? @fitzgen or @emilio
2017-10-24Auto merge of #1095 - emilio:nits, r=pepyakinbors-servo
ir: Cleanup a bunch of constructors Should be no change in behavior.