Skip to content

Commit afa4a5c

Browse files
committed
Merge branch 'master' of https://github.com/rust-lang/rust-bindgen into merge-upstream
2 parents d10e358 + 9c32b46 commit afa4a5c

File tree

1,310 files changed

+25103
-29885
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,310 files changed

+25103
-29885
lines changed

.github/workflows/bindgen.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- master
1010

1111
jobs:
12-
rustfmt:
12+
rustfmt-clippy:
1313
runs-on: ubuntu-latest
1414

1515
steps:
@@ -46,13 +46,13 @@ jobs:
4646
uses: actions-rs/toolchain@v1
4747
with:
4848
profile: minimal
49-
# MSRV below is documented in README.md, please update that if you
49+
# MSRV below is documented in Cargo.toml and README.md, please update those if you
5050
# change this.
51-
toolchain: 1.54.0
51+
toolchain: 1.57.0
5252
override: true
5353

5454
- name: Build with msrv
55-
run: rm Cargo.lock && cargo +1.54.0 build --lib
55+
run: rm Cargo.lock && cargo +1.57.0 build --lib
5656

5757
quickchecking:
5858
runs-on: ubuntu-latest
@@ -68,7 +68,7 @@ jobs:
6868

6969
# TODO: Actually run quickchecks once `bindgen` is reliable enough.
7070
- name: Build quickcheck tests
71-
run: cd tests/quickchecking && cargo test
71+
run: cd bindgen-tests/tests/quickchecking && cargo test
7272

7373
test-expectations:
7474
runs-on: ${{matrix.os}}
@@ -88,7 +88,7 @@ jobs:
8888
override: true
8989

9090
- name: Test expectations
91-
run: cd tests/expectations && cargo test
91+
run: cd bindgen-tests/tests/expectations && cargo test
9292

9393
test:
9494
runs-on: ${{matrix.os}}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
target/
33
*~
44
bindgen-integration/Cargo.lock
5-
tests/expectations/Cargo.lock
5+
bindgen-tests/tests/expectations/Cargo.lock
6+
bindgen-tests/tests/quickchecking/Cargo.lock
67
#*#
78

89
# Test script output

CHANGELOG.md

Lines changed: 131 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -7,133 +7,139 @@
77
- [Removed](#removed)
88
- [Fixed](#fixed)
99
- [Security](#security)
10-
- [0.60.0](#0600)
10+
- [0.61.0](#0610)
1111
- [Added](#added-1)
12-
- [Fixed](#fixed-1)
1312
- [Changed](#changed-1)
14-
- [Removed](#removed-1)
15-
- [0.59.2](#0592)
16-
- [0.59.1](#0591)
13+
- [Fixed](#fixed-1)
14+
- [0.60.1](#0601)
1715
- [Fixed](#fixed-2)
18-
- [0.59.0](#0590)
16+
- [0.60.0](#0600)
1917
- [Added](#added-2)
2018
- [Fixed](#fixed-3)
2119
- [Changed](#changed-2)
22-
- [0.58.1](#0581)
23-
- [Added](#added-3)
24-
- [0.58.0](#0580)
25-
- [Added](#added-4)
20+
- [Removed](#removed-1)
21+
- [0.59.2](#0592)
22+
- [0.59.1](#0591)
2623
- [Fixed](#fixed-4)
24+
- [0.59.0](#0590)
25+
- [Added](#added-3)
26+
- [Fixed](#fixed-5)
2727
- [Changed](#changed-3)
28+
- [0.58.1](#0581)
29+
- [Added](#added-4)
30+
- [0.58.0](#0580)
31+
- [Added](#added-5)
32+
- [Fixed](#fixed-6)
33+
- [Changed](#changed-4)
2834
- [Deprecated](#deprecated)
2935
- [Removed](#removed-2)
30-
- [Fixed](#fixed-5)
36+
- [Fixed](#fixed-7)
3137
- [Security](#security-1)
3238
- [0.57.0](#0570)
33-
- [Added](#added-5)
34-
- [Fixed](#fixed-6)
35-
- [0.56.0](#0560)
3639
- [Added](#added-6)
37-
- [Changed](#changed-4)
38-
- [Fixed](#fixed-7)
39-
- [0.55.1](#0551)
4040
- [Fixed](#fixed-8)
41-
- [0.55.0](#0550)
42-
- [Removed](#removed-3)
41+
- [0.56.0](#0560)
4342
- [Added](#added-7)
4443
- [Changed](#changed-5)
4544
- [Fixed](#fixed-9)
46-
- [0.54.1](#0541)
45+
- [0.55.1](#0551)
46+
- [Fixed](#fixed-10)
47+
- [0.55.0](#0550)
48+
- [Removed](#removed-3)
4749
- [Added](#added-8)
4850
- [Changed](#changed-6)
49-
- [Fixed](#fixed-10)
50-
- [0.54.0](#0540)
51+
- [Fixed](#fixed-11)
52+
- [0.54.1](#0541)
5153
- [Added](#added-9)
5254
- [Changed](#changed-7)
53-
- [Fixed](#fixed-11)
54-
- [0.53.3](#0533)
55-
- [Added](#added-10)
5655
- [Fixed](#fixed-12)
57-
- [0.53.2](#0532)
56+
- [0.54.0](#0540)
57+
- [Added](#added-10)
5858
- [Changed](#changed-8)
59-
- [0.53.1](#0531)
59+
- [Fixed](#fixed-13)
60+
- [0.53.3](#0533)
6061
- [Added](#added-11)
61-
- [0.53.0](#0530)
62-
- [Added](#added-12)
62+
- [Fixed](#fixed-14)
63+
- [0.53.2](#0532)
6364
- [Changed](#changed-9)
64-
- [Fixed](#fixed-13)
65-
- [0.52.0](#0520)
65+
- [0.53.1](#0531)
66+
- [Added](#added-12)
67+
- [0.53.0](#0530)
6668
- [Added](#added-13)
6769
- [Changed](#changed-10)
68-
- [Fixed](#fixed-14)
69-
- [0.51.1](#0511)
7070
- [Fixed](#fixed-15)
71+
- [0.52.0](#0520)
72+
- [Added](#added-14)
7173
- [Changed](#changed-11)
72-
- [0.51.0](#0510)
7374
- [Fixed](#fixed-16)
75+
- [0.51.1](#0511)
76+
- [Fixed](#fixed-17)
7477
- [Changed](#changed-12)
75-
- [Added](#added-14)
76-
- [0.50.0](#0500)
78+
- [0.51.0](#0510)
79+
- [Fixed](#fixed-18)
80+
- [Changed](#changed-13)
7781
- [Added](#added-15)
78-
- [0.49.3](#0493)
82+
- [0.50.0](#0500)
7983
- [Added](#added-16)
84+
- [0.49.3](#0493)
85+
- [Added](#added-17)
8086
- [0.49.2](#0492)
81-
- [Changed](#changed-13)
82-
- [0.49.1](#0491)
83-
- [Fixed](#fixed-17)
8487
- [Changed](#changed-14)
85-
- [0.49.0](#0490)
86-
- [Added](#added-17)
87-
- [Fixed](#fixed-18)
88+
- [0.49.1](#0491)
89+
- [Fixed](#fixed-19)
8890
- [Changed](#changed-15)
91+
- [0.49.0](#0490)
92+
- [Added](#added-18)
93+
- [Fixed](#fixed-20)
94+
- [Changed](#changed-16)
8995
- [0.48.1](#0481)
90-
- [Fixed](#fixed-19)
96+
- [Fixed](#fixed-21)
9197
- [0.48.0](#0480)
92-
- [Changed](#changed-16)
93-
- [Fixed](#fixed-20)
98+
- [Changed](#changed-17)
99+
- [Fixed](#fixed-22)
94100
- [0.47.4](#0474)
95-
- [Added](#added-18)
101+
- [Added](#added-19)
96102
- [0.47.3](#0473)
97-
- [Changed](#changed-17)
103+
- [Changed](#changed-18)
98104
- [0.47.2](#0472)
99-
- [Fixed](#fixed-21)
105+
- [Fixed](#fixed-23)
100106
- [0.47.1](#0471)
101-
- [Changed](#changed-18)
102-
- [Fixed](#fixed-22)
103-
- [0.47.0](#0470)
104107
- [Changed](#changed-19)
105-
- [Fixed](#fixed-23)
108+
- [Fixed](#fixed-24)
109+
- [0.47.0](#0470)
110+
- [Changed](#changed-20)
111+
- [Fixed](#fixed-25)
106112
- [0.33.1 .. 0.46.0](#0331--0460)
107-
- [Added](#added-19)
113+
- [Added](#added-20)
108114
- [Removed](#removed-4)
109-
- [Changed](#changed-20)
110-
- [Fixed](#fixed-24)
115+
- [Changed](#changed-21)
116+
- [Fixed](#fixed-26)
111117
- [0.33.1](#0331)
112-
- [Fixed](#fixed-25)
118+
- [Fixed](#fixed-27)
113119
- [0.33.0](#0330)
114120
- [0.32.2](#0322)
115-
- [Fixed](#fixed-26)
121+
- [Fixed](#fixed-28)
116122
- [0.32.1](#0321)
117-
- [Fixed](#fixed-27)
123+
- [Fixed](#fixed-29)
118124
- [0.32.0](#0320)
119-
- [Added](#added-20)
120-
- [Changed](#changed-21)
121-
- [Fixed](#fixed-28)
122-
- [0.31.0](#0310)
123125
- [Added](#added-21)
124126
- [Changed](#changed-22)
127+
- [Fixed](#fixed-30)
128+
- [0.31.0](#0310)
129+
- [Added](#added-22)
130+
- [Changed](#changed-23)
125131
- [Deprecated](#deprecated-1)
126132
- [Removed](#removed-5)
127-
- [Fixed](#fixed-29)
133+
- [Fixed](#fixed-31)
128134
- [0.30.0](#0300)
129-
- [Added](#added-22)
130-
- [Changed](#changed-23)
131-
- [Deprecated](#deprecated-2)
132-
- [Fixed](#fixed-30)
133-
- [0.29.0](#0290)
134135
- [Added](#added-23)
135136
- [Changed](#changed-24)
136-
- [Fixed](#fixed-31)
137+
- [Deprecated](#deprecated-2)
138+
- [Fixed](#fixed-32)
139+
- [0.29.0](#0290)
140+
- [Added](#added-24)
141+
- [Changed](#changed-25)
142+
- [Fixed](#fixed-33)
137143

138144
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
139145

@@ -142,15 +148,70 @@
142148
# Unreleased
143149

144150
## Added
151+
* new feature: `--override-abi` flag to override the ABI used by functions
152+
matching a regular expression.
145153

146154
## Changed
147155

156+
* Regex inputs are sanitized so alternation (`a|b`) is handled correctly but
157+
wildcard patterns (`*`) are now considered invalid.
158+
* the `ParseCallbacks`trait does not require to implement `UnwindSafe`.
159+
* the `Builder::parse_callbacks` method no longer overwrites previously added
160+
callbacks and composes them in a last-to-first manner.
161+
148162
## Removed
149163

150164
## Fixed
151165

152166
## Security
153167

168+
# 0.61.0
169+
170+
Released 2022/10/16
171+
172+
## Added
173+
174+
* new feature: `--sort-semantically` flag to sort the output in a predefined
175+
manner [(#1743)].
176+
* new feature: `Bindgen::emit_warnings` method to emit warnings to stderr in
177+
build scripts.
178+
* new feature: `--newtype-global-enum` flag to generate enum variants as
179+
global constants.
180+
* new feature: `--default-non-copy-union-style` flag to set the default style
181+
of code used to generate unions with non-`Copy` members.
182+
* new feature: `--bindgen-wrapper-union` flag to mark any union that matches a
183+
regex and has a non-Copy member to use a bindgen-generated wrapper for its
184+
fields.
185+
* new feature: `--manually-drop-union` flag to mark any union that matches a
186+
regex and has a non-`Copy` member to use `ManuallyDrop`.
187+
* new feature: `--merge-extern-blocks` flag to merge several `extern` blocks
188+
that have the same ABI.
189+
* new feature: `--no-size_t-is-usize` flag to not bind `size_t` as `usize`.
190+
* new feature: `Builder` implements `Clone`.
191+
192+
## Changed
193+
194+
* clap and regex have been updated, new msrv is 1.57.
195+
* The `--enable-function-attribute-detection` flag is also used to detect
196+
diverging functions so the generated bindings use `!` as the return type.
197+
* The `--size_t-is-usize` flag is enabled by default.
198+
* Unused type aliases for `<stdint.h>` types are no longer emitted.
199+
* The `blocklist` options now can be used to block objective-C methods.
200+
* The `core::ffi` module is used the sized raw integer types
201+
instead of `std::os::raw` if the Rust target version is `1.64` or higher and
202+
the `--use-core` flag is enabled.
203+
* The `bindgen` CLI utility must be installed using `cargo install
204+
bindgen-cli` now.
205+
* Using `bindgen` as a library no longer pulls clap and any other CLI
206+
related dependencies.
207+
208+
## Fixed
209+
210+
* Const correctness of incomplete arrays has been fixed. (#2301)
211+
* C++ inline namespaces don't panic. (#2294)
212+
213+
[(#1743)]: https://github.com/rust-lang/rust-bindgen/issues/1743
214+
154215
# 0.60.1
155216

156217
Released 2022/06/06

CONTRIBUTING.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ $ cargo test
152152

153153
### Testing a Single Header's Bindings Generation and Compiling its Bindings
154154

155+
Note: You will to need to install [Graphviz](https://graphviz.org/) since that
156+
is a dependency for running `test-one.sh`.
157+
155158
Sometimes its useful to work with one test header from start (generating
156159
bindings for it) to finish (compiling the bindings and running their layout
157160
tests). This can be done with the `tests/test-one.sh` script. It supports fuzzy
@@ -315,7 +318,19 @@ parameters a given type uses. The analyses are defined in
315318

316319
The final phase is generating Rust source text from the analyzed IR, and it is
317320
defined in `src/codegen/*`. We use the `quote` crate, which provides the `quote!
318-
{ ... }` macro for quasi-quoting Rust forms.
321+
{ ... }` macro for quasi-quoting Rust forms. Some options that affect the
322+
generated Rust code are implemented using the [`syn`](https://docs.rs/syn) crate.
323+
324+
### Implementing new options using `syn`
325+
326+
If a new option can be implemented using the `syn` crate it should be added to
327+
the `codegen::postprocessing` module by following these steps:
328+
329+
- Introduce a new field to `BindgenOptions` for the option.
330+
- Write a free function inside `codegen::postprocessing` implementing the
331+
option. This function with the same name of the `BindgenOptions` field.
332+
- Add a new value to the `codegen::postprocessing::PASSES` for the option using
333+
the `pass!` macro.
319334

320335
## Pull Requests and Code Reviews
321336

@@ -404,7 +419,7 @@ $ brew install creduce
404419
$ # Etc...
405420
```
406421

407-
[Otherwise, follow these instructions for building and/or installing `creduce`.](https://github.com/csmith-project/creduce/blob/master/INSTALL)
422+
Otherwise, follow [these instructions](https://github.com/csmith-project/creduce/blob/master/INSTALL.md) for building and/or installing `creduce`.
408423

409424
Running `creduce` requires two things:
410425

0 commit comments

Comments
 (0)