Commit Graph

2964 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
5c821867f2 var: Avoid a bit of duplication with fit_macro_constants. 2020-12-19 19:28:24 +01:00
Antoni Simka
ea4164c85c Add option to fit macro consts into smaller types
Add a `--fit-macro-constant-types` option to make bindgen try to fit
macro integer constants into types smaller than u32/i32.
Useful especially when dealing with 8/16-bit architectures.

Closes #1945
2020-12-19 19:28:24 +01:00
Weston Carvalho
112c691291 Remove unsued mutable field logic. 2020-12-15 17:27:25 +01:00
Emilio Cobos Álvarez
caec44a0b4 dyngen: Pass null-terminated byte strings to libloading.
Fixes #1938.
2020-12-02 12:00:38 +01:00
Emilio Cobos Álvarez
460ae847d2 cli: Expose module_raw_lines to the CLI.
This makes command_line_args properly return them, instead of dropping
them on the floor.
2020-12-02 01:08:05 +01:00
Emilio Cobos Álvarez
19142ac6b3 struct_layout: Fix field offset computation for packed(n) structs.
This can cause unnecessary padding to be computed otherwise at the end
of the struct.

With repr(packed(n)), a field can have padding to adjacent fields as
long as its alignment is less than n. So reuse the code we have to align
to a field layout, aligning to the struct layout instead.

Fixes #1934
2020-11-28 03:14:51 +01:00
Emilio Cobos Álvarez
6a5726eac5
lib: Use if let on recently-introduced code. 2020-11-26 13:39:06 +01:00
Emilio Cobos Álvarez
337703b38f lib: Improve c++ auto-detection.
Fixes #1919, as otherwise we peek the wrong include paths unless you
pass "-x c++" or such.
2020-11-26 13:26:08 +01:00
Emilio Cobos Álvarez
11ae35089e
v0.56.0 2020-11-26 11:36:09 +01:00
Varphone Wong
d8082613e2 Add --no-default <regex> flag
Sometimes, we need customize the implement of `Default` for certain types,
In these cases, the `nodefault` annotation can be used to prevent bindgen
to autoderive the `Default` traits for a type.
2020-11-26 11:12:02 +01:00
Emilio Cobos Álvarez
30fb4eccb3 Remove cfg-if dependency.
We use it so little that it's not worth it.
2020-11-25 22:03:08 +01:00
Emilio Cobos Álvarez
01cbe44683 dyngen: Handle variadic functions.
Right now trying to generate a dynamic library with variadic functions
panics because we don't account for the extra `...` in the arguments.

Keeping the current interface for variadic functions is tricky, as we
cannot "wrap" a variadic function (VaList[1] is nightly-only).

However, we don't need to. We're already exposing the libloading error,
so exposing the function pointer field as public is just fine and allows
consumers to call the variadic function.

At that point the can_call() / CheckFoo libraries become pointless (you
can just do library.function.is_ok() or such), so we can simplify the
code as well removing those.

[1]: https://doc.rust-lang.org/std/ffi/struct.VaList.html
2020-11-25 17:25:49 +01:00
Emilio Cobos Álvarez
7792d633c7
codegen: Minor nits for dynamic function generation. 2020-11-25 14:39:47 +01:00
Joe Ellis
c2b5c46ef4
Add tests for dynamic binding generation 2020-11-25 14:39:31 +01:00
Joe Ellis
fc5fa9a8f2
Add dynamic loading support
Closes #1541.
Closes #1846.

Co-authored-by: Michael-F-Bryan <michaelfbryan@gmail.com>
2020-11-25 14:39:31 +01:00
Volker Weißmann
db3d170d3b tests: Added option to hand check test differences. 2020-11-25 14:33:05 +01:00
Emilio Cobos Álvarez
2c72903884
Rustfmt to green up CI. 2020-11-25 14:27:32 +01:00
Samson Ootoovak
90b801fb4f Update clang-sys dependency
Version 1.0.2 of clang-sys fixes an issue that was causing upstream
builds on macOS 11.0 to fail when it couldn't find LLVM configs
properly.

https://github.com/KyleMayes/clang-sys/blob/master/CHANGELOG.md#102---2020-11-17
https://github.com/KyleMayes/clang-sys/pull/118
2020-11-25 14:27:08 +01:00
Emilio Cobos Álvarez
ba4312f745
Document that people can request releases
(and I'd be more than happy to make them happen :))
2020-11-13 20:22:27 +01:00
Emilio Cobos Álvarez
727dc6308b
Document various changes that will get into the next release. 2020-11-13 20:20:06 +01:00
Emilio Cobos Álvarez
84b5455f88
Keep dependencies up-to-date.
A few tests change some formatting, but that's fine.
2020-11-13 20:02:30 +01:00
Emilio Cobos Álvarez
faeaba6ac8
Document 0.47 dot-release. 2020-11-13 19:45:45 +01:00
Emilio Cobos Álvarez
a467d3efc6 codegen: Allow to not derive Debug on enums.
Fixes #1899.

This code predated all the derive machinery, and always hardcoded its
derives.

We could avoid hard-coding the other traits, but those seem
usually-useful, so leave them there for backwards compat for now.
2020-10-16 12:12:17 +02:00
Kyle Mayes
e096149103 Bump clang-sys to 1.0.1 2020-10-07 01:51:58 +02:00
Emilio Cobos Álvarez
1565fd45a9
codegen: Use shorthand struct initialization when possible. 2020-09-16 12:31:41 +02:00
Emilio Cobos Álvarez
2306356183
codegen: Deindent a bit some recently-introduced objective-c code. 2020-09-16 12:31:07 +02:00
Sebastian Imlay
4f714ab79e Fix test for CI 2020-09-16 12:26:24 +02:00
Sebastian Imlay
4a51c4552c Update to fix CI 2020-09-16 12:26:24 +02:00
Sebastian Imlay
59a4c18b17 Updates for CI 2020-09-16 12:26:24 +02:00
Sebastian Imlay
27b0261569 Updated CHANGELOG.md 2020-09-16 12:26:24 +02:00
Sebastian Imlay
d4e84650c8 Updates from PR comments 2020-09-16 12:26:24 +02:00
Sebastian Imlay
0dff6d65d5 Fix spacing issue 2020-09-16 12:26:24 +02:00
Sebastian Imlay
c24626993d First attempt to fix CI 2020-09-16 12:26:24 +02:00
Sebastian Imlay
969aa7a5ee ran cargo fmt 2020-09-16 12:26:24 +02:00
Sebastian Imlay
81d323d8b1 Updates base on comments
* Added TryInto trait implementation from parent to child interfaces.
* Added HashSet for protocols so that the protocol inheritance works as
well.
2020-09-16 12:26:24 +02:00
Sebastian Imlay
840b738ecf Initial stuff for changing ownership and adding inheritance 2020-09-16 12:26:24 +02:00
Youmu
f4d10c3604
Add integration test for name matching 2020-09-15 00:18:51 +02:00
Youmu
f2214790c8
Use path_for_whitelisting instead of canonical_path when matching for enum type specification and template opaque type specification 2020-09-15 00:18:18 +02:00
Emilio Cobos Álvarez
57db7232b7
codegen: Use shorthand initialization in VTable::new. 2020-08-29 17:57:18 +02:00
Adrian Taylor
91d9600c33 Allow grepping bindings for multiple patterns. 2020-08-29 17:11:52 +02:00
Emilio Cobos Álvarez
4608a11b5c
Added constructor return type for wasm32 target (#1877) 2020-08-25 02:15:18 +02:00
Emilio Cobos Álvarez
d492ac4ae1 v0.55.1 2020-08-25 00:38:57 +02:00
Emilio Cobos Álvarez
428189cb41 tests: Improve enum tests to avoid duplication, and add a test for #1880 2020-08-25 00:38:57 +02:00
Emilio Cobos Álvarez
bef180d353 codegen: Do generate unnamed enums, as they can be referred to by members.
Fixes #1880
2020-08-25 00:38:57 +02:00
Audrius
d446a4f6f1 Added expectation test files for clang 3.9 and 4 2020-08-24 21:50:18 +03:00
Audrius
b1cefe2395 Optimized condition order, added regression test 2020-08-24 16:29:43 +03:00
Emilio Cobos Álvarez
0996486f09 Release v0.55.0 2020-08-24 11:58:44 +02:00
Emilio Cobos Álvarez
f4d0b7c652 lib: Fix inferred target when clang target differs from rust target.
Fixes #1211.
2020-08-24 11:57:41 +02:00
Emilio Cobos Álvarez
6653d0c0ae
Document that 0.54.1 has been yanked. 2020-08-23 20:08:55 +02:00
Audrius
7ed01270a5 Added constructor return type for wasm32 target 2020-08-21 17:40:29 +03:00