Commit Graph

2985 Commits

Author SHA1 Message Date
Saleem Rashid
704c02b579 Revert "Run tests on AArch64"
This reverts commit 0f8ceb68fd.
2021-02-08 13:29:31 +01:00
Corey Farwell
04c653b665 Fix heading level 2021-02-08 11:59:47 +01:00
Emilio Cobos Álvarez
8ac787a9b4 codegen: Track union layout more accurately.
Instead of always generating the _bindgen_union_align method (which
shouldn't be needed at all for Rust structs, since the struct layout
tracker already deals with adding repr(align) as necessary) make sure to
visit all fields appropriately to generate the correct alignment.
2021-02-07 23:10:28 +01:00
Aaron Miller
17476e9f4e OpenBSD requirements 2021-02-07 20:31:03 +01:00
Corey Farwell
0f8ceb68fd Run tests on AArch64 2021-02-04 16:46:38 +01:00
Emilio Cobos Álvarez
43a05656ae
Fix changelog (run doctoc, plus we're in 2021 already) 2021-02-01 14:08:28 +01:00
Emilio Cobos Álvarez
5ca2fc7a02 v0.57.0 2021-02-01 14:06:00 +01:00
Corey Farwell
c509ef12ac Add failing regression test for #1973. 2021-01-30 16:48:20 +01:00
Weston Carvalho
e0f06c7fb2 Generate fields as non-pub if they would be access restricted in C++. 2021-01-29 13:18:25 +01:00
Andrey Pushkar
51778893c4
Use absolute paths for unsaved files passed to clang and prepend -include directives to them.
Fixes #1771
Closes #1857
2021-01-10 15:39:20 +01:00
Eric Huss
9de0d64fc0 Update mdbook 2021-01-04 19:20:04 +01:00
Emilio Cobos Álvarez
922655f336 ci: update mdbook. 2020-12-26 23:19:33 +01:00
Emilio Cobos Álvarez
8945fa637e
book: Touch the book to ensure that GH actions deploy works. 2020-12-26 23:04:09 +01:00
Emilio Cobos Álvarez
faf8b3edba ci: Move the remaining CI tasks (updating the book) to GitHub actions. 2020-12-26 20:46:42 +01:00
Emilio Cobos Álvarez
fde75f68e7 ci: Switch most CI to GitHub actions. 2020-12-26 19:01:53 +01:00
Emilio Cobos Álvarez
afa50fa1ad tests: Remove unnecessary system header include that makes macos unhappy 2020-12-26 19:01:53 +01:00
Emilio Cobos Álvarez
a0cd041415 integration: Forward some features to bindgen. 2020-12-26 19:01:53 +01:00
Emilio Cobos Álvarez
c5f1c73be3 Allow log stubs to be unused. 2020-12-26 19:01:53 +01:00
Emilio Cobos Álvarez
669dc1b628 comp: Fix bitfields to allow underaligned fields after them to take padding space.
Fixes #1947.

There are two separate issues here: First, the change in comp.rs ensures
that we don't round up the amount of storage to the alignment of the
bitfield. That generates the "expected" output in #1947
(`__BindgenBitfieldUnit<[u8; 3], u16>`).

But that's still not enough to fix that test-case because
__BindgenBitfieldUnit would be aligned and have padding, and Rust won't
put the extra field in the padding.

In order to ensure the bitfield starts at the right alignment, but that
Rust can put stuff in the extra field, we need to make a breaking change
and split the generated fields in two: One preceding that guarantees
alignment, and the actual storage, bit-aligned.

This keeps the existing behavior while fixing that test-case.
2020-12-20 21:29:47 +01:00
Emilio Cobos Álvarez
98841b32ed context: Escape the dyn keyword properly.
Fixes #1946
2020-12-20 20:36:03 +01:00
Emilio Cobos Álvarez
4ce4b934fd tests: Add another fit-macro-constant-types test. 2020-12-19 19:28:24 +01:00
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